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

[perl #128635] Win64 build with compiler has PTRSIZE!== IVSIZE

Thread Previous
Dan Collins
July 16, 2016 18:50
[perl #128635] Win64 build with compiler has PTRSIZE!== IVSIZE
Message ID:
# New Ticket Created by  Dan Collins 
# Please include the string:  [perl #128635]
# in the subject line of all future correspondence about this issue. 
# <URL: >

I noticed the following while building with a 64 bit GCC on Windows:

    gcc -c  -I.\include -I. -I.. -DWIN32 -DWIN64 -DCONSERVATIVE -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -fno-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\toke.o  ..\toke.c
    In file included from ..\toke.c:40:0:
    ..\hv_func.h: In function 'S_perl_hash_murmur3':
    ..\perl.h:1727:26: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     #  define INT2PTR(any,d) (any)(d)
    ..\perl.h:1746:19: note: in expansion of macro 'INT2PTR'
     #define PTR2IV(p) INT2PTR(IV,p)
    ..\hv_func.h:403:17: note: in expansion of macro 'PTR2IV'
         STRLEN i = -PTR2IV(ptr) & 3;

This is using the following GCC:

    W:\buildbot\windows1\win64-4_9_3\build>gcc -v
    Using built-in specs.
    Target: i686-w64-mingw32
    Configured with: ../../../src/gcc-4.9.3/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw493/i686-493-posix-dwarf-rt_v4-rev1/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw493/prerequisites/i686-w6
 4-mingw32-static --with-mpfr=/c/mingw493/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw493/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw493/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw493/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-posix-dwarf-rev1, Built by MinGW-W64 project' --with-bugurl= CFLAGS='-O2 -pipe -I/c/mingw493/i686-493-posix-dwarf-rt_v4-rev1/mingw32/opt/include -I/c/mingw493/prerequisites/i686-zlib-static/include -I/c/mingw493/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw493/i686-493-posix-dwarf-rt_v4-rev1/mingw32/opt/include -I/c/mingw493/prerequisites/i686-zlib-static/include -I/c/mingw493/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw493/i686-493-posix-dwarf-rt_v4-rev1/mingw32/opt/lib -L/c/mingw493/prerequisites/i686-zlib-static/lib -L/c/mingw493/prerequisites/i686-w64-m
 ingw32-static/lib -Wl,--large-address-aware'
    Thread model: posix
    gcc version 4.9.3 (i686-posix-dwarf-rev1, Built by MinGW-W64 project)

I get many warnings like that before getting an apparently functional miniperl:

    W:\buildbot\windows1\win64-4_9_3\build>miniperl.exe -v

    This is perl 5, version 25, subversion 3 (v5.25.3 (UNKNOWN-miniperl)) built for MSWin32-x86

    Copyright 1987-2016, Larry Wall

    Perl may be copied only under the terms of either the Artistic License or the
    GNU General Public License, which may be found in the Perl 5 source kit.

    Complete documentation for Perl, including FAQ lists, should be found on
    this system using "man perl" or "perldoc perl".  If you have access to the
    Internet, point your browser at, the Perl Home Page.

And finally this error:

    gcc -c -I..\  -I.\include -I. -I.. -DWIN32 -DWIN64 -DCONSERVATIVE -DPERLDLL -DPERL_CORE -s -O2  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields -o..\op.o  ..\op.c
    In file included from op.c:163:0:
    op.c: In function 'Perl_ck_rvconst':
    ..\perl.h:3703:20: error: negative width in bit-field '_static_assertion_failed_9814'
         typedef struct { \
    ..\perl.h:3706:41: note: in expansion of macro 'STATIC_ASSERT_2'
    ..\perl.h:3707:41: note: in expansion of macro 'STATIC_ASSERT_1'
    ..\perl.h:3712:44: note: in expansion of macro 'STATIC_ASSERT_GLOBAL'
     #define STATIC_ASSERT_STMT(COND)      do { STATIC_ASSERT_GLOBAL(COND); } while (0)
    op.c:9814:6: note: in expansion of macro 'STATIC_ASSERT_STMT'

As far as I know, I followed the instructions in README.win32 for a build with this compiler. Notably, config.h has IVSIZE == 8, PTRSIZE == 8, IVTYPE == long long, and does #define USE_64_BIT_INT. I've attached my lightly customized as well as my config.h. Note that I am applying the patch from RT #128438, as without it the build doesn't even get this far.

Dan Collins
Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About