LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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

Reply
 
Search this Thread
Old 03-25-2013, 03:18 AM   #1
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 301

Rep: Reputation: 60
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?
 
Old 03-25-2013, 06:21 AM   #2
Keith Hedger
Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 833

Rep: Reputation: 167Reputation: 167
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.
 
1 members found this post helpful.
Old 03-25-2013, 11:13 AM   #3
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 301

Original Poster
Rep: Reputation: 60
Thanks for finding that link for me. At the bottom of that page was a link to the ticket about this. Someone suggested to run
Code:
nm /lib/libc.so.6 | grep " secure_getenv"
The output should be something like '0000000000037d70 W secure_getenv'.

I got instead
Code:
(chroot) root:/# nm /lib/libc.so.6 | grep " secure_getenv"
nm: /lib/libc.so.6: no symbols
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.
 
Old 03-25-2013, 11:54 AM   #4
re_nelson
Member
 
Registered: Oct 2011
Location: Texas, USA
Distribution: LFS-SVN, Gentoo-2.2 ~amd64, CentOS-6.5, Slackware64-current, FreeBSD-9.2-STABLE
Posts: 176

Rep: Reputation: Disabled
Quote:
Originally Posted by Lennie View Post
Thanks for finding that link for me. At the bottom of that page was a link to the ticket about this. Someone suggested to run
Code:
nm /lib/libc.so.6 | grep " secure_getenv"
The output should be something like '0000000000037d70 W secure_getenv'.

I got instead
Code:
(chroot) root:/# nm /lib/libc.so.6 | grep " secure_getenv"
nm: /lib/libc.so.6: no symbols
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.

Quote:
nm -D /lib/libc.so.6 | grep " secure_getenv"
 
1 members found this post helpful.
Old 03-25-2013, 12:22 PM   #5
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 301

Original Poster
Rep: Reputation: 60
Yes, it works if I run 'nm -D'
Code:
(chroot) root:/sources/lfs# nm -D /lib/libc.so.6 | grep " secure_getenv" 
0000000000037d70 W secure_getenv
I added:
Code:
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.

Last edited by Lennie; 03-25-2013 at 12:38 PM.
 
Old 03-25-2013, 12:57 PM   #6
re_nelson
Member
 
Registered: Oct 2011
Location: Texas, USA
Distribution: LFS-SVN, Gentoo-2.2 ~amd64, CentOS-6.5, Slackware64-current, FreeBSD-9.2-STABLE
Posts: 176

Rep: Reputation: Disabled
Quote:
Originally Posted by Lennie View Post
Yes, it works if I run 'nm -D'
Code:
(chroot) root:/sources/lfs# nm -D /lib/libc.so.6 | grep " secure_getenv" 
0000000000037d70 W secure_getenv
I added:
Code:
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
 
1 members found this post helpful.
Old 03-25-2013, 01:45 PM   #7
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 301

Original Poster
Rep: Reputation: 60
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
qt 3.3.8 fails to compile returning undefined reference to `_dl_hwcap' dingodog Linux - Software 0 10-13-2012 03:44 PM
gtkboard compile error: undefined reference to `FT_GlyphSlot_Embolden' rextor Linux - Games 2 11-18-2011 05:24 PM
compile error: undefined reference to std::basic_ostream ron7000 Programming 5 09-17-2008 09:13 AM
undefined reference to `g_assertion_message_expr when trying to compile jpilot nowshining Linux - Software 1 04-28-2008 11:37 PM
Compile QT get Undefined reference jordban Linux - General 14 01-15-2005 06:58 PM


All times are GMT -5. The time now is 08:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration