[SOLVED] LFS 7.8-systemd 5.7 glibc error: Need linker with .init_array/.fini_array support
Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
LFS 7.8-systemd 5.7 glibc error: Need linker with .init_array/.fini_array support
I have received this error on several occasions, having retracked and recompiled from scratch and have been as meticulous as can be. Little hair is now left on my head. I have scripted each section of the build process and can supply the scripts if useful, though I have checked consistency with the manual several times.
Two suspicious things have happened in compiling gcc, though this appeared to complete satisfactorily:
a) libtool: install: warning: remember to run `libtool --finish /tools/libexec/gcc/x86_64-lfs-linux-gnu/5.2.0'
As this location seems to be linked to tools/lib it seemed unlikely to me that it could be my problem.
b) cc1: error: no include path in which to search for stdc-predef.h
This looks more frightening to me
Internet discussions of this problem are few and do not seem to be relevant to my situation.
I have confirmed $PATH $LFS and $LFS_TGT to be as expected and symbolic links are in place. The host requirements script ran as expected.
My host system is Fedora 22 workstation, to which I had to add gcc.
Any ideas? Is there some library or whatever that might not be being found or might be in the wrong place?
I can supply other logs etc but didn't want to prematurely post too much.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
There seems to be a number of weird and wonderful errors when using fedora, you may be better off, if you have the spare disk space, temporarily installing slackware, build your LFS then delete the slackware install, just a thought.
There seems to be a number of weird and wonderful errors when using fedora, you may be better off, if you have the spare disk space, temporarily installing slackware, build your LFS then delete the slackware install, just a thought.
Seems too late for this particular thread, but Salix is a Slackware derivative that offers Live CD. I've been using it as a host to build LFS and it works quite well. This way one doesn't have to install the host OS only to remove it once LFS is built.
Well, the good news is that my new distro is installed, grubbed up and working and has been used to repeat from scratch the toolchain.
The bad news is that exactly the same error is still appearing - so it looks as if I'm making a mistake somewhere. Back to the drawing board!
Can anyone perhaps help by making a bit clearer what the error message means? Or what the linker might be requiring that it can't find?
[In response to a comment above I did actually select the Salix live CD as suggested (having read about this in another thread - you see I do do a bit of independent work on it all). As it happened it booted up wanting me to install to hard disk, and as I had a bit of unpartitioned space (I always keep a bit for a rainy day) I let it do it - it seemed as simple. Anyway, I really like the new environment so am pleased to have that to work with - something good achieved by this thread].
You can start by pasting your "env", "history" and "hostreqs.sh" output here. Use code tags.
PEBKAC someone?
..but I assume I don't need to know that (and perhaps would prefer not to )
Internet searches for the problem produced a variety of possible fixes not of which looked relevant to my situation. The feature in common is that they are all 64 bit builds
The following from the glibc log might be useful, suggesting to me that the binutils didn't go quite right:
Code:
configure:5878: checking for .preinit_array/.init_array/.fini_array support
configure:5894: x86_64-lfs-linux-gnu-gcc -g -O2 -o conftest
conftest.c -static -nostartfiles -nostdlib
1>&5
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/5.2.0/../../../../x86_64-lfs-linux-gnu/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
configure:5897: $? = 1
configure:5910: result: no
configure:5913: error: Need linker with .init_array/.fini_array support.
Host requirement output:
Code:
bash, version 4.2.45(2)-release
/bin/sh -> /bin/bash
Binutils: (Linux/GNU Binutils) 2.23.52.0.1.20130226
bison (GNU Bison) 2.7
yacc is bison (GNU Bison) 2.7
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: 8.21
diff (GNU diffutils) 3.3
find (GNU findutils) 4.4.2
GNU Awk 4.1.0, API: 1.0 (GNU MPFR 3.1.2, GNU MP 5.1.3)
/usr/bin/awk -> /bin/gawk-4.1.0
gcc (GCC) 4.8.2
g++ (GCC) 4.8.2
(GNU libc) 2.17
grep (GNU grep) 2.14
gzip 1.6
Linux version 3.10.17 (root@hive64) (gcc version 4.8.2 (GCC) ) #2 SMP Fri Feb 14 16:45:28 CST 2014
m4 (GNU M4) 1.4.17
GNU Make 3.82
GNU patch 2.7
Perl version='5.18.1';
sed (GNU sed) 4.2.2
tar (GNU tar) 1.26
makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.0.5
g++ compilation OK
History (of shell: some actions - such as removing build directories for a retry - happened outside a shell, as also inspection of logs etc)
Note also that each package installation has been scripted: scripts follow later.
u:/mnt/lfs/Logs$ history
Code:
1 cat > ~/.bash_profile << "EOF"
2 exec env -i HOME=$HOME TERM=$TERM PS1='u:\w\$ ' /bin/bash
3 EOF
4 cat > ~/.bashrc << "EOF"
5 set +h
6 umask 022
7 LFS=/mnt/lfs
8 LC_ALL=POSIX
9 LFS_TGT=$(uname -m)-lfs-linux-gnu
10 PATH=/tools/bin:/bin:/usr/bin
11 export LFS LC_ALL LFS_TGT PATH
12 EOF
13 source ~/.bash_profile
14 exit
15 dir
16 echo $LFS
17 echo $LFS_TGT
18 cd $LFS
19 cd Logs
20 dir
21 host-requirement_script >hostrequirements
22 cd $LFS/tools
23 ./binutils1 >binutils1.log
24 dir
25 cd ../Logs
26 ./binutils1 >binutils1.log
27 cd $LFS/Logs
28 ./binutils1 >binutils1.log
29 ../gcc1 >gcc1.log
30 ./gcc1 >gcc1.log
31 dir
32 ./apihead >apihead.log
33 ./glibc >glibc.log
34 cd �$LFS/Logs
35 cd $LFS
36 dir
37 cd Logs
38 echo $PATH
39 echo $LFS_TGT
40 ./glibc >glibc.log
41 echo $CFLAGS
42 env
43 history
Scripts
Scripts are called from $LFS/Logs and change directory internally
Binutils-2.25.1 (binutils1)
Code:
#!/bin/bash
export SrceDir=binutils-2.25.1
export SrceFlags=-xf
export SrceSuf=tar.bz2
export ConfigOptions="--prefix=/tools --with-sysroots=$LFS --with-lib-path=/tools/lib --target=$LFS_TGT --disable-nls --disable-werror"
times
echo '{' $0 'prepare'
cd $LFS/sources
tar $SrceFlags $SrceDir.$SrceSuf
mkdir -v $0-build
cd $0-build
echo '} ' $0 'configure {'
echo ../$SrceDir/configure $ConfigOptions
../$SrceDir/configure $ConfigOptions
echo '}' $0 'make {'
make
echo '}' $0 'make install {'
#Custom
mkdir -v /tools/lib && ln -sv lib /tools/lib64
#Custom ends
make install
echo '}'
times
gcc-5.2.0 (gcc1)
Code:
#!/bin/bash
export SrceDir=gcc-5.2.0
export SrceFlags=-jxf
export SrceSuf=tar.bz2
export ConfigOptions="--target=$LFS_TGT --prefix=/tools --with-glibc-version=2.11 --with-sysroot=$LFS --with-newlib --without-headers \
--with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls \
--disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic \
--disable-libgomp --disable-libquadmath --disable-libssp \
--disable-libvtv --disable-libstdcxx --enable-languages=c,c++"
times
echo '{' $0 'prepare'
cd $LFS/sources
tar $SrceFlags $SrceDir.$SrceSuf
#Custom work
cd $SrceDir
tar -xf ../mpfr-3.1.3.tar.xz
mv -v mpfr-3.1.3 mpfr
tar -xf ../gmp-6.0.0a.tar.xz
mv -v gmp-6.0.0 gmp
tar -xf ../mpc-1.0.3.tar.gz
mv -v mpc-1.0.3 mpc
for file in \
$(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-e 's@/usr@/tools@g' $file.orig > $file
echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
done
cd $LFS/sources
#Custom work ends
mkdir -v $0-build
cd $0-build
echo '} ' $0 'configure {'
echo ../$SrceDir/configure $ConfigOptions
../$SrceDir/configure $ConfigOptions
echo '}' $0 'make {'
make
echo '}' $0 'make install {'
make install
echo '}'
times
Linux-4.2 API Headers (apihead)
Code:
#!/bin/bash
#This is simple and atypical but still coded in case of repetition
export SrceDir=linux-4.2
export SrceFlags=-xf
export SrceSuf=tar.xz
#export ConfigOptions="--prefix=/tools --with-sysroots=$LFS --with-lib-path=/tools/lib --target=$LFS_TGT --disable-nls --disable-werror"
times
echo '{' $0 'prepare'
cd $LFS/sources
tar $SrceFlags $SrceDir.$SrceSuf
#Custom
cd $SrceDir
make mrproper
make INSTALL_HDR_PATH=dest headers_install
cp -rv dest/include/* /tools/include
#Custom ends
#Rest of standard procedure unneeded
times
glibc-2.22 (glibc) I ran this first with the 386 patch and tried again without in case it had interfered in any way with a 64 build - hence the current commenting out. Obviously I deleted both the source and build directories between attempts
Code:
#!/bin/bash
export SrceDir=glibc-2.22
export SrceFlags=-xf
export SrceSuf=tar.xz
#export ConfigOptions must be done later as the setting depends on the results of tarball extraction
times
echo '{'
echo $0 'prepare'
cd $LFS/sources
tar $SrceFlags $SrceDir.$SrceSuf
#Custom fix
#cd $LFS/sources/$SrceDir
#patch -Np1 -i ../glibc-2.22-upstream_i386_fix-1.patch
#cd $LFS/sources
#End custom
mkdir $0-build
cd $0-build
echo '} ' $0 'configure {'
export ConfigOptions="--prefix=/tools --host=$LFS_TGT --build=$(../glibc-2.22/scripts/config.guess) \
--disable-profile --enable-kernel=2.6.32 --enable-obsolete-rpc --with-headers=/tools/include \
libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes"
echo ../$SrceDir/configure $ConfigOptions
../$SrceDir/configure $ConfigOptions
echo '}' $0 'make' {
make
echo '} make install {'
make install
echo '}'
times
I have the standard output saved from the scripts as well as other logs but I assume posting the lot at this stage would not be appreciated.
Hope this all helps. Thanks for all your continued patience.
PEBKAC someone?
..but I assume I don't need to know that (and perhaps would prefer not to )
Problem Exists Between Keyboard and Chair (take a guess where).
You failed to mention you were using scripts. I shouldn't be wrong to assume it's a problem in them somewhere.
Try without using them. Adding configure options in an env var produces some ... strange results.
You failed to mention you were using scripts. I shouldn't be wrong to assume it's a problem in them somewhere.
Try without using them. Adding configure options in an env var produces some ... strange results.
I second this. Especially for the first time you're building LFS, I would not use any scripts and follow the book line by line. If you insist on using scripts, then it's useful to do a "dry-run" by echoing the commands instead of executing them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.