LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Glibc 1st pass wont compile (possibly i486 related) (https://www.linuxquestions.org/questions/linux-from-scratch-13/glibc-1st-pass-wont-compile-possibly-i486-related-704580/)

gsmedia 02-14-2009 03:27 AM

Glibc 1st pass wont compile (possibly i486 related)
 
Hi everyone,
I'm trying to compile Glibc-2.8-20080929 on Fedora10, as part of LFS6.4 chapter 5.7.

when i make glibc i get the following error message at the end of the compile:

Code:

/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__libc_fork':
/mnt/lfs/sources/glibc-2.8-20080929/posix/../nptl/sysdeps/unix/sysv/linux/i386/../fork.c:76: undefined reference to `__sync_bool_compare_and_swap_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `nscd_getpw_r':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_getpw_r.c:232: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `nscd_getgr_r':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_getgr_r.c:321: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `nscd_gethst_r':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_gethst_r.c:400: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os:/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd-client.h:320: more undefined references to `__sync_fetch_and_add_4' follow
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__nscd_get_map_ref':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_helper.c:406: undefined reference to `__sync_val_compare_and_swap_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `*__GI___libc_freeres':
/mnt/lfs/sources/glibc-2.8-20080929/malloc/set-freeres.c:39: undefined reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status
make[1]: *** [/mnt/lfs/sources/glibc-build/libc.so] Error 1
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.8-20080929'
make: *** [all] Error 2

Googling undefined reference to `__sync_val_compare_and_swap_4' reveals that this error generally occurs when -march=i486 isn't passed to the compiler. I've checked and triple checked that ive followed the instruction:
Code:

echo "CFLAGS += -march=i486 -mtune=native" > configparms
The above command is meant to be run in the glibc-build directory isn't it?

I've tried replacing CFLAGS += -march=i486 -mtune=native with CFLAGS += -march=i686 -mtune=native. After lookin at this thread, I tried both:
Code:

CFLAGS="-g -02 -march=i486"
and
Code:

CFLAGS=" -02 -march=i486"
All of the above combinations give the same error message during compilation. Does anyone know what I should try next to solve this problem?

Thanks

Also, every time I try a different configuration combination, should I start with a fresh build directory, or can I just run configure again?

aahiqmir 03-28-2009 08:39 AM

Quote:

Originally Posted by gsmedia (Post 3443087)
Hi everyone,
I'm trying to compile Glibc-2.8-20080929 on Fedora10, as part of LFS6.4 chapter 5.7.

when i make glibc i get the following error message at the end of the compile:

Code:

/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__libc_fork':
/mnt/lfs/sources/glibc-2.8-20080929/posix/../nptl/sysdeps/unix/sysv/linux/i386/../fork.c:76: undefined reference to `__sync_bool_compare_and_swap_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `nscd_getpw_r':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_getpw_r.c:232: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `nscd_getgr_r':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_getgr_r.c:321: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__nscd_drop_map_ref':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd-client.h:320: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `nscd_gethst_r':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_gethst_r.c:400: undefined reference to `__sync_fetch_and_add_4'
/mnt/lfs/sources/glibc-build/libc_pic.os:/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd-client.h:320: more undefined references to `__sync_fetch_and_add_4' follow
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `__nscd_get_map_ref':
/mnt/lfs/sources/glibc-2.8-20080929/nscd/nscd_helper.c:406: undefined reference to `__sync_val_compare_and_swap_4'
/mnt/lfs/sources/glibc-build/libc_pic.os: In function `*__GI___libc_freeres':
/mnt/lfs/sources/glibc-2.8-20080929/malloc/set-freeres.c:39: undefined reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status
make[1]: *** [/mnt/lfs/sources/glibc-build/libc.so] Error 1
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.8-20080929'
make: *** [all] Error 2

Googling undefined reference to `__sync_val_compare_and_swap_4' reveals that this error generally occurs when -march=i486 isn't passed to the compiler. I've checked and triple checked that ive followed the instruction:
Code:

echo "CFLAGS += -march=i486 -mtune=native" > configparms
The above command is meant to be run in the glibc-build directory isn't it?

I've tried replacing CFLAGS += -march=i486 -mtune=native with CFLAGS += -march=i686 -mtune=native. After lookin at this thread, I tried both:
Code:

CFLAGS="-g -02 -march=i486"
and
Code:

CFLAGS=" -02 -march=i486"
All of the above combinations give the same error message during compilation. Does anyone know what I should try next to solve this problem?

Thanks

Also, every time I try a different configuration combination, should I start with a fresh build directory, or can I just run configure again?




try reinstalling your host OS.select all packages from package installation screen.then start lfs6.4 from begining.
i had similar problem.and i run

Code:

echo "CFLAGS += -march=i486 -mtune=native" > configparms
without it i ran into the error.

gsmedia 06-20-2009 06:32 AM

I know that bringing old posts back from the dead is looked down upon, but after months (on and off) of trying to fix this problem, I found a solution. Maybe if someone else finds this It'll save them some time and pain.

For some reason the CFLAGS weren't being passed from the configparams file to the compiler. All I had to do was export it as an environment variable:
Code:

export CFLAGS="-march=i486 -mtune=native -O2 -pipe"
Now I can (hopefully) move on without any further problems.


All times are GMT -5. The time now is 01:54 PM.