Trying to generate gdc for mingw-w64(x86 and x64) using msys2

Vincent R via D.gnu d.gnu at puremagic.com
Thu Nov 5 06:27:16 PST 2015


On Thursday, 5 November 2015 at 13:15:45 UTC, Johannes Pfau wrote:
> Am Thu, 05 Nov 2015 12:42:08 +0000
> schrieb Vincent R <lol at dlang.org>:
>
>> Hi,
>> 
>> I would like to generate a d compiler targeting mingw-w64 using
>> the msys2 build system.
>> So I have installed msys2 (posix emulation like cygwin) as 
>> shown
>> here: http://msys2.github.io/ and I have installed necessary
>> packages:
>> 
>> $ pacman -S base-devel
>> $ pacman -S mingw-w64-x86_64-toolchain
>> 
>> optionally you can also installed  mingw-w64-i686-toolchain if 
>> you want to build mingw32 packages but for now I am only 
>> interested in mingw64 (64 bits).
>> 
>> Then I have forked MINGW-packages repository 
>> (https://github.com/vrichomme/MINGW-packages) to make my 
>> experiments.
>> 
>> $ git clone https://github.com/vrichomme/MINGW-packages.git $ 
>> cd MINGW-packages/mingw-w64-gcc
>> 
>> Inside mingw-w64-gcc I have used the 4 patches and renamed 
>> them to be more compliant with msys2 build system:
>> 
>> gdc-patch-gcc-5.patch
>> gdc-patch-toplev-5.patch
>> gdc-patch-versym-cpu-5.patch
>> gdc-patch-versym-os-5.patch
>> 
>> Then we are ready to start compilation:
>> 
>> $ MINGW_INSTALLS=mingw64 makepkg-mingw -sLf
>> ...
>> /home/19013692/MINGW-packages/mingw-w64-gcc/src/build-x86_64-w64-mingw32/./gcc/gdc
>> -B/home/19013692/MINGW-packages/mingw-w64-gcc/src/build-x86_64-w64-mingw32/./gcc/
>> -L/mingw64/x86_64-w64-mingw32/lib -L/mingw64/lib
>> -isystem /mingw64/x86_64-w64-mingw32/include
>> -isystem /mingw64/include -B/mingw64/x86_64-w64-mingw32/bin/
>> -B/mingw64/x86_64-w64-mingw32/lib/
>> -isystem /mingw64/x86_64-w64-mingw32/include
>> -isystem /mingw64/x86_64-w64-mingw32/sys-include    -o
>> gcc/gthreads/posix.o -Wall  -g -frelease -O2 -nostdinc -pipe
>> -Wno-deprecated -I ../../../../gcc-5.2.0/libphobos/libdruntime
>> -I ./x86_64-w64-mingw32 -I .
>> -c 
>> ../../../../gcc-5.2.0/libphobos/libdruntime/gcc/gthreads/posix.d ../../../../gcc-5.2.0/libphobos/libdruntime/gcc/gthreads/posix.d:29:1:
>> error: undefined identifier pthread_key_t, did you mean alias
>> gthread_key_t? alias gthread_key_t   = pthread_key_t; ^ ...
>> 
>> I am quite new to D language but I can see that posix.d imports
>> core.sys.posix.pthread and I thought that on Windows
>> Version(Posix) is not defined so how can it compile ?
>> Do I need to add a -DPosix or something like that ?
>> Do I need to add a Version(Mingw64) inside 
>> core.sys.posix.pthread
>> ?
>> 
>> Thanks
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>
> Do you use winpthreads?
> It seems the thread model is 'wrong':
> https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/configure.ac#L299
>
> Please post the output of 
> /home/19013692/MINGW-packages/mingw-w64-gcc/src/build-x86_64-w64-mingw32/./gcc/gdc -v
>
>
> (I guess threadmodel is posix for winpthreads. But druntime 
> doesn't really understand winpthreads. We'd have to modify 
> core/sys/posix/pthread.d and adjust the version(Posix) block. 
> But it's hard to estimate how many headers we need to change to 
> support this.)

19013692 at MLVD0032 MINGW64 ~/MINGW-packages/mingw-w64-gcc
$ 
/home/19013692/MINGW-packages/mingw-w64-gcc/src/build-x86_64-w64-mingw32/./gcc/gdc -v
Using built-in specs.
COLLECT_GCC=C:\DEV\msys64\home\19013692\MINGW-packages\mingw-w64-gcc\src\build-x86_64-w64-mingw32\gcc\gdc.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-5.2.0/configure --prefix=/mingw64 
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 
--with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/5.2.0 --disable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,d --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev4, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 5.2.0 (Rev4, Built by MSYS2 project)


More information about the D.gnu mailing list