Problem compiling glibc

robert baker robertmbaker at gmail.com
Mon Oct 3 14:56:51 PDT 2011


For grins I just walked through the build process, and successfully
installed binutils, gcc, the linux headers, and glibc. (It had been a
while) I only have a 64bit machine in front of me at the moment though
so I will have to recheck things on a 32 bit machine.

But for what it is worth the build completed successfully on Debian
Squeeze 64bit.

You may be running into issues that you Host distro is causing.

On Mon, Oct 3, 2011 at 4:03 PM, Smlacc1 <smlacc1 at gmail.com> wrote:
> Hi,
>
> Yes - the configparms are set exactly as per the hlfs book. It is failing on the second pass - the binary stage.  Im am away from my work pc now, so i will post the exact contents of the configparms in the morning.  But i did a copy and paste of this part of the book (i will paste this into a text file and diff it with configparms tomorrow to make sure it is the same).
>
> cat > configparms << "EOF"
> CC += -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2
> CXX += -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2
> CFLAGS-sln.c += -fno-PIC -fno-PIE
> +link = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
>    $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
>    $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
>    -Wl,-z,now -Wl,--warn-shared-textrel,--fatal-warnings \
>    $(addprefix $(csu-objpfx),S$(start-installed-name)) \
>    $(+preinit) $(+prectorS) \
>    $(filter-out $(addprefix $(csu-objpfx),start.o \
>    S$(start-installed-name))\
>    $(+preinit) $(link-extra-libs) \
>    $(common-objpfx)libc% $(+postinit),$^) \
>    $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
> EOF
> case `uname -m` in
>  i?86) echo "CFLAGS += -march=i486 -mtune=native" >> configparms ;;
> esac
>
> Smlacc
>
> Sent from my iPad
>
> On 2011-10-03, at 4:50 PM, robert baker <robertmbaker at gmail.com> wrote:
>
>> As per the docs these flags should be set in configparms where needed.
>>
>> The build of glibc is done in two passes.  We use settings in
>> configparms to build the libraries first, and then we change
>> configparms to build the binaries. Is this occurring on the first make
>> pass (libs) or the second (binaries)?
>>
>> Share what you have in your configparms file with the list if you have a chance.
>>
>>
>> On Mon, Oct 3, 2011 at 2:23 PM, Smlacc1 <smlacc1 at gmail.com> wrote:
>>> Hi,
>>> Im having issues compiling glibc stage one on a rhel6 box.  Here is the
>>> output of the part of the compile just before it dies:
>>>
>>>
>>>
>>> x86_64-lfs-linux-gnu-gcc -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2
>>> iconvconfig.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline
>>> -Wwrite-strings -fmerge-all-constants -g -Wstrict-prototypes
>>> -DGCONV_PATH='"/tools/lib/gconv"' -DGCONV_DIR='"/tools/lib/gconv"'
>>> -I../include -I/opt/makelinux/buildroot/glibc-build/iconv
>>> -I/opt/makelinux/buildroot/glibc-build -I../sysdeps/x86_64/elf
>>> -I../nptl/sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/x86_64
>>> -I../sysdeps/unix/sysv/linux/wordsize-64 -I../nptl/sysdeps/unix/sysv/linux
>>> -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux
>>> -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman
>>> -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv
>>> -I../sysdeps/unix/x86_64 -I../nptl/sysdeps/unix -I../sysdeps/unix
>>> -I../sysdeps/posix -I../sysdeps/x86_64/fpu -I../sysdeps/x86_64/multiarch
>>> -I../nptl/sysdeps/x86_64 -I../sysdeps/x86_64 -I../sysdeps/wordsize-64
>>> -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64
>>> -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754
>>> -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I.
>>> -nostdinc -isystem /tools/lib/gcc/x86_64-lfs-linux-gnu/4.6.1/include
>>> -isystem /tools/lib/gcc/x86_64-lfs-linux-gnu/4.6.1/include-fixed -isystem
>>> /tools/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h
>>> -DNOT_IN_libc=1   -DNOT_IN_libc -o
>>> /opt/makelinux/buildroot/glibc-build/iconv/iconvconfig.o -MD -MP -MF
>>> /opt/makelinux/buildroot/glibc-build/iconv/iconvconfig.o.dt -MT
>>> /opt/makelinux/buildroot/glibc-build/iconv/iconvconfig.o
>>>
>>> rm -f /opt/makelinux/buildroot/glibc-build/libc.so.6.new
>>>
>>> /bin/sh ../scripts/rellns-sh /opt/makelinux/buildroot/glibc-build/libc.so
>>> /opt/makelinux/buildroot/glibc-build/libc.so.6.new
>>>
>>> mv -f /opt/makelinux/buildroot/glibc-build/libc.so.6.new
>>> /opt/makelinux/buildroot/glibc-build/libc.so.6
>>>
>>> x86_64-lfs-linux-gnu-gcc -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2
>>> -pie -Wl,-O1 -nostdlib -nostartfiles -o
>>> /opt/makelinux/buildroot/glibc-build/iconv/iconvconfig
>>> -Wl,-dynamic-linker=/tools/lib/ld-linux-x86-64.so.2   -Wl,-z,combreloc
>>> -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,now
>>> -Wl,--warn-shared-textrel,--fatal-warnings
>>> /opt/makelinux/buildroot/glibc-build/csu/Scrt1.o
>>> /opt/makelinux/buildroot/glibc-build/csu/crti.o `x86_64-lfs-linux-gnu-gcc
>>> -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2
>>> --print-file-name=crtbeginS.o`
>>> /opt/makelinux/buildroot/glibc-build/iconv/iconvconfig.o
>>> /opt/makelinux/buildroot/glibc-build/iconv/strtab.o
>>> /opt/makelinux/buildroot/glibc-build/iconv/xmalloc.o
>>> /opt/makelinux/buildroot/glibc-build/iconv/hash-string.o
>>> -Wl,-rpath-link=/opt/makelinux/buildroot/glibc-build:/opt/makelinux/buildroot/glibc-build/math:/opt/makelinux/buildroot/glibc-build/elf:/opt/makelinux/buildroot/glibc-build/dlfcn:/opt/makelinux/buildroot/glibc-build/nss:/opt/makelinux/buildroot/glibc-build/nis:/opt/makelinux/buildroot/glibc-build/rt:/opt/makelinux/buildroot/glibc-build/resolv:/opt/makelinux/buildroot/glibc-build/crypt:/opt/makelinux/buildroot/glibc-build/nptl
>>> /opt/makelinux/buildroot/glibc-build/libc.so.6
>>> /opt/makelinux/buildroot/glibc-build/libc_nonshared.a
>>> /opt/makelinux/buildroot/glibc-build/elf/ld.so  -lgcc -lgcc_eh
>>> `x86_64-lfs-linux-gnu-gcc -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2
>>> --print-file-name=crtendS.o` /opt/makelinux/buildroot/glibc-build/csu/crtn.o
>>>
>>> /tools/lib/gcc/x86_64-lfs-linux-gnu/4.6.1/../../../../x86_64-lfs-linux-gnu/bin/ld:
>>> /opt/makelinux/buildroot/glibc-build/iconv/strtab.o: relocation R_X86_64_32
>>> against `.rodata.str1.1' can not be used when making a shared object;
>>> recompile with -fPIC
>>>
>>> /opt/makelinux/buildroot/glibc-build/iconv/strtab.o: could not read symbols:
>>> Bad value
>>>
>>> collect2: ld returned 1 exit status
>>>
>>> make[2]: *** [/opt/makelinux/buildroot/glibc-build/iconv/iconvconfig] Error
>>> 1
>>>
>>> make[2]: Leaving directory `/opt/makelinux/buildroot/glibc-2.12.2/iconv'
>>>
>>> make[1]: *** [iconv/others] Error 2
>>>
>>> make[1]: Leaving directory `/opt/makelinux/buildroot/glibc-2.12.2'
>>>
>>> make: *** [all] Error 2
>>>
>>> I looked online, and it may be related to this issue:
>>>
>>> http://jaytaylor.com/blog/2010/10/06/howto-fix-fpic-errors/
>>> Im about to go home now, so wont be able to test this fix until tomorrow.
>>>  But it seems to me if that flag was needed, i wouldent be the only one
>>> experiencing this problem.  Im wondering if anyone else has had this issue,
>>> and how they fixed it?
>>> Thans,
>>> Smlacc
>>> --
>>> http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
>>> FAQ: http://www.linuxfromscratch.org/faq/
>>> Unsubscribe: See the above information page
>>>
>>>
>> --
>> http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
>> FAQ: http://www.linuxfromscratch.org/faq/
>> Unsubscribe: See the above information page
> --
> http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
> FAQ: http://www.linuxfromscratch.org/faq/
> Unsubscribe: See the above information page
>



More information about the hlfs-dev mailing list