Opened 12 years ago

Closed 12 years ago

#3104 closed task (fixed)

no perl-5.16.0-libc-1.patch and perl-5.16.0 can't be built in toolchain

Reported by: xinglp Owned by: bdubbs@…
Priority: normal Milestone: 7.2
Component: Book Version: SVN
Severity: normal Keywords:
Cc:

Description

I've tried to use perl-5.14.2-libc-1.patch and the log below:

Checking your choice of C compiler and flags for coherency...
I've tried to compile and run the following simple program:

#include <stdio.h>
int main() { printf("Ok\n"); return(0); }

I used the command:

        cc -o try -O2 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -fstack-protector -L/usr/local/lib try.c -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
         ./try

and I got the following output:

/xxxxxx/xxxxxxx/xxxxxxx/tools/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lgdbm
collect2: error: ld returned 1 exit status
I can't compile the test program.
You have a BIG problem.  Shall I abort Configure [y]
Ok.  Stopping Configure.

Change History (15)

comment:1 by Matthew Burgess, 12 years ago

I've committed the libc patch now. Alas, I can't reproduce your problem. Both chapter 5 and chapter 6 builds completed fine. I get

Let me guess what the preprocessor flags are...
Any additional ld flags (NOT including libraries)? [ -fstack-protector]  
Checking your choice of C compiler and flags for coherency...
Computing filename position in cpp output for #include directives...
<stdlib.h> found.

in reply to:  1 comment:2 by xinglp, 12 years ago

Replying to matthew@…:

I've committed the libc patch now. Alas, I can't reproduce your problem. Both chapter 5 and chapter 6 builds completed fine. I get

Let me guess what the preprocessor flags are...
Any additional ld flags (NOT including libraries)? [ -fstack-protector]  
Checking your choice of C compiler and flags for coherency...
Computing filename position in cpp output for #include directives...
<stdlib.h> found.

I have tried to do it start over again, same error. But I can build it without use jhalfs, I think some environment affect this.

comment:3 by xinglp, 12 years ago

Finally, I install gdbm before perl to make it work.

in reply to:  3 ; comment:4 by Matthew Burgess, 12 years ago

Replying to xinglp:

Finally, I install gdbm before perl to make it work.

Well, that's obviously not the right thing to do (I appreciate it got it to work for you, but it shouldn't be necessary). It looks like your Perl build is picking up GDBM headers/libs from your host but then when it tries to compile/link against them in the configure stage, it can't find them again (presumably because the perl libc patch changes have come into effect at that point).

in reply to:  4 comment:5 by xinglp, 12 years ago

Replying to matthew@…:

Replying to xinglp:

Finally, I install gdbm before perl to make it work.

Well, that's obviously not the right thing to do (I appreciate it got it to work for you, but it shouldn't be necessary). It looks like your Perl build is picking up GDBM headers/libs from your host but then when it tries to compile/link against them in the configure stage, it can't find them again (presumably because the perl libc patch changes have come into effect at that point).

My host is lfs SVN-20120524 with 3.4 kernel

comment:6 by Sorina82, 12 years ago

After applying the libc patch im occuring exact the same error while compiling perl for the toolchain.

what libraries to use? [-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat]

I used the command:

cc -o try -O2 -fno-strict-aliasing -pipe -fstack-protector -fstack-protector try.c -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat

./try

then it fails

It fails on -lgdbm -ldb -ldbm_compact( debian library ? )

So there is still a hardwired link in either hints/linux.sh or any other place.

in reply to:  6 comment:7 by Sorina82, 12 years ago

After running Configure -Dprefix=/tools, you get the next option

Directories to use for library searches? /usr/lib/../lib /lib /usr/lib /tools/lib

type /tools/lib

then it builds ;)

comment:8 by bdubbs@…, 12 years ago

It builds with:

patch ...
chmod 0744 Configure
sed -i -e '/Restore computed paths/i libswanted=""' Configure 
sh Configure -des -Dprefix=/tools
make CLDFLAGS='-lm' 
...

comment:9 by Matthew Burgess, 12 years ago

Owner: changed from lfs-book@… to Matthew Burgess
Status: newassigned

comment:10 by bdubbs@…, 12 years ago

I think I found an easier fix:

sh Configure -des -Dprefix=/tools -Dlibpath=/tools/lib

Adapted from the post above by Sorina82.

comment:11 by Matthew Burgess, 12 years ago

Owner: changed from Matthew Burgess to lfs-book@…
Status: assignednew

Bruce, feel free to take this. I can't reproduce the failure, and therefore can't test whether whatever fix I put in will work or not.

in reply to:  11 comment:12 by Sorina82, 12 years ago

Replying to matthew@…:

Bruce, feel free to take this. I can't reproduce the failure, and therefore can't test whether whatever fix I put in will work or not.

My host is archlinux maybe that works :)?

the fix bdubbs does work to. The fix to install gdbm first, i do not recommend.

Ffter running : sh Configure -des -Dprefix=/tools i saw Perl was looking also in the library paths of my hostmachine. Thats what we dont want;).

So my work around worked till bdubss gave me the correct -Des option. Cheers :)

The sed option above I did not try yet. But looking at the Configure file, thats probably the problem that's occuring while running configure.

so 2 solutions. Pick a King ;)

comment:13 by Sorina82, 12 years ago

My mistake i didn't delete the sources first.

The option :

sh Configure -des -Dprefix=/tools -Dlibpath=/tools/lib

Doesn't work.

sed -i -e '/Restore computed paths/i libswanted=""' Configure 
sh Configure -des -Dprefix=/tools
make CLDFLAGS='-lm' 

Works. dont forget the CLDFLAGS else the linker will error.

comment:14 by bdubbs@…, 12 years ago

Owner: changed from lfs-book@… to bdubbs@…
Status: newassigned

comment:15 by bdubbs@…, 12 years ago

Resolution: fixed
Status: assignedclosed

Confirmed that -Dlibpath=/tools/lib did not work properly, so added sed to fix Configure.

Fixed in revision 9871.

Note: See TracTickets for help on using tickets.