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

Configure fails to find four ld functions on Cygwin because it doesn't want libm or libcygwin #15449

Open
p5pRT opened this issue Jul 16, 2016 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Jul 16, 2016

Migrated from rt.perl.org#128637 (status was 'new')

Searchable as RT128637$

@p5pRT
Copy link
Author

p5pRT commented Jul 16, 2016

From @dcollinsn

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​: f6203e9
  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
  .

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

3 participants