Am Thu, 05 Nov 2015 12:42:08 +0000 schrieb Vincent R <l...@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.)