Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying out the new version of LFS. The lfs-packages built fine, but I have some problems with the extra packages I want to have. I installed pacman in the toolchain, and he had some problems with the new version of curl. In Arch they had added a headerfile to curl, so I tried it out and it worked.
Now I'm stuck on fakeroot. To me it looks like the actual code of the program is not compatible with, I don't know if it is gcc or which package(s).
Code:
Making all in test
make[2]: Entering directory `/tmp/build/fakeroot/src/fakeroot-1.19/test'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/tmp/build/fakeroot/src/fakeroot-1.19/test'
make[2]: Entering directory `/tmp/build/fakeroot/src/fakeroot-1.19'
awk -f ./wrapawk < ./wrapfunc.inp
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -O2 -march=core2 -mtune=corei7 -MT libfakeroot.lo -MD -MP -MF .deps/libfakeroot.Tpo -c -o libfakeroot.lo libfakeroot.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -O2 -march=core2 -mtune=corei7 -MT libfakeroot.lo -MD -MP -MF .deps/libfakeroot.Tpo -c libfakeroot.c -fPIC -DPIC -o .libs/libfakeroot.o
In file included from libfakeroot.c:223:0:
wrapped.h:125:27: error: unknown type name 'cap_user_header_t'
extern int (*next_capset)(cap_user_header_t hdrp, const cap_user_data_t datap);
^
wrapped.h:125:27: error: unknown type name 'cap_user_data_t'
In file included from libfakeroot.c:224:0:
wraptmpf.h:373:17: error: unknown type name 'cap_user_header_t'
int tmp_capset (cap_user_header_t hdrp, const cap_user_data_t datap){
^
wraptmpf.h:373:17: error: unknown type name 'cap_user_data_t'
In file included from libfakeroot.c:225:0:
wrapdef.h:125:20: error: unknown type name 'cap_user_header_t'
int (*next_capset)(cap_user_header_t hdrp, const cap_user_data_t datap)=tmp_capset;
^
wrapdef.h:125:20: error: unknown type name 'cap_user_data_t'
In file included from libfakeroot.c:226:0:
wrapstruct.h:126:14: error: 'next_capset' undeclared here (not in a function)
{(void(*))&next_capset, "capset"},
^
libfakeroot.c:1565:12: error: unknown type name 'cap_user_header_t'
int capset(cap_user_header_t hdrp, const cap_user_data_t datap)
^
libfakeroot.c:1565:12: error: unknown type name 'cap_user_data_t'
libfakeroot.c: In function 'fts_read':
libfakeroot.c:1948:5: warning: passing argument 1 of 'send_get_stat64' from incompatible pointer type [enabled by default]
SEND_GET_STAT64(r->fts_statp, _STAT_VER);
^
In file included from libfakeroot.c:60:0:
communicate.h:209:13: note: expected 'struct stat64 *' but argument is of type 'struct stat *'
extern void send_get_stat64(struct stat64 *buf);
^
libfakeroot.c: In function 'fts_children':
libfakeroot.c:1971:7: warning: passing argument 1 of 'send_get_stat64' from incompatible pointer type [enabled by default]
SEND_GET_STAT64(r->fts_statp, _STAT_VER);
^
In file included from libfakeroot.c:60:0:
communicate.h:209:13: note: expected 'struct stat64 *' but argument is of type 'struct stat *'
extern void send_get_stat64(struct stat64 *buf);
^
make[2]: *** [libfakeroot.lo] Error 1
make[2]: Leaving directory `/tmp/build/fakeroot/src/fakeroot-1.19'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/build/fakeroot/src/fakeroot-1.19'
make: *** [all] Error 2
I tried to google, but didn't find anything relevant. I checked the PKGBUILD for Arch, but there was nothing special about fakeroot. They have the same version of fakeroot, glibc and gcc.
Does anyone have an idea? If the solution is not to change something in fakeroot, but in some other package, I don't know what that could be.
He he, as usual, the best way to clear the mind and think better, is to ask about the problem here. I found the buildscripts for debian sid, and there it said fakeroot now depend on libcap. So I installed attr and libcap, and then fakeroot built fine. (I now remember I updated fakeroot after I built 7.3, so I haven't installed this version in "chapter 6" before.)
Now I feel that I have successfully built LFS-7.4rc1.
He he, as usual, the best way to clear the mind and think better, is to ask about the problem here. I found the buildscripts for debian sid, and there it said fakeroot now depend on libcap. So I installed attr and libcap, and then fakeroot built fine. (I now remember I updated fakeroot after I built 7.3, so I haven't installed this version in "chapter 6" before.)
Now I feel that I have successfully built LFS-7.4rc1.
Hi Lennie,
What are the instructions you are using here?
I've been attempting to build using this hint but already encountered a problem in the first stage. I am trying to build fakeroot in the chroot environment and tried to install libcap and its dependency attr.
This gives the error due to gettext not being there.
Gettext should be installed in both the chapter 5 and 6...
I didn't install fakeroot in the toolschain. I built chapter 6 as root, and installed fakeroot at the end of chapter 6.
The extra packages I installed in chapter 5 was: zlib, openssl, libarchive, curl, and pacman.
In chapter 6 I installed: openssl, libarchive, curl, attr, libcap, fakeroot, sudo and pacman.
Then I reinstalled pacman after I installed gpgme.
Gettext should be installed in both the chapter 5 and 6...
I didn't install fakeroot in the toolschain. I built chapter 6 as root, and installed fakeroot at the end of chapter 6.
The extra packages I installed in chapter 5 was: zlib, openssl, libarchive, curl, and pacman.
In chapter 6 I installed: openssl, libarchive, curl, attr, libcap, fakeroot, sudo and pacman.
Then I reinstalled pacman after I installed gpgme.
Gettext in Chapter 5 installs just the msgfmt binary. attr requires msgmerge as well. Trying to install it and continue. Will report back on it.
Would there be any documentation or anything I could refer to understand the workings of the method you use, please? Would be a great help indeed! Thanks
I have been reading through the hint you linked to. I must say it was the worst crap I've ever read! Please don't follow it. It's unbelievable how much one can complicate a thing that is actually quite easy. I'll give you some detailed instructions of how to do this in a much easier way.
I've been going through my scripts, and removed the parts that is specific for my system, and made them more generic. I think I'll better run through them and make sure I didn't introduce new bugs, then I can upload them somewhere so you can get them. (If they work as expected it'll take 33 minutes for the toolchain and <2 hours for chapter 6.)
In the meantime you can look at the scripts from baho-utot. I learned how to build lfs with pacman from them. They are a bit outdated, and pacman has changed quite a lot since then and has different dependencies, but you can still learn a lot from them.
I hope this works now. I'm quite tired of thinking and writing and more thinking, so I hope I didn't screw it up. It's different things to think of when writing scripts for others to use, than to just do it for oneself... And I'm not so used to writing how-tos.
These are the scripts I used for my last build of lfs-7.4rc2. It's a work
in progress, and they will change when I get better ideas. You can use them
at your own risk, but don't blame me if they bork your system, or whatever
catastrophy might happen if you run them. But you really should look through
them first and see what they'll do. You most likely want to change some
of them.
These scripts will not do everything for you. They will only automate the
actual building of the packages, so you'll also need to do a lot of stuff
manually.
Follow the book until chapter 5.4, when the actual building starts, with
the exception that you should put the sources in a different place. For
these scripts to work without the need to change too much you need to put
the sources in $LFS/build/sources. You also need to create the same
directory structure as this tarball has, or just untar it in $LFS.
So when you have done up to and including chapter 5.3, you should be loged-in
as the lfs user, cd to $LFS/build/scripts and from there run the script
'build-tools'. That should build chapter 5 for you.
When the script has completed you should go back to the book in chapter
5.35 and follow the book until chapter 6.7, where the actual building of
chapter 6 starts. Before you run the next script, you might want to change
a few thing.
* $LFS/tools/etc/makepkg.conf
You might want to uncomment CFLAGS CXXFLAGS and MAKEFLAGS, and change them
to what is right for your system.
* tzdata/PKGBUILD
It sets the timezone to Europe/Stockholm, change it to your timezone.
* glibc/locales
That file list which languages will be generated. Now it only includes
US english. If you want another language you need to add it. (Instructions
of how to do that is in that file.) You might need to manually run
'locale-gen' as root after the script has completed.
Inside the chroot, cd /build/scrips and from there run 'first-build-lfs'.
After this script has finished, before you can continue building and
installing packages with pacman, you need to edit the the new configuration
files /etc/makepkg.conf and /etc/pacman.conf. (Pacman must be the last
package installed in this script. If you want to add more packages in this
script, put them before pacman.)
When it has completed, go back to the book in chapter 6.66 and complete
the book. You don't need to do the stripping, as makepkg has already done
it for you. (Unless you change it in makepkg.conf.) You have already
installed the bootscripts and most of the scripts in chapter 7. You just
need to look through them to see what you need to change.
I don't build grub, so I have no PKGBUILD for it.
When you have finished the book, you can enter the chroot again and continue
building the packages in 'build-lfs'. I recommend recompiling util-linux
now, when udev is installed, to get some extra features. Then 'lsblk -f'
is a very useful command to get info about partitions.
If one of the scripts stops for whatever reason, they can be started again
and they'll continue where they left off.
I am studying your scripts at the moment and you really should make that a LFS hint!
Just to sum up the steps. Please do correct me if I'm wrong.
1. The toolchain in Chapter 5 is build as per book instructions. At the end openssl,libarchive,curl and pacman are built and the ca-certificates are copied over.
2. After chrooting, the final lfs system is built using PKGBUILDs of the LFS programs, as well as well as openssl, libarchive, curl, attr, libcap, fakeroot, sudo and pacman. Grub(if required) will be installed in this stage.
3. Finally, after completing the book, build pacman again.
This is the first time I'm going over a LFSers automated code and am learning a lot. I gad a very bare bone version with a whole muddle of switch cases!
Yes, that is correct. The reason to rebuild pacman is to add some features from gpgme. It's needed for package signing and to have makepkg check signatures of source code. If you don't want those features, you don't have to rebuild pacman.
For the benefit of anyone else reading this, I got an error when running first-build-lfs
Code:
error: failed to initialize alpm library (could not find or read directory)
Resolved by
Code:
mkdir /var/lib/pacman
Currently having an issue with md5sums ...
Lennie, could you please give me a pointer on how you got the md5sums for the locale file in glibc? I can't figure out what went wrong as I am using the same as yours (en_US.UTF-8 UTF-8) but with a different timezone.
I just realized some tests fail because the languages isn't generated after glibc is installed, when building with my scripts. In case someone wants to use my scripts as they are, I have added a line to generate the languages. I have uploaded a new tarball, but if you already have it you can just add it to the script 'first-build-lfs'. Part of the script should look like this:
Really sorry but, nah :s
Also deleted the glibc related logfiles.
Still getting the error
Code:
==> Making package: glibc 2.18-1 (Wed Sep 4 07:20:50 UTC 2013)
==> WARNING: Skipping dependency checks.
==> Retrieving sources...
-> Found glibc-2.18.tar.xz
-> Found ld.so.conf
-> Found locale-gen
-> Found locales
-> Found nsswitch.conf
==> Validating source files with md5sums...
glibc-2.18.tar.xz ... Passed
ld.so.conf ... Passed
locale-gen ... Passed
locales ... FAILED
nsswitch.conf ... Passed
==> ERROR: One or more files did not pass the validity check!
I have been a bit off-topic lately in my threads, but now I want to go back to topic for this thread, which is fakeroot and LFS 7.4. The problem is that I can't get fakeroot working in 7.4. I have built several packages with it, and in most of them my user ends up as the owner of the files. But for some reason, in some packages it works, and root is the owner, and it seems to be all the time the same packages.
I got no error when I build fakeroot, and also in the logs for the packages I've built with fakeroot there are no errors. I don't know if it is glibc or the kernel, I think it must be one of those.
I made one build with linux-api-headers 3.4.61, but I was running linux 3.10.10 when I build it. It was the same problem, that I ended up as the owner of most packages. I compiled linux 3.4.61 on the host and booted with, and then compiled some packages in the chroot, but the problem was the same.
In Arch they have 2 patches for glibc
Code:
# upstream commit 91ce4085
patch -p1 -i $srcdir/glibc-2.18-readdir_r-CVE-2013-4237.patch
# hack fix for strstr issues on x86
patch -p1 -i $srcdir/glibc-2.18-strstr-hackfix.patch
They have nothing special for fakeroot. I might try one or both and see if it works.
I have also tried fakeroot-ng I needed to add a sed to get it compile
Code:
sed -i -e 's|linux/ptrace.h|asm/ptrace.h|' arch/os.c
To get the script makepkg (from pacman) to work with it I created a symlink /usr/bin/fakeroot --> fakeroot-ng and I removed (from line 2889)
Code:
else
if [[ -z $FAKEROOTKEY ]]; then
error "$(gettext "Do not use the %s option. This option is only for use by %s.")" "'-F'" "makepkg"
exit 1 # TODO: error code
fi
It entered fakeroot and started the package function and 'make install', but then it stopped with an error
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.