mmakarczyk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All-

I (obviously) am new to the whole 'compiling perl' thing, as I've always been able to use the natively supplied version. However, I am now required to compile a new instance of perl and apparently "have a BIG problem" Can anyone point me in the proper direction? (This occurs during a sh Configure -de on a SUN v10 4800.

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: gcc -o try -O -fno-strict-aliasing -pipe -Wdeclaration-after-s +tatement - I/usr/local/include -L/usr/local/lib try.c -lsocket -lnsl -ldb -ldl -l +m -lc ./try and I got the following output: ld: fatal: library -ldb: not found ld: fatal: File processing errors. No output written to try collect2: ld returned 1 exit status I can't compile the test program. (The supplied flags or libraries might be incorrect.) You have a BIG problem. Shall I abort Configure [y] Ok. Stopping Configure.
*******

adding new information

libdb.so does exist:
SunOS zg4800 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Fire new server # find / -name "libdb.so*" -print /usr/lib/sparcv9/libdb.so.1 /usr/lib/apoc/libdb.so.1 /usr/lib/libdb.so.1

Replies are listed 'Best First'.
Re: Error during compilation of 5.8.8 on solaris 10
by pc88mxer (Vicar) on Apr 09, 2008 at 21:16 UTC
    The problem is that you don't have libdb but it is being specified on the gcc command.

    Can you give us the answers you gave to Configure that preceded the compile test? Specifically, what libraries did it find, and what libraries did you have it use?

    Below is an example of that part of the configuration dialog:

    ... Checking for optional libraries... No -lsfio. No -lsocket. No -linet. Found -lnsl (shared). No -lnm. No -lndbm. No -lgdbm. No -ldbm. No -ldb. No -lmalloc. Found -ldl (shared). No -ldld. No -lld. No -lsun. Found -lm (shared). Found -lcrypt (shared). No -lsec. Found -lutil (shared). Found -lc (shared). No -lcposix. No -lposix. No -lucb. No -lBSD. In order to compile perl5 on your machine, a number of libraries are usually needed. Include any other special libraries here as well. Say "none" for none. The default list is almost always right. What libraries to use? [-lnsl -ldl -lm -lcrypt -lutil -lc]
      Thanks.. here's the entire output:

      new server # sh Configure -de

      Beginning of configuration questions for perl5.

      Checking echo to see how to suppress newlines...
      ...using \c
      The star should be here-->*

      First let's make sure your kit is complete. Checking...
      Looks good...


      Would you like to see the instructions? n

      Locating common programs...
      awk is in /usr/bin/awk.
      cat is in /usr/bin/cat.
      chmod is in /usr/bin/chmod.
      comm is in /usr/bin/comm.
      cp is in /usr/bin/cp.
      echo is in /usr/bin/echo.
      expr is in /usr/bin/expr.
      grep is in /usr/bin/grep.
      ls is in /usr/bin/ls.
      mkdir is in /usr/bin/mkdir.
      rm is in /usr/bin/rm.
      sed is in /usr/bin/sed.
      sort is in /usr/bin/sort.
      touch is in /usr/bin/touch.
      tr is in /usr/bin/tr.
      uniq is in /usr/bin/uniq.

      Don't worry if any of the following aren't found...
      I don't see Mcc out there, offhand.
      ar is in /usr/ccs/bin/ar.
      I don't see bison out there, either.
      I don't see byacc out there, either.
      cpp is in /usr/local/bin/cpp.
      csh is in /usr/bin/csh.
      date is in /usr/bin/date.
      egrep is in /usr/bin/egrep.
      I don't see gmake out there, either.
      gzip is in /usr/bin/gzip.
      less is in /usr/bin/less.
      ln is in /usr/bin/ln.
      make is in /usr/ccs/bin/make.
      more is in /usr/bin/more.
      nm is in /usr/ccs/bin/nm.
      nroff is in /usr/bin/nroff.
      pg is in /usr/bin/pg.
      test is in /usr/bin/test.
      uname is in /usr/bin/uname.
      zip is in /usr/bin/zip.
      Using the test built into your sh.

      Checking compatibility between /usr/bin/echo and builtin echo (if any)...
      They are compatible. In fact, they may be identical.

      Symbolic links are supported.

      Checking how to test for symbolic links...
      You can test for symbolic links with 'test -h'.


      Good, your tr supports :lower: and :upper: to convert case.
      Using :upper: and :lower: to convert case.

      First time through, eh? I have some defaults handy for some systems
      that need some extra help getting the Configure answers right:

      3b1 dos_djgpp irix_6_0 nonstopux sunos_4_0
      aix dynix irix_6_1 openbsd sunos_4_1
      aix_3 dynixptx isc opus super-ux
      aix_4 epix isc_2 os2 svr4
      altos486 esix4 linux os390 svr5
      amigaos fps lynxos os400 ti1500
      apollo freebsd machten posix-bc titanos
      atheos genix machten_2 powerux ultrix_4
      aux_3 gnu mint qnx umips
      beos gnukfreebsd mips rhapsody unicos
      bsdos gnuknetbsd mpc sco unicosmk
      convexos greenhills mpeix sco_2_3_0 unisysdynix
      cxux hpux ncr_tower sco_2_3_1 utekv
      cygwin i386 netbsd sco_2_3_2 uts
      darwin interix newsos4 sco_2_3_3 uwin
      dcosx irix_4 next_3 sco_2_3_4 vmesa
      dec_osf irix_5 next_3_0 solaris_2 vos
      dgux irix_6 next_4 stellar

      You may give one or more space-separated answers, or "none" if appropriate.
      A well-behaved OS will have no hints, so answering "none" or just "Policy"
      is a good thing. DO NOT give a wrong version or a wrong OS.

      Which of these apply, if any? solaris_2

      NOTE: Some people have reported problems with /usr/ucb/cc.
      If you have difficulties, please make sure the directory
      containing your C compiler is before /usr/ucb in your PATH.


      Configure uses the operating system name and version to set some defaults.
      The default value is probably right if the name rings a bell. Otherwise,
      since spelling matters for me, either accept the default or answer "none"
      to leave it blank.

      Operating system name? solaris

      Operating system version? 2.10

      Perl can be built to use the SOCKS proxy protocol library. To do so,
      Configure must be run with -Dusesocks. If you use SOCKS you also need
      to use the PerlIO abstraction layer, this will be implicitly selected.

      If this doesn't make any sense to you, just accept the default 'n'.
      Build Perl for SOCKS? n

      Previous version of perl5 used the standard IO mechanisms as
      defined in <stdio.h>. Versions 5.003_02 and later of perl5 allow
      alternate IO mechanisms via the PerlIO abstraction layer, but the
      stdio mechanism is still available if needed. The abstraction layer
      can use AT&T's sfio (if you already have sfio installed) or regular stdio.
      Using PerlIO with sfio may cause problems with some extension modules.

      If this doesn't make any sense to you, just accept the default 'y'.
      Use the PerlIO abstraction layer? y

      Perl can be built to take advantage of threads on some systems.
      To do so, Configure can be run with -Dusethreads.

      Note that Perl built with threading support runs slightly slower
      and uses more memory than plain Perl. The current implementation
      is believed to be stable, but it is fairly new, and so should be
      treated with caution.

      If this doesn't make any sense to you, just accept the default 'n'.
      Build a threading Perl? n
      Your platform has some specific hints regarding threaded builds, using them...

      Perl can be built so that multiple Perl interpreters can coexist
      within the same Perl executable.

      If this doesn't make any sense to you, just accept the default 'n'.
      Build Perl for multiplicity? n

      Hmm... Looks kind of like a USG system with BSD features, but we'll see...

      Congratulations. You aren't running Eunice.

      It's not Xenix...

      Nor is it Venix...
      Use which C compiler? cc
      /usr/ucb/cc: language optional software package not installed
      Uh-oh, the C compiler 'cc' doesn't seem to be working.

      You seem to have a working gcc, though.
      Would you like to use it? y

      *** However, any setting of the C compiler flags (e.g. for thread support)
      *** has been lost. It may be necessary to pass -Dcc=gcc to Configure
      *** (together with e.g. -Dusethreads).


      Checking for GNU cc in disguise and/or its version number...
      You are using GNU cc 3.4.6.

      Hmm... Doesn't look like a MIPS system.

      Now, how can we feed standard input to your C preprocessor...
      Maybe "gcc -E" will work...
      Nope...maybe "gcc -E -" will work...
      Yup, it does.

      Some systems have incompatible or broken versions of libraries. Among
      the directories listed in the question below, please remove any you
      know not to be holding relevant libraries, and add any that are needed.
      Say "none" for none.

      Directories to use for library searches?
      /usr/local/lib /usr/lib /usr/ccs/lib

      On some systems, shared libraries may be available. Answer 'none' if
      you want to suppress searching of shared libraries for the remainder
      of this configuration.

      What is the file extension used for shared libraries? so

      Perl can be built to take advantage of long doubles which
      (if available) may give more accuracy and range for floating point numbers.

      If this doesn't make any sense to you, just accept the default 'n'.
      Try to use long doubles if available? n
      Your platform has some specific hints regarding long doubles, using them...

      Checking for optional libraries...
      No -lsfio.
      Found -lsocket (shared).
      No -lbind.
      No -linet.
      Found -lnsl (shared).
      No -lnm.
      No -lndbm.
      No -lgdbm.
      No -ldbm.
      Found -ldb (shared).
      Found -ldl (shared).
      No -ldld.
      No -lsun.
      Found -lm (shared).
      No -lutil.
      Found -lc (shared).
      No -lcposix.
      No -lposix.
      No -lbsd.
      No -lBSD.

      In order to compile perl5 on your machine, a number of libraries
      are usually needed. Include any other special libraries here as well.
      Say "none" for none. The default list is almost always right.

      What libraries to use? -lsocket -lnsl -ldb -ldl -lm -lc

      By default, perl5 compiles with the -O flag to use the optimizer.
      Alternately, you might want to use the symbolic debugger, which uses
      the -g flag (on traditional Unix systems). Either flag can be
      specified here. To use neither flag, specify the word "none".

      What optimizer/debugger flag should be used? -O

      Checking if your compiler accepts -fno-strict-aliasing
      Yes, it does.

      Checking if your compiler accepts -pipe
      Yes, it does.
      Checking if your compiler accepts -Wdeclaration-after-statement
      Yes, it does.

      Your C compiler may want other flags. For this question you should include
      -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
      but you should NOT include libraries or ld flags like -lwhatever. If you
      want perl5 to honor its debug switch, you should include -DDEBUGGING here.
      Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.

      To use no flags, specify the word "none".

      Any additional cc flags?
      -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include


      Let me guess what the preprocessor flags are...
      They appear to be: -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/u
      sr/local/include

      Your C linker may need flags. For this question you should
      include -L/whatever and any other flags used by the C linker, but you
      should NOT include libraries like -lwhatever.

      Make sure you include the appropriate -L/path flags if your C linker
      does not normally search all of the directories you specified above,
      namely
      /usr/local/lib /usr/lib /usr/ccs/lib
      To use no flags, specify the word "none".

      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:

      gcc -o try -O -fno-strict-aliasing -pipe -Wdeclaration-after-statement -
      I/usr/local/include -L/usr/local/lib try.c -lsocket -lnsl -ldb -ldl -lm -lc
      ./try

      and I got the following output:

      ld: fatal: library -ldb: not found
      ld: fatal: File processing errors. No output written to try
      collect2: ld returned 1 exit status
      I can't compile the test program.
      (The supplied flags or libraries might be incorrect.)

      You have a BIG problem. Shall I abort Configure y
      Ok. Stopping Configure.
      new server #
Re: Error during compilation of 5.8.8 on solaris 10
by oko1 (Deacon) on Apr 09, 2008 at 22:08 UTC

    'libdb.so.*' isn't going to help you; that's not what the compiler is looking for. From 'man gcc', describing the '-llibrary' option:

    The linker searches a standard list of directories for the library, which is actually a file 
    named 'liblibrary.a'.
    

    Usually, this means that you need the development package for a given lib. Since you're using Solaris, Sunfreeware is your friend.

    
    -- 
    Human history becomes more and more a race between education and catastrophe. -- HG Wells
    
      so, if I am understanding you correctly, there should be a development package for the libdb.a library that I can download from sunfreeware.com? (I'm basing this on the fact that the -1db is the library that is missing (or 'shared' based on the above output)

        Close. It should be a dev package for 'libdb' - which will include 'libdb.a'. If I recall correctly, that should be the Berkeley DB package - e.g., db-4.2.52.NC-sol10-sparc-local.gz for Solaris 10.

        
        -- 
        Human history becomes more and more a race between education and catastrophe. -- HG Wells
        
        This is the closest I see to a package that installs libdb: db-4.2.52.NC-sol10-sparc-local.gz
        db is the Berkeley open source embedded database system - installs in /usr/local/BerkeleyDB.4.2. This packages also requires that you have install either libgcc or gcc.

        note.. I have installed the gcc
        does that sound close to what I need?
        Thanks again for all the help.
        matt
Re: Error during compilation of 5.8.8 on solaris 10
by mr_mischief (Monsignor) on Apr 09, 2008 at 21:17 UTC
    You have a missing library or an incorrect library path there. The 'db' library is being requested by the '-ldb' section of that command, and it's not being found. You might try adding '-L/usr/lib' or some similar library path, or installing a package that provides the library. I'm terribly rusty with the directory structure of Solaris, so I couldn't say for sure.

    That's really more of a C or Solaris question than a Perl question, even though it's perl you're compiling. I'm not complaining, but you might get better advice in a C forum or a Solaris forum. Don't count out a much better and more specific answer here, though, than mine.

    Update: pc88mxer's, for example, might give you a better start.

Re: Error during compilation of 5.8.8 on solaris 10
by mmakarczyk (Initiate) on Apr 10, 2008 at 17:17 UTC
    OK.. it's fixed. the 4.2.52.NC-sol10-sparc-local patch was needed, but the pathing was wrong. I needed to update the path to include the library.

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<location_of_ldb_l ibrary>

    thanks again everyone.
    all of you were a huge help.
      Hi,

      I encountered the same problem. A simple link did the job:

      ln -s /usr/lib/libdb.so.1 /usr/lib/libdb.so

      after doing so, I could compile perl5.8.8
      (whithout installing the "patch" mentioned above) ;-)

      Bye,
      PiT
Re: Error during compilation of 5.8.8 on solaris 10
by mmakarczyk (Initiate) on Apr 10, 2008 at 15:14 UTC
    well.. I installed the package db-4.2.52.NC-sol10-sparc-local and I am still getting that same error. I'm thinking i might have a pathing issue. is that possible?

    /usr/sbin:/usr/bin:/usr/ccs/bin:/usr/local/bin:/usr/ucb:/usr/openwin/bin:/usr/dt /bin:/usr/platform/SUNW,Sun-Fire/sbin:/opt/sun/bin:/opt/SUNWexplo/bin:/opt/SUNWs neep/bin:/opt/CTEact/bin

      Not so much a 'pathing' problem as a problem of the compiler not knowing where to look. Your best bet - assuming that you don't want to hack the Makefile - is to look at the paths specified by the '-L' option (which reads '-L/usr/local/lib') and to create a symlink in that directory to wherever 'libdb.a' lives. E.g., if 'libdb.a' is in '/usr/lib/', then you should do "ln -s /usr/lib/libdb.a /usr/local/lib'.

      
      -- 
      Human history becomes more and more a race between education and catastrophe. -- HG Wells