Perl / Perl/perl5

Solaris and "implicit declaration of function ‘isinf’"

Open
#17,544 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build-time-warnings distro-Solaris Stalled wontfix
Dominant language
Perl
Stars
2.3k
Forks
646
Avg merge
2d 22h
Merged PRs (30d)
49

Description

Description
I'm building Perl 5.30.1 from the release tarball on Solaris 11.3 i86pc.

The build is producing several warnings like:

gcc -c -DPERL_CORE -g2 -O2 -m64 -march=native -fPIC -pthread -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include -m64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -DPERL_USE_SAFE_PUTENV -O -Wall -Werror=declaration-after-statement -Werror=pointer-arith -Wextra -Wc++-compat -Wwrite-strings -fPIC numeric.c
numeric.c: In function ‘S_my_atof_infnan’:
numeric.c:1461:21: warning: implicit declaration of function ‘isinf’ [-Wimplicit-function-declaration]
                     if (Perl_isinf(nv))
                     ^

According to the Sun man pages:

$ man isinf
...

NAME
       isinf - test for infinity

SYNOPSIS
       c99 [ flag... ] file... -lm [ library... ]
       #include <math.h>

       int isinf(real-floating x);

DESCRIPTION
       The  isinf() macro determines whether its argument value is an infinity
       (positive or negative). First, an  argument  represented  in  a  format
       wider  than  its  semantic type is converted to its semantic type. Then
       determination is based on the type of the argument.

Steps to Reproduce
Build on Solaris 11.3.

I perform 64-bit builds on Solaris according to 64-bit Computing | When to Use 64-bit in the Developers Guide. For Autotools projects I use amd64-sun-solaris. I also add -m64 to CFLAGS, CXXFLAGS and LDFLAGS.

Be careful of the "converted to its semantic type..." in the man page. I think the three choices for real-floating are long int, float and double. I've seen missing math prototypes on Solaris because the compiler did not promote as expected and a simple cast was missing.

Expected behavior
A clean compile

Perl configuration

$ PERL5LIB=./lib ./perl -V
Summary of my perl5 (revision 5 version 30 subversion 1) configuration:
   
  Platform:
    osname=solaris
    osvers=2.11
    archname=i86pc-solaris-64
    uname='sunos solaris 5.11 11.3 i86pc i386 i86pc solaris '
    config_args='-des -Dprefix=/usr/local -Dlibdir=/usr/local/lib -Dpkgconfig=/usr/local/lib/pkgconfig -Dcc=gcc -Dcxx=g++ -Acppflags=-I/usr/local/include -DNDEBUG -Accflags=-g2 -O2 -m64 -march=native -fPIC -pthread -Acxxflags=-g2 -O2 -m64 -march=native -fPIC -pthread -Aldflags=-L/usr/local/lib -m64 -Wl,-R,'XXORIGIN/../lib' -Wl,-R,/usr/local/lib -Dextras=Text::Template Test::More'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='gcc'
    ccflags ='-g2 -O2 -m64 -march=native -fPIC -pthread -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include -m64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -DPERL_USE_SAFE_PUTENV'
    optimize='-O'
    cppflags='-I/usr/local/include -DNDEBUG -g2 -O2 -m64 -march=native -fPIC -pthread -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include'
    ccversion=''
    gccversion='4.8.2'
    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='gcc'
    ldflags =' -L/usr/local/lib -m64 -Wl,-R,XXORIGIN/../lib -Wl,-R,/usr/local/lib -fstack-protector -L/usr/gnu/lib -m64 '
    libpth=/usr/local/lib /usr/gcc/4.8/lib /usr/gcc/4.8/lib/gcc/i386-pc-solaris2.11/4.8.2/include-fixed /usr/lib /usr/gnu/lib /usr/ccs/lib
    libs=-lpthread -lsocket -lnsl -lgdbm -ldb -ldl -lm -lc
    perllibs=-lpthread -lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so
    so=so
    useshrplib=true
    libperl=libperl.so
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='  -R /usr/local/lib/perl5/5.30.1/i86pc-solaris-64/CORE'
    cccdlflags='-fPIC'
    lddlflags=' -shared -m64 -L/usr/local/lib -Wl,-R,XXORIGIN/../lib -Wl,-R,/usr/local/lib -L/usr/gnu/lib -fstack-protector'

Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under solaris
  Compiled at Feb  6 2020 15:14:41
  %ENV:
    PERL5LIB="./lib"
  @INC:
    ./lib
    /usr/local/lib/perl5/site_perl/5.30.1/i86pc-solaris-64
    /usr/local/lib/perl5/site_perl/5.30.1
    /usr/local/lib/perl5/5.30.1/i86pc-solaris-64
    /usr/local/lib/perl5/5.30.1

@jkeenan - I think this is the last of the trivial reports for lesser used platforms. I've got to move on to other tasks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in numeric.c at S_my_atof_infnan and reproduce the Perl 5.30.1 64-bit build on Solaris 11.3 using the reported GCC configuration. Trace how Perl_isinf and the Solaris isinf declaration are detected or included; done means the Solaris build completes without the implicit-declaration warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.