Skip Menu |

This queue is for tickets about the Math-Float128 CPAN distribution.

Report information
The Basics
Id: 116520
Status: open
Priority: 0/
Queue: Math-Float128

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: undefined symbol: log2q

I'm having a hard time nailing down a build error, there's no CPAN reports reflecting it, so it could be GCC version related.

 

 

========
 perl Makefile.PL
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lquadmath
Generating a Unix-style Makefile
Writing Makefile for Math::Float128
Writing MYMETA.yml and MYMETA.json
========
make
cp Float128.pm blib/lib/Math/Float128.pm
Running Mkbootstrap for Float128 ()
chmod 644 "Float128.bs"
"/home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Float128.bs blib/arch/auto/Math/Float128/Float128.bs 644
"/home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/bin/perl" "/home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/lib/site_perl/5.22.1/ExtUtils/xsubpp"  -typemap '/home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/lib/5.22.1/ExtUtils/typemap' -typemap '/home/kent/.cpanm/work/1469609808.3063/Math-Float128-0.10/typemap'  Float128.xs > Float128.xsc
mv Float128.xsc Float128.c
cc -c   -fno-stack-protector -DPERL_HASH_FUNC_SDBM -DPERL_DISABLE_PMC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-stack-protector -O3 -march=native -mtune=native   -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" -fPIC "-I/home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/lib/5.22.1/x86_64-linux/CORE"  -DNEWPERL -DWE_HAVE_LENDIAN -DLONGLONG2IV_IS_OK -DLONG2IV_IS_OK Float128.c
rm -f blib/arch/auto/Math/Float128/Float128.so
cc  -shared  -fno-stack-protector -O3 -march=native -mtune=native -L/usr/local/lib -fstack-protector-strong -o blib/arch/auto/Math/Float128/Float128.so  Float128.o  \
   -lm   \
 
chmod 755 blib/arch/auto/Math/Float128/Float128.so
========

 make test
"/home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Float128.bs blib/arch/auto/Math/Float128/Float128.bs 644
PERL_DL_NONLAZY=1 "/home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01load.t ................... $@: Can't load '/home/kent/.cpanm/work/1469609808.3063/Math-Float128-0.10/blib/arch/auto/Math/Float128/Float128.so' for module Math::Float128: /home/kent/.cpanm/work/1469609808.3063/Math-Float128-0.10/blib/arch/auto/Math/Float128/Float128.so: undefined symbol: log2q at /home/kent/perl5/perlbrew/perls/5.22.1-nossp-sdbm-nopmc/lib/5.22.1/x86_64-linux/DynaLoader.pm line 193.
 at /home/kent/.cpanm/work/1469609808.3063/Math-Float128-0.10/blib/lib/Math/Float128.pm line 51.
Compilation failed in require at t/01load.t line 6.
 

... etc

========

 

The "quad.in" test however works fine.

 

cc -x c quad.in -o quad.a

But modified to read as follows, fails compile:

=====
#include <stdio.h>
#include <quadmath.h>

int main(void) {
  __float128 foo;
  if ( log2q(foo) ) {
    printf("Log2Q Called OK\n");
  }
  printf("No problems\n");
  return 0;
}
=====

Adding an explicit '-lquadmath' then makes this work again, demonstrating at least my compiler can get quadmath working, so it must be something in the configure chain going wrong.

=====

cc -x c quad.in -lquadmath -o quad.a
./quad.a
Log2Q Called OK
No problems

ltrace  ./quad.a >/dev/null
__libc_start_main(0x400626, 1, 0x7fffb1ee10d8, 0x400850 <unfinished ...>
log2q(1, 0x7fffb1ee10d8, 0x7fffb1ee10e8, 0)                                                                                                                                 = 0
puts("Log2Q Called OK")                                                                                                                                                     = 16
puts("No problems")                                                                                                                                                         = 12
+++ exited (status 0) +++
=====

 

Manually reading the generated Makefile shows no indication of `-lquadmath` anywhere within the code:

 

====
# --- MakeMaker const_loadlibs section:

# Math::Float128 might depend on some other libraries:
# See ExtUtils::Liblist for details
#
EXTRALIBS =
LDLOADLIBS = -lm
BSLOADLIBS =
 

====

 

gcc --version
gcc (Gentoo 5.4.0 p1.0, pie-0.6.5) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

 

CC: <KENTNL [...] cpan.org>
Subject: Re: [rt.cpan.org #116520] undefined symbol: log2q
Date: Wed, 27 Jul 2016 22:16:56 +1000
To: <bug-Math-Float128 [...] rt.cpan.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Kent Fredric via RT Sent: Wednesday, July 27, 2016 7:31 PM To: undisclosed-recipients: Subject: [rt.cpan.org #116520] undefined symbol: log2q Note that quad.in (in its original form) tests only for the availability of quadmath.h. That it compiles ok tells us nothing more than that quadmath.h was found.
> Adding an explicit '-lquadmath' then makes this work again, demonstrating > at least my compiler can get quadmath working, so it must be something in > the configure chain going wrong.
Looks to me that it must be a bug in EU::MM. Obviously the linker is capable of resolving '-lquadmath', but EU::MM has decided (at the 'perl Makefile.PL step) that the linker will *not* be able to resolve that link .... and therefore EU::MM has removed that '-lquadmath' link. I think EU::MM is in error when it comes to the decision that the '-lquadmath' link cannot be resolved. (And that's the bug.)
> Manually reading the generated Makefile shows no indication of > `-lquadmath` anywhere within the code:
Given that EU::MM has removed the '-lquadmath', this is as expected. I suspect that Math::Float128 will build successfully if you build manually with: perl Makefile.PL LIBS="-L/path/to/libquadmath -lquadmath" That should force EU::MM to check the directory that contains libquadmath, to determine that the linker *will* be able to resolve that link, and to therefore refrain from removing that link. Cheers, Rob

On 2016-07-28 00:17:39, sisyphus1@optusnet.com.au wrote:

> Looks to me that it must be a bug in EU::MM.

Agreed :)

https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/issues/277


> perl Makefile.PL LIBS="-L/path/to/libquadmath -lquadmath"

 

It does =).

 

Unfortunately, I'm trying to vendorize it, and hard-coding the path
like that might not even be a thing I can get away with doing.

 

Will have to see what EUMM says about the fix.

 

CC: <KENTNL [...] cpan.org>
Subject: Re: [rt.cpan.org #116520] undefined symbol: log2q
Date: Wed, 27 Jul 2016 23:27:09 +1000
To: <bug-Math-Float128 [...] rt.cpan.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Kent Fredric via RT Sent: Wednesday, July 27, 2016 10:23 PM To: undisclosed-recipients: Subject: [rt.cpan.org #116520] undefined symbol: log2q Hopefully, EU::MM developers will agree that if the linker can find a library by default, then EU::MM should do the same. (I think they will.) In any case, please let me know if there's something the Math::Float128 source can do to alleviate your problem. (An articulation of what that "something" is would also be appreciated - off the top of my head, I can't think of anything that's not extremely messy ;-) Cheers, Rob