develooper Front page | perl.perl5.porters | Postings from July 2016

[perl #128637] Configure fails to find four ld functions on Cygwinbecause it doesn't want libm or libcygwin

From:
Dan Collins
Date:
July 16, 2016 21:19
Subject:
[perl #128637] Configure fails to find four ld functions on Cygwinbecause it doesn't want libm or libcygwin
Message ID:
rt-4.0.18-18915-1468703929-117.128637-75-0@perl.org
# New Ticket Created by  Dan Collins 
# Please include the string:  [perl #128637]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128637 >


Greetings,

On Cygwin 2.5:

$ uname -a
CYGWIN_NT-10.0 DESKTOP-DUOI7F4 2.5.2(0.297/5/3) 2016-06-23 14:29 x86_64 Cygwin

Configure with:

$ ./Configure -Dusedevel -Duselongdouble -des

Complains that:

*** You requested the use of long doubles but you do not seem to have
*** the following mathematical functions needed for long double support:
***     sqrtl modfl frexpl ldexpl
*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
*** Cannot continue, aborting.

At least two libraries on my system provide sqrtl: libm and libcygwin.

And in fact, configure has even already used this function. This test appears at Configure line 10345:

: Before committing on uselongdouble, see whether that looks sane.
if $test "$uselongdouble" = "$define"; then
    message=""
    echo " "
    echo "Checking if your long double math functions work right..." >&4
    $cat > try.c <<EOF
#include <math.h>
#include <stdio.h>
int main() {
  printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
}
EOF
    case "$osname:$gccversion" in
    aix:)       saveccflags="$ccflags"
                ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
    esac
    set try
    if eval $compile_ok; then
      yyy=`$run ./try`
    fi
    case "$yyy" in
    3) echo "Your long double math functions are working correctly." >&4 ;;
    *) echo "Your long double math functions are broken, not using long doubles." >&4
       uselongdouble=$undef
       ;;
    esac
    $rm_try
    case "$osname:$gccversion" in
    aix:)       ccflags="$saveccflags" ;; # restore
    esac
fi

And that test passed:

Checking if your long double math functions work right...
Your long double math functions are working correctly.

Quite some time before Configure line 16436:

sqrtl() NOT found.

In fact, the problem seems to be that libm is not included here:

Extracting names from the following files for later perusal:
	/usr/lib/libc.a
	/usr/lib/libdl.a
	/usr/lib/libpthread.a

Because hints/cygwin removed it from libswanted on account of it being a symlink to libcygwin.a. It's not, but even if it was, that isn't helpful because libcygwin.a /also/ isn't in libswanted. I added it, and Configure now is happy.

I suspect that isn't the /right/ fix, though. After all, a previous test in Configure has successfully linked against some library that provides sqrtl - how did that test work, if configure isn't aware of any lib that provides sqrtl?

-- 
Respectfully,
Dan Collins

%% perl -V when forced to use -lcygwin

$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 25 subversion 3) configuration:
  Derived from: f6203e997f3012b8aab4cd35fe49f58e4d71fb8c
  Platform:
    osname=cygwin
    osvers=2.5.2(0.29753)
    archname=cygwin-thread-multi
    uname='cygwin_nt-10.0 desktop-duoi7f4 2.5.2(0.29753) 2016-06-23 14:29 x86_64 cygwin '
    config_args='-Dusedevel -Duselongdoubles -des -Alibswanted=cygwin'
    hint=previous
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    bincompat5005=undef
  Compiler:
    cc='gcc'
    ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2'
    optimize='-O3'
    cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong'
    ccversion=''
    gccversion='5.4.0'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='g++'
    ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/lib /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/../include/w32api /usr/local/lib /lib /usr/lib /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/../include/w32api
    libs=-lpthread -ldl -lcygwin
    perllibs=-lpthread -ldl -lcygwin
    libc=/usr/lib/libc.a
    so=dll
    useshrplib=true
    libperl=cygperl5_25_3.dll
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags=' --shared  -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl):
  Compile-time options:
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
    PERL_IMPLICIT_CONTEXT
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_DEVEL
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
  Locally applied patches:
    uncommitted-changes
  Built under cygwin
  Compiled at Jul 16 2016 17:06:23
  @INC:
    lib
    /usr/local/lib/perl5/site_perl/5.25.3/cygwin-thread-multi
    /usr/local/lib/perl5/site_perl/5.25.3
    /usr/local/lib/perl5/5.25.3/cygwin-thread-multi
    /usr/local/lib/perl5/5.25.3
    .




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About