www.digitalmars.com         C & C++   DMDScript  

D.gnu - Up-to-date instructions on Linux based cross-compiler to Win32

reply Marco Leise <Marco.Leise gmx.de> writes:
As the topic suggests, I'm looking for instructions to get a cross-compiler
working on Linux and the ones in the Wiki are fairly outdated, referring to old
versions of D2 and GCC.

The compiler actually builds, but it cannot build Phobos, with these lines of
errors:
/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/gdc
-B/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/
-L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw32/winsup/mingw
-L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw
2/winsup/w32api/lib -isystem
/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/mingw/include -isystem
/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/w32api/include
-B/usr/i686-mingw32/bin/ -B/usr/i686-mingw32/lib/ -isystem
/usr/i686-mingw32/include -isystem /usr/i686-mingw32/sys-include -Wall -g
-frelease -O2  -nostdinc -pipe -fdeprecated -I ../../../libphobos -I
./i686-mingw32  -fintfc-file=import/core/sys/windows/dbghelp.di -fsyntax-only
../../../libphobos/core/sys/windows/dbghelp.d
../../../libphobos/core/sys/posix/sys/un.d:17: Error: import __anonymous
sa_family_t not found
../../../libphobos/core/sys/posix/sys/un.d:17: Error: alias
core.sys.posix.sys.un.sa_family_t recursive alias dec

-- 
Marco
Mar 29 2012
next sibling parent reply Johannes Pfau <nospam example.com> writes:
Am Thu, 29 Mar 2012 20:34:42 +0200
schrieb Marco Leise <Marco.Leise gmx.de>:

 As the topic suggests, I'm looking for instructions to get a
 cross-compiler working on Linux and the ones in the Wiki are fairly
 outdated, referring to old versions of D2 and GCC.
 
 The compiler actually builds, but it cannot build Phobos, with these
 lines of
 errors: /home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/gdc
 -B/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/
 -L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw32/winsup/mingw
 -L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw32/winsup/w32api/lib
 -isystem /home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/mingw/include
 -isystem /home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/w32api/include
 -B/usr/i686-mingw32/bin/ -B/usr/i686-mingw32/lib/
 -isystem /usr/i686-mingw32/include
 -isystem /usr/i686-mingw32/sys-include -Wall -g -frelease -O2
 -nostdinc -pipe -fdeprecated -I ../../../libphobos -I ./i686-mingw32
 -fintfc-file=import/core/sys/windows/dbghelp.di
 -fsyntax-only ../../../libphobos/core/sys/windows/dbghelp.d
../../../libphobos/core/sys/posix/sys/un.d:17:
 Error: import __anonymous sa_family_t not
 found ../../../libphobos/core/sys/posix/sys/un.d:17: Error: alias
 core.sys.posix.sys.un.sa_family_t recursive alias dec
 
Sorry, that's my fault again. I couldn't check whether the new backtrace stuff worked on mingw, I guess that's the problem. But I should have seen that the new code imports a posix header even on windows. Could you please check if this patch fixes it: https://gist.github.com/2253215 (That disables the GCC backtraces for non-Posix systems completely. Windows has custom backtrace code anyway.) BTW: Iain Could you have a look at the build instructions at https://github.com/D-Programming-GDC/GDC/wiki ? I just changed the git checkout commands and symlinks, but it seems that gcc-x.x.x/gcc/libphobos can't be a symlink anymore, so this directory needs to be copied? Or should the repository just be checkout out into the main gcc-x.x.x/ folder? Does git somehow allow to checkout into an non-empty folder?
Mar 30 2012
next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 30 March 2012 18:58, Johannes Pfau <nospam example.com> wrote:
 Am Thu, 29 Mar 2012 20:34:42 +0200
 schrieb Marco Leise <Marco.Leise gmx.de>:

 As the topic suggests, I'm looking for instructions to get a
 cross-compiler working on Linux and the ones in the Wiki are fairly
 outdated, referring to old versions of D2 and GCC.

 The compiler actually builds, but it cannot build Phobos, with these
 lines of
 errors: /home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/gdc
 -B/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/
 -L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw32/winsup/mingw
 -L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw32/winsup/w32api/lib
 -isystem /home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/mingw/include
 -isystem /home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/w32api/include
 -B/usr/i686-mingw32/bin/ -B/usr/i686-mingw32/lib/
 -isystem /usr/i686-mingw32/include
 -isystem /usr/i686-mingw32/sys-include -Wall -g -frelease -O2
 -nostdinc -pipe -fdeprecated -I ../../../libphobos -I ./i686-mingw32
 -fintfc-file=import/core/sys/windows/dbghelp.di
 -fsyntax-only ../../../libphobos/core/sys/windows/dbghelp.d
../../../libphobos/core/sys/posix/sys/un.d:17:
 Error: import __anonymous sa_family_t not
 found ../../../libphobos/core/sys/posix/sys/un.d:17: Error: alias
 core.sys.posix.sys.un.sa_family_t recursive alias dec
Sorry, that's my fault again. I couldn't check whether the new backtrace stuff worked on mingw, I guess that's the problem. But I should have seen that the new code imports a posix header even on windows. Could you please check if this patch fixes it: https://gist.github.com/2253215 (That disables the GCC backtraces for non-Posix systems completely. Windows has custom backtrace code anyway.) BTW: Iain Could you have a look at the build instructions at https://github.com/D-Programming-GDC/GDC/wiki ? I just changed the git checkout commands and symlinks, but it seems that gcc-x.x.x/gcc/libphobos can't be a symlink anymore, so this directory needs to be copied?
I suggest: cd gcc-x-x-x mkdir libphobos cd libphobos ../symlink-tree ../../d/libphobos This creates all directories, and individual symbolic links to each file in libphobos. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Mar 30 2012
prev sibling parent Marco Leise <Marco.Leise gmx.de> writes:
Am Fri, 30 Mar 2012 19:58:48 +0200
schrieb Johannes Pfau <nospam example.com>:

 Sorry, that's my fault again. I couldn't check whether the new
 backtrace stuff worked on mingw, I guess that's the problem. But I
 should have seen that the new code imports a posix header even on
 windows.
 
 Could you please check if this patch fixes it:
 https://gist.github.com/2253215
 
 (That disables the GCC backtraces for non-Posix systems completely.
 Windows has custom backtrace code anyway.)
Ok, thank you. I'll have a look. It looks like there have been quite some changes (GitHub move, the GCC preparation script amongst others). I don't expect the checked out version to always work, and I can not rule out that I don't know what I do either. :) So I must rely on instructions that are expected to work with a certain version of the GCC sources. GDC is usually working well for me once I get it compiled and the only D compiler that produces highly optimized code for what I want.
Mar 31 2012
prev sibling parent Daniel Green <venix1 gmail.com> writes:
On 3/29/2012 1:34 PM, Marco Leise wrote:
 As the topic suggests, I'm looking for instructions to get a cross-compiler
working on Linux and the ones in the Wiki are fairly outdated, referring to old
versions of D2 and GCC.

 The compiler actually builds, but it cannot build Phobos, with these lines of
errors:
 /home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/gdc
-B/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/./gcc/
-L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw32/winsup/mingw
-L/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/windows/i686-mingw
2/winsup/w32api/lib -isystem
/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/mingw/include -isystem
/home/marco/Entwicklung/D/gdc/dev/gcc-4.6.2/winsup/w32api/include
-B/usr/i686-mingw32/bin/ -B/usr/i686-mingw32/lib/ -isystem
/usr/i686-mingw32/include -isystem /usr/i686-mingw32/sys-include -Wall -g
-frelease -O2  -nostdinc -pipe -fdeprecated -I ../../../libphobos -I
./i686-mingw32  -fintfc-file=import/core/sys/windows/dbghelp.di -fsyntax-only
../../../libphobos/core/sys/windows/dbghelp.d
 ../../../libphobos/core/sys/posix/sys/un.d:17: Error: import __anonymous
sa_family_t not found
 ../../../libphobos/core/sys/posix/sys/un.d:17: Error: alias
core.sys.posix.sys.un.sa_family_t recursive alias dec
I don't think Johannes patch will fix that. That's a result of GDC's desire to make all the headers. Which ends up failing for Windows. Even DMD doesn't try to make that one. To fix, just wrap the import statement in version( posix ). It's what I have the MinGW builds do.
Mar 30 2012