perl compile error in chapter 5 of lfs 5.1-pre2

Ken Moffat ken at
Sat May 15 03:36:11 PDT 2004

On Fri, 14 May 2004, JP wrote:

> When I try to compile perl in chapter 5 of lfs 5.1-pre2 i get the
> following error:
> /mnt/lfs/tools/bin/../lib/gcc-lib/i586-pc-linux-gnu/3.3.3/../../../../i586-pc-linux-gnu/bin/ld:
> cannot find -lgdbm
> collect2: ld returned 1 exit status

- that part seems normal, my build script is duff and drops the errors
out on the console, I've been seeing that collect2 message for the last
two or three releases of perl.

> I can't compile the test program.
> You have a BIG problem.  Shall I abort Configure [y]
> Ok.  Stopping Configure.
> It seems perl is trying to link against the, which is on the
> host system, but not the lfs system.  I have tried to compile it several
> times, unpacking and patching the source fresh each time.

 Based on what I've seen, I think the problem is something different.

> What's going on? Is this some mess up with the toolchain, or something
> freaky with perl?  Oh, yeah, I am running the uname hack on a vmware
> redhat 9 install so this will run on an old pentium classic as a router.

 Does that mean RH is running as a "guest" under "another" OS ?  That is
a decidedly uncommon way to build, you might have to look at what
alternatives are available for configuring perl.

> the entire output of configure.gnu is below:
> lfs:/mnt/lfs/src/perl-5.8.4$ patch -Np1 -i ../perl-5.8.4-libc-1.patch
> patching file hints/
> Hunk #1 succeeded at 51 with fuzz 1.
> Hunk #2 succeeded at 314 (offset 32 lines).
> lfs:/mnt/lfs/src/perl-5.8.4$ arch
> i586
> lfs:/mnt/lfs/src/perl-5.8.4$ ./configure.gnu --prefix=/tools
> -Dstatic_ext='IO Fcntl POSIX'
> sh Configure -ds -e -Dprefix=/tools -Dstatic_ext=IO Fcntl POSIX
> First let's make sure your kit is complete.  Checking...
> Locating common programs...
> Checking compatibility between /tools/bin/echo and builtin echo (if any)...
> Symbolic links are supported.
> Checking how to test for symbolic links...
> Your builtin 'test -h' may be broken.
> Trying external '/tools/bin/test -h'.
> You can test for symbolic links with '/tools/bin/test -h'.
> Good, your tr supports [:lower:] and [:upper:] to convert case.
> Using [:upper:] and [:lower:] to convert case.
> 3b1          dos_djgpp      isc_2         os2           svr4
> aix          dynix          linux         os390         svr5
> aix_3        dynixptx       lynxos        os400         ti1500
> aix_4        epix           machten       posix-bc      titanos
> altos486     esix4          machten_2     powerux       ultrix_4
> amigaos      fps            mint          qnx           umips
> apollo       freebsd        mips          rhapsody      unicos
> atheos       genix          mpc           sco           unicosmk
> aux_3        gnu            mpeix         sco_2_3_0     unisysdynix
> beos         greenhills     ncr_tower     sco_2_3_1     utekv
> bsdos        hpux           netbsd        sco_2_3_2     uts
> convexos     i386           newsos4       sco_2_3_3     uwin
> cxux         irix_4         next_3        sco_2_3_4     vmesa
> cygwin       irix_5         next_3_0      solaris_2     vos
> darwin       irix_6         next_4        stellar
> dcosx        irix_6_0       nonstopux     sunos_4_0
> dec_osf      irix_6_1       openbsd       sunos_4_1
> dgux         isc            opus          super-ux

OK so far, but then

> Which of these apply, if any? [redhat9-virtual]
> hint to use instead? [redhat9-virtual]
> Operating system name? [redhat9-virtual]
> Operating system version? [none]

Quite different, mine shows (copied by hand)

Which of these apply, if any? [linux]

You appear to have ELF support.  I'll try to use it for dynamic loading.
If dynamic loading doesn't work, read hints/ for further
Operating system name? [linux]
Operating system version? [2.4.20]
Build Perl for SOCKS? [n]

 You'll see it found my (old) kernel version.  The redhat9-virtual is a
new one to me, and a quick google didn't help.

> Build Perl for SOCKS? [n]
> Use the PerlIO abstraction layer? [y]
> Build a threading Perl? [n]
> Build Perl for multiplicity? [n]
> Use which C compiler? [cc]
> Checking for GNU cc in disguise and/or its version number...
> Now, how can we feed standard input to your C preprocessor...
> Directories to use for library searches? [/usr/local/lib /lib /usr/lib]

the directories should only be [/tools/lib]
I think after that it just goes downhill, e.g. -lbsd and
-I/usr/local/include below.

> What is the file extension used for shared libraries? [so]
> Try to use long doubles if available? [n]
> Checking for optional libraries...
> What libraries to use? [-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lbsd]
> What optimizer/debugger flag should be used? [-O]
> Any additional cc flags? [-fno-strict-aliasing -I/usr/local/include]
> Let me guess what the preprocessor flags are...
> Any additional ld flags (NOT including libraries)? [ -L/usr/local/lib]
> 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 -O -fno-strict-aliasing -I/usr/local/include
> -L/usr/local/lib
> try.c -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lbsd
>           ./try
> and I got the following output:
> /mnt/lfs/tools/bin/../lib/gcc-lib/i586-pc-linux-gnu/3.3.3/../../../../i586-pc-linux-gnu/bin/ld:
> cannot find -lgdbm
> collect2: 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.

 das eine Mal als Tragödie, das andere Mal als Farce

More information about the lfs-support mailing list