Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: -lm necessary in LIBS of Makefile.PL #435

Closed
p5pRT opened this issue Aug 25, 1999 · 2 comments
Closed

Re: -lm necessary in LIBS of Makefile.PL #435

p5pRT opened this issue Aug 25, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 25, 1999

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

Searchable as RT1276$

@p5pRT
Copy link
Author

p5pRT commented Aug 25, 1999

From ilya@math.ohio-state.edu

I did

  pfind -alllines .cpan/build /Makefile\.PL/ '=~ /LIBS[^#]*-lm\b/'

and found that at least OpenGL and Term​::Gnuplot modules (out of those
I installed/tested) have -lm on the LIBS line. Frankly speaking,
Term​::Gnuplot is mine, and I'm afraid that I needed to add -lm to
OpenGL myself. ;-)

Educate the guy​: tell him that on Solaris it is not enough to have the
main program linked against -lm. My guess would be that until the
main program calls sin() or somesuch, -lm is not actually activated
(lazy loading). Thus when the library calls sin(), ld.so does not
know from which library this request should be satisfied.

Additional venue to explore is to report this as a bug in Perl​: one
can argue that ExtUtils​::LibList should have taken care of this. I Cc
this to perbug address.

Ilya

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=solaris, osvers=2.7, archname=sun4-solaris
  uname='sunos mathserv 5.7 generic sun4u sparc sunw,ultra-5_10 '
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='cc', optimize='-O', gccversion=
  cppflags='-I/usr/local/include -I/opt/local/include -I/opt/gnu/include'
  ccflags ='-I/usr/local/include -I/opt/local/include -I/opt/gnu/include'
  stdchar='char', d_stdstdio=define, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define,
  longdblsize=16
  alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -L/opt/local/lib -L/opt/gnu/lib'
  libpth=/opt/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib
  libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
  libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-KPIC', lddlflags='-G -L/opt/local/lib -L/opt/gnu/lib'

Characteristics of this binary (from libperl)​:
  Built under solaris
  Compiled at May 12 1999 16​:44​:00
  %ENV​:
  PERLLIB="/home/ilya/perl​:/home/ilya/perl/lib/perl5​:/home/ilya/perl/lib/perl5
/site_perl​:/home/ilya/perl/lib/perl5/site_perl/sun4-solaris​:/home/ilya/perl/lib/
perl5/site_perl/5.005/sun4-solaris​:/home/ilya/perl/lib/perl5/5.00503/"
  @​INC​:
  /home/ilya/perl
  /home/ilya/perl/lib/perl5
  /home/ilya/perl/lib/perl5/site_perl
  /home/ilya/perl/lib/perl5/site_perl/sun4-solaris
  /home/ilya/perl/lib/perl5/site_perl/5.005/sun4-solaris
  /home/ilya/perl/lib/perl5/5.00503/
  /opt/local/lib/perl5/5.00503/sun4-solaris
  /opt/local/lib/perl5/5.00503
  /opt/local/lib/perl5/site_perl/5.005/sun4-solaris
  /opt/local/lib/perl5/site_perl/5.005
  .

@p5pRT
Copy link
Author

p5pRT commented Aug 25, 1999

From @doughera88

On Wed, 25 Aug 1999, Ilya Zakharevich wrote​:

On Wed, Aug 25, 1999 at 07​:42​:37AM -0400, Dave Alden wrote​:

Hi,
I'm working with a package called rrdtool.

[ package needs -lm added to the LIBS list in Makefile.PL, but author of
package isn't so sure. ]

Educate the guy​: tell him that on Solaris it is not enough to have the
main program linked against -lm. My guess would be that until the
main program calls sin() or somesuch, -lm is not actually activated
(lazy loading). Thus when the library calls sin(), ld.so does not
know from which library this request should be satisfied.

You can also tell him that the standard ext/POSIX/Makefile.PL extension
has to do exactly this -- it includes -lm in LIBS. And you can also point
out to him that test 17 in t/lib/posix.t is designed to test for just such
a circumstance.

Hence it is quite reasonable to include -lm in LIBS.

Additional venue to explore is to report this as a bug in Perl​: one
can argue that ExtUtils​::LibList should have taken care of this. I Cc
this to perbug address.

I agree that it would be nice if ExtUtils​::LibList took care of details
like this, but I know I won't have a chance to do anything about it for a
long, long time. Perhaps someone else will :-).

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant