[SOLVED] Can't compile udev: undefined reference to `__secure_getenv'
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.
Can't compile udev: undefined reference to `__secure_getenv'
I have tried several times, but I always get the same error. I'm building lfs-7.3, host is lfs-7.2.
Code:
udev-lfs-197-2/
udev-lfs-197-2/55-lfs.rules
udev-lfs-197-2/55-lfs.txt
udev-lfs-197-2/81-cdrom.rules
udev-lfs-197-2/83-cdrom-symlinks.rules
udev-lfs-197-2/ChangeLog
udev-lfs-197-2/Makefile.lfs
udev-lfs-197-2/README
udev-lfs-197-2/cfg.h
udev-lfs-197-2/init-net-rules.sh
udev-lfs-197-2/makefile-incl.gir
udev-lfs-197-2/makefile-incl.gudev
udev-lfs-197-2/makefile-incl.keymap
udev-lfs-197-2/rule_generator.functions
udev-lfs-197-2/udevd.8
udev-lfs-197-2/write_cd_rules
udev-lfs-197-2/write_net_rules
udev-lfs-197-2/contrib/
udev-lfs-197-2/contrib/debian/
udev-lfs-197-2/contrib/debian/83-cdrom-symlinks.rules
udev-lfs-197-2/contrib/debian/write_cd_aliases
udev-lfs-197-2/contrib/debian/81-cdrom.rules
nm: /lib/libc.so.6: no symbols
sed -e 's/LFS-VERSION/197/' \
-e 's/SECURE_GETENV/__SECURE_GETENV/' \
udev-lfs-197-2/cfg.h > ./cfg.h
CC src/shared/log.c
src/shared/log.c: In function ‘log_parse_environment’:
src/shared/log.c:878:9: warning: implicit declaration of function ‘__secure_getenv’ [-Wimplicit-function-declaration]
src/shared/log.c:878:11: warning: assignment makes pointer from integer without a cast [enabled by default]
src/shared/log.c:882:11: warning: assignment makes pointer from integer without a cast [enabled by default]
src/shared/log.c:886:11: warning: assignment makes pointer from integer without a cast [enabled by default]
src/shared/log.c:890:11: warning: assignment makes pointer from integer without a cast [enabled by default]
CC src/shared/label.c
CC src/shared/mkdir.c
CC src/shared/cgroup-util.c
CC src/shared/strv.c
CC src/shared/strbuf.c
CC src/shared/path-util.c
CC src/shared/conf-files.c
CC src/shared/hashmap.c
CC src/shared/set.c
CC src/shared/exit-status.c
CC src/shared/util.c
CC src/shared/dev-setup.c
CC src/login/sd-login.c
CC src/libsystemd-daemon/sd-daemon.c
CC src/shared/time-util.c
CC src/libudev/libudev-device-private.c
CC src/libudev/libudev-device.c
CC src/libudev/libudev-enumerate.c
CC src/libudev/libudev-hwdb.c
CC src/libudev/libudev-list.c
CC src/libudev/libudev-monitor.c
CC src/libudev/libudev-queue-private.c
CC src/libudev/libudev-queue.c
CC src/libudev/libudev-util.c
CC src/libudev/libudev.c
src/libudev/libudev.c: In function ‘udev_new’:
src/libudev/libudev.c:203:9: warning: implicit declaration of function ‘__secure_getenv’ [-Wimplicit-function-declaration]
src/libudev/libudev.c:203:13: warning: assignment makes pointer from integer without a cast [enabled by default]
CC src/udev/udev-ctrl.c
CC src/udev/udev-rules.c
CC src/udev/udev-watch.c
CC src/udev/udev-event.c
CC src/udev/udev-node.c
CC src/udev/udev-builtin.c
CC src/udev/udev-builtin-blkid.c
CC src/udev/udev-builtin-firmware.c
CC src/udev/udev-builtin-path_id.c
CC src/udev/udev-builtin-hwdb.c
CC src/udev/udev-builtin-kmod.c
CC src/udev/udev-builtin-uaccess.c
CC src/udev/udev-builtin-net_id.c
CC src/udev/udev-builtin-usb_id.c
CC src/udev/udev-builtin-input_id.c
CC src/udev/udev-builtin-btrfs.c
AR build/udev-local.a
LINK build/libudev.so.1.0.2
ln -sfn libudev.so.1.0.2 build/libudev.so.1
ln -sfn libudev.so.1.0.2 build/libudev.so
CC src/udev/udevd.c
LINK build/udevd
build/udev-local.a(log.o): In function `log_parse_environment':
log.c:(.text.log_parse_environment+0xb): undefined reference to `__secure_getenv'
log.c:(.text.log_parse_environment+0x31): undefined reference to `__secure_getenv'
log.c:(.text.log_parse_environment+0x57): undefined reference to `__secure_getenv'
log.c:(.text.log_parse_environment+0x7d): undefined reference to `__secure_getenv'
build/udev-local.a(libudev.o): In function `udev_new':
libudev.c:(.text.udev_new+0x1e3): undefined reference to `__secure_getenv'
collect2: error: ld returned 1 exit status
make: *** [build/udevd] Error 1
I have googled the error, but I only find a thread where the developer were discussing this problem for glibc<2.17, but I have 2.17. Can someone help me with this?
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 3,129
Rep:
came across this error a while back but not recently have a look at this post:http://permalink.gmane.org/gmane.linux.lfs.book/24474
And then have a look at Makefile.lfs in the udev-lfs-197-2 archive and also config.h.in in systemd-197 archive, you just need to get the defines right.
I also tried the same command at the host, and got the same result... It seems like something is really wrong also with my lfs-7.2. But I find it strange that I have come this far - I have been running it as my main system for several weeks...
I can't find anything in my logs about what is wrong.
Code:
/mnt/lfs/sources
└─$ grep -r Error
tools/log/perl.log:cp lib/CPANPLUS/Error.pm ../../lib/CPANPLUS/Error.pm
tools/log/perl.log:'lib/CPANPLUS/Error.pm' -> '/tools/lib/perl5/5.16.2/CPANPLUS/Error.pm'
tools/log/glibc.log:make[2]: [/tools/libexec/pt_chown] Error 1 (ignored)
tools/log/ncurses.log:make[1]: [/tools/lib/libncurses.so.5.9] Error 1 (ignored)
tools/log/ncurses.log:make[1]: [/tools/lib/libpanel.so.5.9] Error 1 (ignored)
tools/log/ncurses.log:make[1]: [/tools/lib/libmenu.so.5.9] Error 1 (ignored)
tools/log/ncurses.log:make[1]: [/tools/lib/libform.so.5.9] Error 1 (ignored)
tools/log/gcc-pass-2.log:make[2]: [stamp-parallel] Error 1 (ignored)
lfs/gcc/gcc-check.log:make[3]: [check-parallel-gcc] Error 1 (ignored)
lfs/gcc/gcc-check.log:make[3]: [check-parallel-g++] Error 1 (ignored)
lfs/gcc/gcc-check.log:make[4]: *** [check-DEJAGNU] Error 1
lfs/gcc/gcc-check.log:make[3]: *** [check-am] Error 2
lfs/gcc/gcc-check.log:make[2]: *** [check-recursive] Error 1
lfs/gcc/gcc-check.log:make[1]: *** [check-target-libstdc++-v3] Error 2
lfs/gcc/gcc-check.log:make[4]: *** [check-DEJAGNU] Error 1
lfs/gcc/gcc-check.log:make[3]: *** [check-am] Error 2
lfs/gcc/gcc-check.log:make[2]: *** [check-recursive] Error 1
lfs/gcc/gcc-check.log:make[1]: *** [check-target-libmudflap] Error 2
lfs/gcc/gcc-check.log:make: *** [do-check] Error 2
lfs/gcc/build.log:make[3]: [check-parallel-gcc] Error 1 (ignored)
lfs/gcc/build.log:make[3]: [check-parallel-g++] Error 1 (ignored)
lfs/gcc/build.log:make[4]: *** [check-DEJAGNU] Error 1
lfs/gcc/build.log:make[3]: *** [check-am] Error 2
lfs/gcc/build.log:make[2]: *** [check-recursive] Error 1
lfs/gcc/build.log:make[1]: *** [check-target-libstdc++-v3] Error 2
lfs/gcc/build.log:make[4]: *** [check-DEJAGNU] Error 1
lfs/gcc/build.log:make[3]: *** [check-am] Error 2
lfs/gcc/build.log:make[2]: *** [check-recursive] Error 1
lfs/gcc/build.log:make[1]: *** [check-target-libmudflap] Error 2
lfs/gcc/build.log:make: *** [do-check] Error 2
lfs/ncurses/build.log:make[1]: [/sources/lfs/ncurses/pkg/usr/lib/libncursesw.so.5.9] Error 1 (ignored)
lfs/ncurses/build.log:make[1]: [/sources/lfs/ncurses/pkg/usr/lib/libpanelw.so.5.9] Error 1 (ignored)
lfs/ncurses/build.log:make[1]: [/sources/lfs/ncurses/pkg/usr/lib/libmenuw.so.5.9] Error 1 (ignored)
lfs/ncurses/build.log:make[1]: [/sources/lfs/ncurses/pkg/usr/lib/libformw.so.5.9] Error 1 (ignored)
lfs/perl/build.log:cp lib/CPANPLUS/Error.pm ../../lib/CPANPLUS/Error.pm
lfs/perl/build.log: /usr/lib/perl5/5.16.2/CPANPLUS/Error.pm
lfs/perl/build.log: /usr/share/man/man3/CPANPLUS::Error.3
lfs/groff/build.log:make[2]: [install_data] Error 1 (ignored)
lfs/e2fsprogs/build.log:make[1]: [libext2fs.dvi] Error 1 (ignored)
lfs/glibc/glibc-check.log:make[2]: [/sources/lfs/glibc/src/glibc-build/posix/annexc.out] Error 1 (ignored)
lfs/glibc/glibc-check.log:make[2]: [/sources/lfs/glibc/src/glibc-build/conform/run-conformtest.out] Error 1 (ignored)
lfs/glibc/build.log:make[2]: [/sources/lfs/glibc/src/glibc-build/posix/annexc.out] Error 1 (ignored)
lfs/glibc/build.log:make[2]: [/sources/lfs/glibc/src/glibc-build/conform/run-conformtest.out] Error 1 (ignored)
lfs/glibc/build.log:./creature.texi:1: warning: node `Checking for Errors' is next for `Feature Test Macros' in menu but not in sectioning
lfs/glibc/build.log:./memory.texi:27: warning: node `Error Messages' is prev for `Memory Concepts' in menu but not in sectioning
lfs/glibc/build.log:./arith.texi:792: warning: node `Absolute Value' is next for `Math Error Reporting' in menu but not in sectioning
lfs/glibc/build.log:./arith.texi:1111: warning: node `Math Error Reporting' is prev for `Absolute Value' in menu but not in sectioning
lfs/glibc/build.log:./signal.texi:145: warning: node `Program Error Signals' is next for `Delivery of Signal' in menu but not in sectioning
lfs/glibc/build.log:./signal.texi:242: warning: node `Delivery of Signal' is prev for `Program Error Signals' in menu but not in sectioning
lfs/udev/build.log:make: *** [build/udevd] Error 1
I have googled the errors and they shouldn't be anything to worry about. Maybe I should just reboot to Slackware and start from scratch building a new toolchain and start over.
I also tried the same command at the host, and got the same result... It seems like something is really wrong also with my lfs-7.2. But I find it strange that I have come this far - I have been running it as my main system for several weeks...
Don't be discouraged and needlessly start all over! Instead just add the -D flag to the nm invocation so it will search for symbols in a dynamic library.
sed -i 's|nm /lib/libc.so.6|nm -D /lib/libc.so.6|' udev-lfs-197-2/Makefile.lfs
to my build script, and then it compiled.
But I find it strange my system is different from other lfs-system. I remember when I build 7.2 first I used '-j5' when building the toolchain, but that caused problems so I started over using only one core. But I think I build big part of chapter 6 with -j5. (Some never learn...) For example my favorite command to get info about my partitions is 'lsblk -f', but it didn't show fs, label or uuid. This time when I've compiled everything with '-j1' I have full output of that command. I think some other features might be missing that I don't know about yet.
Can that spill over to the new system, that I build the toolchain from a system where some features of the core packages might be missing?
Edit: Anyway, I mark this thread as solved, otherwise I will forget it. But if someone can answer my last question, please do. I experiment a lot, and wouldn't feel that I'm dying if I need to start over.
sed -i 's|nm /lib/libc.so.6|nm -D /lib/libc.so.6|' udev-lfs-197-2/Makefile.lfs
to my build script, and then it compiled.
But I find it strange my system is different from other lfs-system. I remember when I build 7.2 first I used '-j5' when building the toolchain, but that caused problems so I started over using only one core. But I think I build big part of chapter 6 with -j5. (Some never learn...) For example my favorite command to get info about my partitions is 'lsblk -f', but it didn't show fs, label or uuid. This time when I've compiled everything with '-j1' I have full output of that command. I think some other features might be missing that I don't know about yet.
Can that spill over to the new system, that I build the toolchain from a system where some features of the core packages might be missing?
The number of concurrent processes during build, specified with the make -j<N> has no bearing on this. I've got 8 CPUs visible, thanks to hyperthreading, and aside from the nss package, everything works just dandy with my use of make -j9 for all builds.
The problem with the nm command not finding symbols all boils down to the stripping process. A shared library that's been fully stripped won't allow nm to detect any symbols unless the -D is provided. I surmise that the creator of Makefile.lfs simply didn't take into account that many LFS builders do follow the stripping operation mentioned in the book.
You can demonstrate this for yourself. Here's what I did on a stock CentOS system as an ordinary user to show what happens when an "as shipped" library from a distrubiton is stripped:
Code:
nm /lib/libc.so.6 | wc -l => 6073 symbols found
cp /lib/libc.so.6 /tmp/
strip -x /tmp/libc.so.6
nm tmp/libc.so.6 | wc -l => now only 2231 symbols found
strip -s /tmp/libc.so.6
nm /tmp/libc.so.6 | wc -l => 0 is now reported along with this error
nm: /tmp/libc.so.6: no symbols
Thanks for explaining this. I have installed my system with Pacman and its tool makepkg, which does the stripping unless it's told not to. So I have stripped my libraries before the lfs-book says one can do it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.