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.