LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   glibc make error: undefined reference to `__sync_fetch_and_add_4' (https://www.linuxquestions.org/questions/linux-software-2/glibc-make-error-undefined-reference-to-%60__sync_fetch_and_add_4-a-571961/)

rendezvous123 07-24-2007 02:40 PM

glibc make error: undefined reference to `__sync_fetch_and_add_4'
 
I am currently trying to compile glibc 2.6 from source, but during make, i get the following errors:
Code:

/media/sda4/sources/glibc-build/elf/librtld.os: In function `add_dependency':
/media/sda4/sources/glibc-2.6/elf/dl-lookup.c:106: undefined reference to `__sync_fetch_and_add_4'
/media/sda4/sources/glibc-2.6/elf/dl-lookup.c:110: undefined reference to `__sync_val_compare_and_swap_4'
/media/sda4/sources/glibc-build/elf/librtld.os: In function `_dl_profile_fixup':
/media/sda4/sources/glibc-2.6/elf/dl-runtime.c:196: undefined reference to `__sync_val_compare_and_swap_4'
/media/sda4/sources/glibc-2.6/elf/dl-runtime.c:205: undefined reference to `__sync_fetch_and_add_4'
/media/sda4/sources/glibc-build/elf/librtld.os: In function `_dl_fixup':
/media/sda4/sources/glibc-2.6/elf/dl-runtime.c:102: undefined reference to `__sync_val_compare_and_swap_4'
/media/sda4/sources/glibc-2.6/elf/dl-runtime.c:110: undefined reference to `__sync_fetch_and_add_4'
/media/sda4/sources/glibc-build/elf/librtld.os: In function `dl_open_worker':
/media/sda4/sources/glibc-2.6/elf/dl-open.c:425: undefined reference to `__sync_val_compare_and_swap_4'
/media/sda4/sources/glibc-2.6/elf/dl-open.c:427: undefined reference to `__sync_fetch_and_add_4'
/media/sda4/sources/glibc-build/elf/librtld.os: In function `_dl_close_worker':
/media/sda4/sources/glibc-2.6/elf/dl-close.c:407: undefined reference to `__sync_val_compare_and_swap_4'
/media/sda4/sources/glibc-2.6/elf/dl-close.c:409: undefined reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status
make[2]: *** [/media/sda4/sources/glibc-build/elf/ld.so] Error 1
make[2]: Leaving directory `/media/sda4/sources/glibc-2.6/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/media/sda4/sources/glibc-2.6'
make: *** [all] Error 2

The only "solution" i've found for it is passing "-march=i486", but that fails for me--no such option. I have no idea how to fix this error. Any help is appreciated.

studioj 07-24-2007 06:39 PM

-march=i486 is a gcc flag
try
Code:


export CFLAGS="${CFLAGS} -march=i486"

i hope i wrote that right.

then in that same shell do your configure make

rendezvous123 07-25-2007 01:48 AM

After doing that, i received the following:
Quote:

/media/sda4/sources/glibc-build/config.h:3:3: error: #error "glibc cannot be compiled without optimization"
I'm stuck again...

rendezvous123 08-08-2007 03:11 AM

Okay, i managed to get by that error by checking out the default CFLAGS that gets generated in config.make without setting CFLAGS myself and adding -march=i486 to it on the next configure:
Code:

CFLAGS="-g -02 -march=i486"
But then i ran into this error:
Code:

/media/sda4/sources/glibc-build/libc_pic.os: In function `sync_file_range':
(.text+0x9e963): undefined reference to `.Lpseudo_end'
collect2: ld returned 1 exit status

Now i'm stuck again. Any one know how to get by this error? (Took a while just to get passed the previous error.)

sesquiannual 11-09-2008 07:18 PM

I've been working through similar problems myself. I appear to have gotten further than you by leaving out the '-g'. It isn't really a optimization flag and is more for giving extra data to a debugger.


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