www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd, x64 and Windows

reply Trass3r <un known.com> writes:
While I'm delighted that we finally have a basic D2 x64 compiler I can't  
stop wondering how long it will take till I finally get my hands on it on  
Windows.
God knows I'd have switched to gdc long ago if gcc wasn't such a PITA to  
compile on Windows! Several attempts over the past year failed.

What bothers me most is that the bigger part of the delay is due to an  
antiquated object format, linker and C runtime (that have caused enough  
despair and rage since the beginning of time.. er, D)
ELF is standard on Linux, Mach-O on Mac. And dmd adheres to that.
So isn't Windows' de facto standard COFF in combination with MinGW's ld or  
VC's link the natural choice?
Feb 22 2011
next sibling parent reply Trass3r <un known.com> writes:
 antiquated object format, linker and C runtime (that have caused enough  
 despair and rage since the beginning of time.. er, D)
Just count the occurrences of "OPTLINK" preceding the post "Bye, D!": http://h3.gd/devlog/
Feb 22 2011
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I've been trying to compile GDC the last couple of days. I've ran into
some issues, but I've put them in GDC tickets and it seems from the
last comments that Iain Buclaw has managed to create a cross-compiler
setup and working. This is all last-minute info so I don't know if
we'll have GDC working on Windows just yet.
Feb 22 2011
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from Andrej Mitrovic (andrej.mitrovich gmail.com)'s article
 I've been trying to compile GDC the last couple of days. I've ran into
 some issues, but I've put them in GDC tickets and it seems from the
 last comments that Iain Buclaw has managed to create a cross-compiler
 setup and working. This is all last-minute info so I don't know if
 we'll have GDC working on Windows just yet.
D2 Ming32 cross-compiler built, but haven't yet tested the quality of the object files outputted (will no doubt be using WINE). Changeset: https://bitbucket.org/goshawk/gdc/changeset/978bb5bc82cf And briefly documented, as I *will* forget when the morning comes: https://bitbucket.org/goshawk/gdc/wiki/MinGWCrossCompile
Feb 22 2011
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I've tried to build it on native windows. It seems to build fine, and
after I've issued make install it got installed to build/mingw32.

But I'm missing libstdc++.dll. I couldn't figure out where to download
the dll from, the MinGW sourceforge website is horrible to browse
through.
I copied the DLL from an existing 4.5.2 MinGW installation.

I tried compiling a simple test project:

gdc main.d
ld.exe: cannot find -lpthread

I've already copied these:
    * binutils 2.20.51
    * mingw-runtime 3.18
    * w32api 3.14

But maybe I'm missing more runtime libraries. Probably some lib
package that has the libstdc++.dll file as well. Any clues?
Feb 22 2011
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/23/11, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 == Quote from Andrej Mitrovic (andrej.mitrovich gmail.com)'s article
 I've been trying to compile GDC the last couple of days. I've ran into
 some issues, but I've put them in GDC tickets and it seems from the
 last comments that Iain Buclaw has managed to create a cross-compiler
 setup and working. This is all last-minute info so I don't know if
 we'll have GDC working on Windows just yet.
D2 Ming32 cross-compiler built, but haven't yet tested the quality of the object files outputted (will no doubt be using WINE). Changeset: https://bitbucket.org/goshawk/gdc/changeset/978bb5bc82cf And briefly documented, as I *will* forget when the morning comes: https://bitbucket.org/goshawk/gdc/wiki/MinGWCrossCompile
I don't understand this. It takes at least 15 seconds to open the gcc archive with the few thousand source files on windows. And this is trying winrar, 7zip and peazip. Then it takes at least 30 seconds, or more like a minute to extract it. It takes an entire *hour* to build GCC+GDC, and this is with precompiled GMP, MPFR and MPC libraries. This is all done on Msys, of course. I have Ubuntu running in a Virtualbox (with hardware virtualization). It took 2 seconds to open the GCC archive, 4 seconds to extract it, and about 4 minutes to build GMP, MPFR, MPC and then GCC, in that order. I can't tell if this is the fault of MinGW or Msys. (or blame windows, hehe). Anywho, I've succesfully built it on Ubuntu, but since I'm such a linux naab I'm not sure how I'm supossed to install it. I've tried: sudo make DESTDIR="/build/Mingw32" install which apparently installed it in /build/Mingw32, but I can't seem to invoke it: $ gdc "The program 'gdc' is currently not installed. You can install it by typing: sudo apt-get install gdc" What do I have to do to be able to run gdc from within any folder?
Feb 23 2011
parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 23/02/11 21:15, Andrej Mitrovic wrote:
 which apparently installed it in /build/Mingw32, but I can't seem to invoke it:
 $ gdc
 "The program 'gdc' is currently not installed.  You can install it by typing:
 sudo apt-get install gdc"

 What do I have to do to be able to run gdc from within any folder?
echo $PATH The PATH environment variable holds a list of paths where executables are stored, to invoke a command without a path, it must be in the list. export PATH=/build/Mingw32/usr/bin:$PATH gdc should now work (if not, find the correct location of the gdc executable, I don't recall it - I think I got it right above). If it works, and you would like to make the change permenant, add the above line to the end of the .bashrc file in your home directory. As a side note, the "correct" place for custom, non-distribution software is in /opt, so you would install to /opt/mingw32 instead of /build. -- Robert http://octarineparrot.com/
Feb 23 2011
next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/23/11, Robert Clipsham <robert octarineparrot.com> wrote:
 snip
Thanks. The opt/Mingw32/usr/bin folder has 586-mingw32msvc-gdc as the executable name for gdc. Is there a way to link 'gdc' calls to '586-mingw32msvc-gdc' ?
Feb 23 2011
parent Robert Clipsham <robert octarineparrot.com> writes:
On 23/02/11 21:36, Andrej Mitrovic wrote:
 On 2/23/11, Robert Clipsham<robert octarineparrot.com>  wrote:
 snip
Thanks. The opt/Mingw32/usr/bin folder has 586-mingw32msvc-gdc as the executable name for gdc. Is there a way to link 'gdc' calls to '586-mingw32msvc-gdc' ?
ls -s /opt/Mingw32/usr/bin/586-mingw32msvc-gdc /opt/Mingw32/usr/bin/gdc Will create a symbolic link from gdc to 586-mingw32msvc-gdc (think of it as an alias or a shortcut). -- Robert http://octarineparrot.com/
Feb 23 2011
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Right, installing gdc fixed the missing cc1d issue. But now I have other issues:

andrej andrej-VirtualBox:~/Desktop/test$ i586-mingw32msvc-gdc test.d
object.d: Error: module object is in file 'object.d' which cannot be read
import path[0] =
/opt/Mingw32/usr/bin/../lib/gcc/i586-mingw32msvc/4.5.2/../../../../include/d2/4.5.2/i586-mingw32msvc
import path[1] =
/opt/Mingw32/usr/bin/../lib/gcc/i586-mingw32msvc/4.5.2/../../../../include/d2/4.5.2
andrej andrej-VirtualBox:~/Desktop/test$

The opt/Mingw32/user/include folder is empty.

I've used this to install: make DESTDIR="/opt/Mingw32" install
Feb 23 2011
parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 23/02/11 21:40, Andrej Mitrovic wrote:
 Right, installing gdc fixed the missing cc1d issue. But now I have other
issues:

 andrej andrej-VirtualBox:~/Desktop/test$ i586-mingw32msvc-gdc test.d
 object.d: Error: module object is in file 'object.d' which cannot be read
 import path[0] =
 /opt/Mingw32/usr/bin/../lib/gcc/i586-mingw32msvc/4.5.2/../../../../include/d2/4.5.2/i586-mingw32msvc
 import path[1] =
 /opt/Mingw32/usr/bin/../lib/gcc/i586-mingw32msvc/4.5.2/../../../../include/d2/4.5.2
 andrej andrej-VirtualBox:~/Desktop/test$

 The opt/Mingw32/user/include folder is empty.

 I've used this to install: make DESTDIR="/opt/Mingw32" install
Try: gdc -I/opt/Mingw32/usr/local/include/d/4.5.2 test.d Alternatively: find /opt/Mingw32 -name object.d Will give a list of object.d files in your install, try that with the -I instead (I think gdc accepts -I, if not, try gdmd which will convert dmd flags to gdc flags automatically... I can't remember if there's a gdc specific flag or not). -- Robert http://octarineparrot.com/
Feb 23 2011
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/23/11, Robert Clipsham <robert octarineparrot.com> wrote:
 Try:

 gdc -I/opt/Mingw32/usr/local/include/d/4.5.2 test.d
There is no opt/Mingw32/usr/local folder, there's a opt/Mingw32/usr/include folder but it's empty.
 Alternatively:

 find /opt/Mingw32 -name object.d
Doesn't show anything.
 ls -s /opt/Mingw32/usr/bin/i586-mingw32msvc-gdc /opt/Mingw32/usr/bin/gdc
andrej andrej-VirtualBox:/$ ls -s /opt/Mingw32/usr/bin/i586-mingw32msvc-gdc /opt/Mingw32/usr/bin/gdc ls: cannot access /opt/Mingw32/usr/bin/gdc: No such file or directory 520 /opt/Mingw32/usr/bin/i586-mingw32msvc-gdc
Feb 23 2011
parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Andrej Mitrovic wrote:
 On 2/23/11, Robert Clipsham <robert octarineparrot.com> wrote:
 ls -s /opt/Mingw32/usr/bin/i586-mingw32msvc-gdc /opt/Mingw32/usr/bin/g=
dc
=20
 andrej andrej-VirtualBox:/$ ls -s
 /opt/Mingw32/usr/bin/i586-mingw32msvc-gdc /opt/Mingw32/usr/bin/gdc
 ls: cannot access /opt/Mingw32/usr/bin/gdc: No such file or directory
 520 /opt/Mingw32/usr/bin/i586-mingw32msvc-gdc
This should be: ln -s ... Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Feb 23 2011
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Well now I've tried executing it from the build folder but then I get an error:
andrej andrej-VirtualBox:~/Desktop/gdcbuild/buildgw/buildgw/gcc$ ./gdc test.d
gdc: error trying to exec 'cc1d': execvp: No such file or directory

(disregard the double buildgw folder, I've accidentally made two).
Feb 23 2011
parent reply =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Andrej Mitrovic wrote:
 Well now I've tried executing it from the build folder but then I get a=
n error:
 andrej andrej-VirtualBox:~/Desktop/gdcbuild/buildgw/buildgw/gcc$ ./gdc =
test.d
 gdc: error trying to exec 'cc1d': execvp: No such file or directory
=20
Do you have a folder named "gcc" in the current folder? Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Feb 23 2011
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from "Jérôme M. Berger" (jeberger free.fr)'s article
 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enigBAD628AE9E72F8111315C90D
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 Andrej Mitrovic wrote:
 Well now I've tried executing it from the build folder but then I get a=
n error:
 andrej andrej-VirtualBox:~/Desktop/gdcbuild/buildgw/buildgw/gcc$ ./gdc =
test.d
 gdc: error trying to exec 'cc1d': execvp: No such file or directory
Do you have a folder named "gcc" in the current folder? Jerome
PPA here: https://launchpad.net/~ibuclaw/+archive/ppa/+sourcepub/1528149/+listing-archive-extra std.stdio (and probably many more phobos modules) is not implemented for MinGW, so your pretty much stuck using just druntime for things. If you can work on it, please do. :) Regards.
Feb 27 2011
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/27/11, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 PPA here:
 https://launchpad.net/~ibuclaw/+archive/ppa/+sourcepub/1528149/+listing-archive-extra
Wohoo, binaries!! :] I'm a bit sick right now so I won't have much time to test it these days. I'll get better soon I hope. P.S. now that I've 'installed' it, how do I invoke it (I mean, calling 'gdc' in a terminal doesn't work, so the binary is called something else?)? And where does the package manager install it anyway? Thanks for all the work btw.
Feb 27 2011
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from Andrej Mitrovic (andrej.mitrovich gmail.com)'s article
 On 2/27/11, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 PPA here:
https://launchpad.net/~ibuclaw/+archive/ppa/+sourcepub/1528149/+listing-archive-extra
 Wohoo, binaries!! :]
 I'm a bit sick right now so I won't have much time to test it these
 days. I'll get better soon I hope.
 P.S. now that I've 'installed' it, how do I invoke it (I mean, calling
 'gdc' in a terminal doesn't work, so the binary is called something
 else?)? And where does the package manager install it anyway?
 Thanks for all the work btw.
For a list of all files: dpkg -L gcc-mingw32 All binaries are prefixed with 'i586-mingw32msvc-*' to separate the cross compiler from the system compiler. It's not much, but should be enough to start some work on getting MinGW working. Regards
Feb 27 2011
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/28/11, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 It's not much, but should be enough to start some work on getting MinGW
 working.
After installing on a fresh Ubuntu 10.10 32bit I get: "Breaks existing package 'mingw32-binutils' that conflict: 'mingw32'. But the '/tmp/gcc-mingw32_4.5.2-0ubuntu1~ppa2_i386.deb' provides it via: 'mingw32'" Trying to compile test.d: void main() { } andrej andrej-VirtualBox:~/Desktop$ i586-mingw32msvc-gdc test.d /usr/lib/gcc/i586-mingw32msvc/4.5.2/../../../../i586-mingw32msvc/bin/ld: crt2.o: No such file: No such file or directory collect2: ld returned 1 exit status andrej andrej-VirtualBox:~/Desktop$ Am I doing something wrong? gcc-mingw32_4.5.2-0ubuntu1~ppa2_i386.deb is the only thing I've installed.
Feb 28 2011
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Well I have some good news, I've finally managed to get GDC working
for D2 on Windows (using Msys). I owe it to Ian Buclaw and Daniel
Green for all the help. You can download an updated guide here:
http://dl.dropbox.com/u/9218759/gdcbuild_mingw.txt

Sorry again for having hijacked this thread. :)
Mar 05 2011
parent reply Mehrdad <wfunction hotmail.com> writes:
 Well I have some good news, I've finally managed to get GDC working
for D2 on Windows (using Msys). I owe it to Ian Buclaw and Daniel Green for all the help. You can download an updated guide here: http://dl.dropbox.com/u/9218759/gdcbuild_mingw.txt
 Sorry again for having hijacked this thread. :)
OMG, thanks for posting this, Andrej! This is really useful! (Sorry for continuing the thread hijack...)
Mar 06 2011
parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
No problem. Make sure you follow the latest one because there's
another patch you have to use to make stdio work (I've posted this on
SO already). I've also added some info on where to get GDB and its
manuals. Using GDB works great, the symbols get loaded from the
executable when compiled with 'GDC -g file.d'.

Here's the latest one: https://gist.github.com/857381
Mar 07 2011
prev sibling next sibling parent Caligo <iteronvexor gmail.com> writes:
Kind of off-topic, but does anyone know if GDC is still scheduled to be
included in GCC 4.7?
Mar 05 2011
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 3/6/11, Caligo <iteronvexor gmail.com> wrote:
 Kind of off-topic, but does anyone know if GDC is still scheduled to be
 included in GCC 4.7?
Dunno. But this raises an interesting observation. If GDC gets included in the GCC mainline, I wonder if the MinGW and TDM-MinGW teams will start getting interest in D. Of course, this doesn't automatically mean they'll jump on the bandwagon and start supporting D. Afaik the MinGW team dropped support for Java (?), so I don't think they feel they should support every language that GCC supports. Still, this might get people more interested in D.
Mar 06 2011
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Ooh I'm probably missing runtime libs like binutils. Sorry!

I still want to know how to install gdc on the system though.
Feb 23 2011
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
Trass3r wrote:
 While I'm delighted that we finally have a basic D2 x64 compiler I can't 
 stop wondering how long it will take till I finally get my hands on it 
 on Windows.
 God knows I'd have switched to gdc long ago if gcc wasn't such a PITA to 
 compile on Windows! Several attempts over the past year failed.
 
 What bothers me most is that the bigger part of the delay is due to an 
 antiquated object format, linker and C runtime (that have caused enough 
 despair and rage since the beginning of time.. er, D)
 ELF is standard on Linux, Mach-O on Mac. And dmd adheres to that.
 So isn't Windows' de facto standard COFF in combination with MinGW's ld 
 or VC's link the natural choice?
To do 64 bits on Windows requires: 1. 64 bit OMF 2. 64 bit librarian 3. 64 bit generating dmd 4. 64 bit C compiler 5. 64 bit symbolic debug info 6. 64 bit debugger 7. 64 bit C runtime Just one of those won't do it. All are necessary. The reason I did 64 bit linux first is all those things were ready to rock but dmd.
Feb 22 2011
parent reply Trass3r <un known.com> writes:
Walter Bright Wrote:
 To do 64 bits on Windows requires:
 
 1. 64 bit OMF
 2. 64 bit librarian
 3. 64 bit generating dmd
 4. 64 bit C compiler
 5. 64 bit symbolic debug info
 6. 64 bit debugger
 7. 64 bit C runtime
 
 Just one of those won't do it. All are necessary. The reason I did 64 bit
linux 
 first is all those things were ready to rock but dmd.
I do understand that. Hence I wonder even more, wouldn't it make sense to use MinGW's tools which are a direct port of all those unix ones?
Feb 23 2011
parent Walter Bright <newshound2 digitalmars.com> writes:
Trass3r wrote:
 Hence I wonder even more, wouldn't it make sense to use MinGW's tools which
 are a direct port of all those unix ones?
Perhaps. I have to do more investigation.
Feb 23 2011