LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-03-2010, 01:17 AM   #1
nescalona
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Rep: Reputation: 0
6.9 compiling glibc, fails on make due to undefined references in functions


I'm using the latest LFS book, compiling glibc-2.11.1 for my system (http://www.linuxfromscratch.org/lfs/...r06/glibc.html). I'm also using Matthias Benkmann's package user setup for package management. (http://www.linuxfromscratch.org/hint...nd_pkg_man.txt) That means that I am not compiling glibc as root.

This is the end of the output from make, the things it was doing when it failed. As you can see: a lot of undefined references to things with names beginning with "__sync" in functions in libc_pic.os.

Thanks!

Code:
gcc   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/lib/ld-linux.so.2  -B/sources/glibc-build/csu/  -Wl,--version-script=/sources/glibc-build/libc.map -Wl,-soname=libc.so.6 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -nostdlib -nostartfiles -e __libc_main -L/sources/glibc-build -L/sources/glibc-build/math -L/sources/glibc-build/elf -L/sources/glibc-build/dlfcn -L/sources/glibc-build/nss -L/sources/glibc-build/nis -L/sources/glibc-build/rt -L/sources/glibc-build/resolv -L/sources/glibc-build/crypt -L/sources/glibc-build/nptl -Wl,-rpath-link=/sources/glibc-build:/sources/glibc-build/math:/sources/glibc-build/elf:/sources/glibc-build/dlfcn:/sources/glibc-build/nss:/sources/glibc-build/nis:/sources/glibc-build/rt:/sources/glibc-build/resolv:/sources/glibc-build/crypt:/sources/glibc-build/nptl -o /sources/glibc-build/libc.so -T /sources/glibc-build/shlib.lds /sources/glibc-build/csu/abi-note.o /sources/glibc-build/elf/soinit.os /sources/glibc-build/libc_pic.os /sources/glibc-build/elf/sofini.os /sources/glibc-build/elf/interp.os /sources/glibc-build/elf/ld.so -lgcc
/sources/glibc-build/libc_pic.os: In function `__libc_fork':
/sources/glibc-2.11.1/posix/../nptl/sysdeps/unix/sysv/linux/i386/../fork.c:79: undefined reference to `__sync_bool_compare_and_swap_4'
/sources/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/sources/glibc-2.11.1/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/sources/glibc-build/libc_pic.os: In function `nscd_getpw_r':
/sources/glibc-2.11.1/nscd/nscd_getpw_r.c:233: undefined reference to `__sync_fetch_and_add_4'
/sources/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/sources/glibc-2.11.1/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/sources/glibc-build/libc_pic.os: In function `nscd_getgr_r':
/sources/glibc-2.11.1/nscd/nscd_getgr_r.c:322: undefined reference to `__sync_fetch_and_add_4'
/sources/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/sources/glibc-2.11.1/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/sources/glibc-build/libc_pic.os:/sources/glibc-2.11.1/nscd/nscd_gethst_r.c:415: more undefined references to `__sync_fetch_and_add_4' follow
/sources/glibc-build/libc_pic.os: In function `__nscd_get_map_ref':
/sources/glibc-2.11.1/nscd/nscd_helper.c:433: undefined reference to `__sync_val_compare_and_swap_4'
/sources/glibc-build/libc_pic.os: In function `*__GI___libc_freeres':
/sources/glibc-2.11.1/malloc/set-freeres.c:39: undefined reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status
make[1]: *** [/sources/glibc-build/libc.so] Error 1
make[1]: Leaving directory `/sources/glibc-2.11.1'
make: *** [all] Error 2
Note: unlike the guy here (http://www.linuxquestions.org/questi...11-1-a-798342/), I didn't have any trouble with this when I was building the toolchain in chapter 5.

Last edited by nescalona; 04-03-2010 at 01:40 AM.
 
Old 04-03-2010, 01:26 AM   #2
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Rep: Reputation: 51
Maybe this will help:
http://sources.redhat.com/ml/libc-al.../msg00009.html
 
Old 04-03-2010, 01:42 AM   #3
nescalona
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Original Poster
Rep: Reputation: 0
I did pass -march=i486 to the compiler. I appended it to CFLAGS using configparms, as detailed in the link to the LFS book page in my first post.

Code:
$ case `uname -m` in
> i?86) echo "CFLAGS += -march=i486 -mtune=native -O3 -pipe" > configparms ;;
> esac
EDIT: strange. the problem disappeared, not when i recompiled the second time, but when i recompiled the third time.

maybe it was a typo? sorry to waste y'all's time.

Last edited by nescalona; 04-03-2010 at 02:10 AM.
 
Old 04-03-2010, 01:58 AM   #4
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Rep: Reputation: 51
OK. Test gcc with this:
Code:
cd /tmp
cat > test.c << EOF
int main()
{
int a;
return __sync_bool_compare_and_swap(&a,0,1);
}
EOF
gcc test.c -o test -march=i486
If this gives an error, then you have compiled gcc without "--with-arch=486 or higher" as said here:
http://old.nabble.com/Re:--ct-ng--build-error:-undefined-reference-to---`__sync_bool_compare_and_swap_4'-p17875951.html
 
  


Reply



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
undefined references when compiling PLIB program Alkibiades Programming 3 03-13-2010 02:18 PM
undefined gfortran references when compiling with g77 StudMuffin Linux - Software 4 02-17-2007 06:06 AM
Compiling garnome 2.14.1 fails in libgnome(undefined references to popt...) Spooled Linux - Software 2 05-10-2006 07:14 PM
Compiling glibc-2.3.5 or glibc 2.3.5-r1 on Gentoo fails ghrellin Linux - Software 2 07-19-2005 01:01 AM
texinfo - undefined references during make fitret Linux - Software 1 06-18-2005 02:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration