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

[perl #128635] Win64 build with mingw-w64.org compiler has PTRSIZE!== IVSIZE

Thread Previous
From:
Dan Collins
Date:
July 16, 2016 18:50
Subject:
[perl #128635] Win64 build with mingw-w64.org compiler has PTRSIZE!== IVSIZE
Message ID:
rt-4.0.18-20098-1468695041-530.128635-75-0@perl.org
# New Ticket Created by  Dan Collins 
# Please include the string:  [perl #128635]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128635 >


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.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=C:/mingw-w64/i686-4.9.3/mingw32/bin/../libexec/gcc/i686-w64-mingw32/4.9.3/lto-wrapper.exe
    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=http://sourceforge.net/projects/mingw-w64 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 http://www.perl.org/, 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
    <snip>
    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'
     #  define STATIC_ASSERT_1(COND, SUFFIX) STATIC_ASSERT_2(COND, SUFFIX)
                                             ^
    ..\perl.h:3707:41: note: in expansion of macro 'STATIC_ASSERT_1'
     #  define STATIC_ASSERT_GLOBAL(COND)    STATIC_ASSERT_1(COND, __LINE__)
                                             ^
    ..\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 makefile.mk 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.

-- 
Respectfully,
Dan Collins
Thread Previous


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