Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

Problem on SOlaris with dynamic and static libaries #1678

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#2923 (status was 'resolved')

Searchable as RT2923$

p5pRT commented 24 years ago

From barnett@birch.crd.ge.com

Here is a minor problem with compiling perl 5.6.0 on Solaris 2.6.

I built a fairly standard perl\, wity the following variations

  Sun Pro CC   Threads   Dynamic libraries   shared libperl.so   prefix of /local

  I added the flag -L/local where it said so\, and asked it to search /local/lib.

Now - I had /local/lib/libdb.a - not a .so file. The software I build must have used static loading. I did NOT have libdb.so there.

Perl auto-determines the libraries to use on the build line. However\, it added -ldb to the list. It got to the point where it tested the linking and failed. See below. I had to remove the -ldb from the link line. It seems to me that if you are building perl with a shared libperl.so file\, then it should know it can't use static libraries.

--- exact error below -----

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   /local/lib /lib /usr/lib /usr/ccs/lib To use no flags\, specify the word "none".

Any additional ld flags (NOT including libraries)? [none] -L/local

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"); exit(0); }

I used the command​:

  cc -O -D_REENTRANT -o try -L/local try.c -lsocket -lnsl -ldb -ldl -lm -lposix4 -lpthread -lc -lcrypt -lsec   ./try

and I got the following output​:

ld​: fatal​: library -ldb​: not found ld​: fatal​: File processing errors. No output written to try 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. script done on Fri Mar 31 11​:22​:19 2000

p5pRT commented 24 years ago

From @doughera88

On Fri\, 31 Mar 2000\, Bruce Barnett wrote​:

Here is a minor problem with compiling perl 5.6.0 on Solaris 2.6.

I built a fairly standard perl\, wity the following variations

    shared libperl\.so
    prefix of /local

    I added the flag \-L/local where it said so\, and asked it to

search /local/lib.

This is the problem. Adding -L/local doesn't cause the compiler to search /local/lib. It causes the compiler to search /local. If your library is in /local/lib/libdb.a\, then you need to specify -L/local/lib.

It seems to me that if you are building perl with a shared libperl.so file\, then it should know it can't use static libraries.

I don't think this is the problem. I'm pretty sure perl ought to be able to use static libraries just fine. You need to specify the correct -L flag. Perhaps the Configure prompt for specifying that flag was confusing.
If so\, could you suggest an alternative wording?

Hope this helps\,

  Andy Dougherty doughera@​lafayette.edu   Dept. of Physics   Lafayette College\, Easton PA 18042

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

This is the problem. Adding -L/local doesn't cause the compiler to search /local/lib. It causes the compiler to search /local. If your library is in /local/lib/libdb.a\, then you need to specify -L/local/lib.

Ah. Thanks. That was it.