OK, thanks all!
I managed to make a 64-bit compile on a stand-alone MinGW64 install, using this horrible x64... command. I am pretty sure it was a 64-bit compile, as it started to produce warnings for assigning pointers to not-large-enough integers.
However, using "gcc -O2" there seems no speed difference between the 32-bit and 64-bit versions. (One took 6.98 sec to reach depth 15, the other 6.91, which is within the noise.) Best results I got for a 32-bit compile with
gcc -O3 -s -fomit-frame-pointer shokidoki.c -o sdk.exe
In that case the time needed to reach depth 15 dropped to 5.55 sec. Strange enough -O3 in stead of -O2 had no effect on the 64-bit compiles, while using -fomit-frame-pointer increased thetime to 7.52 sec!
This is a bit disappointing, as I had hoped there could be some speed advantage in using the larger register set of the x64 architecture. I guess my coding style is such that the standard set of x386 registers is fully sufficient to produce optimal code, the high-level program already avoiding bottle-necks that extra registers could solve.
But it is good to know that for now I can stick to 32-bit compiles.
Btw, it seems that installing the x64 mingw stuff on Cygwin did as a side effect upgrade my 32-bit gcc there from version 3.4.3 to version 4.5.3. It is this new version that refuses the -mno-cygwin flag.
How can I make 64-bit compiles with Cygwin?
Moderator: Ras
-
hgm
- Posts: 28464
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
-
diep
- Posts: 1822
- Joined: Thu Mar 09, 2006 11:54 pm
- Location: The Netherlands
Re: How can I make 64-bit compiles with Cygwin?
With x86_64-w64-mingw32-gcc.exe there is no need for cygwin anymore as x86_64-w64-mingw32-gcc.exe already compiles directly from DOS command prompt box in windoze.Kirill Kryukov wrote: Yes you can make 64-bit binaries with cygwin. Confusing part is that you have to use "x86_64-w64-mingw32-gcc.exe" instead of "gcc". I.e.:
-
rvida
- Posts: 481
- Joined: Thu Apr 16, 2009 12:00 pm
- Location: Slovakia, EU
Re: How can I make 64-bit compiles with Cygwin?
Using _DOS_ it would be hard indeed. AFAIK the only DOS port of gcc was djgpp which did not target Win32/64 platforms.lucasart wrote: PS: As pointed out by Michel, it is far easier to compile the Windows binary using Linux than using DOS.
-
Tom Likens
- Posts: 303
- Joined: Sat Apr 28, 2012 6:18 pm
- Location: Austin, TX
Re: How can I make 64-bit compiles with Cygwin?
Actually, I answered my own question. PGO works fine under Windows for MinGW.Tom Likens wrote:Have you been able to successfully create a PGO-optimized executable with the Windows version of MingW?You need to download & install a 64bit enabled version (obviously). I use this one:
http://sourceforge.net/projects/tdm-gcc ... e/download
It produces 64bit executables right out of the box. You can still build a 32bit binary if you specify -m32 command line parameter.
--tom
It gives a reasonable 4-5% speedup. I still can't really get it to work right under
Linux though when I cross compile for Windows.
-
Kirill Kryukov
- Posts: 519
- Joined: Sun Mar 19, 2006 4:12 am
- Full name: Kirill Kryukov
Re: How can I make 64-bit compiles with Cygwin?
I agree, in a sense that cygwin shell is not needed. At least personally I never use it, when I need to run any cygwin's binary I do so from other shells or scripts.diep wrote:With x86_64-w64-mingw32-gcc.exe there is no need for cygwin anymore as x86_64-w64-mingw32-gcc.exe already compiles directly from DOS command prompt box in windoze.
What I like in cygwin though is the installer (setup.exe) as it allows to semi-automatically keep the whole thing up-to-date. It would be even more useful if they could port everything to 64-bit, and include more recent GCC.
-
Don
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
Re: How can I make 64-bit compiles with Cygwin?
I make all my windows binaries in Linux using mingw. What H.G. wants is Mingw not cygwin.Michel wrote:In my experience it is far more convenient to make 64bit windows binaries by cross-compiling in Linux rather that doing it in Windows itself.
But I have also done compiles with Mingw for windows. For some reason it has always been a little tricky getting everything set up -but once you do it works great.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
-
lucasart
- Posts: 3243
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: How can I make 64-bit compiles with Cygwin?
Sorry, I meant the Windows command line (cmd.exe).rvida wrote:Using _DOS_ it would be hard indeed. AFAIK the only DOS port of gcc was djgpp which did not target Win32/64 platforms.lucasart wrote: PS: As pointed out by Michel, it is far easier to compile the Windows binary using Linux than using DOS.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
Don
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
Re: How can I make 64-bit compiles with Cygwin?
The way I did it was a big surprise but works. Build the linux version first, then profile it. Use the profile created from the linux version to compile the windows version with.Tom Likens wrote:Actually, I answered my own question. PGO works fine under Windows for MinGW.Tom Likens wrote:Have you been able to successfully create a PGO-optimized executable with the Windows version of MingW?You need to download & install a 64bit enabled version (obviously). I use this one:
http://sourceforge.net/projects/tdm-gcc ... e/download
It produces 64bit executables right out of the box. You can still build a 32bit binary if you specify -m32 command line parameter.
--tom
It gives a reasonable 4-5% speedup. I still can't really get it to work right under
Linux though when I cross compile for Windows.
To may amazement this produces much faster windows binaries. I never tried profiling the binary by running it in wine - that might work too. How did you do the profile and PGO?
Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
-
Tom Likens
- Posts: 303
- Joined: Sat Apr 28, 2012 6:18 pm
- Location: Austin, TX
Re: How can I make 64-bit compiles with Cygwin?
Hello Don,Don wrote: The way I did it was a big surprise but works. Build the linux version first, then profile it. Use the profile created from the linux version to compile the windows version with.
To may amazement this produces much faster windows binaries. I never tried profiling the binary by running it in wine - that might work too. How did you do the profile and PGO?
Don
It's amazing how these things vary from program to program. I tried your method first, (i.e. generate a Linux profile version, run it to create the .gcda files, then build a Windows version utilizing the profile data). But, it didn't really work for me. It found most of the files, but it also complained that the source locations for a number of functions had changed. A typical example:
Code: Select all
/proj/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++ -DX86_64 -DFAST -m64 -Ofast -fno-rtti -fno-exceptions -fomit-frame-pointer -march=k8 -mtune=generic -static -fprofile-use -fprofile-dir=/proj/djinn/build/profile -Wall -W -Wno-sign-compare -Wno-error=coverage-mismatch -Wno-coverage-mismatch -I../src/engine -I../src/console -I../src/lib -I../src/chant -c ../src/console/runepd.cpp
../src/console/runepd.cpp: In function ‘void __gnu_cxx::new_allocator<_Tp>::construct(__gnu_cxx::new_allocator<_Tp>::pointer, const _Tp&) [with _Tp = epd_t; __gnu_cxx::new_allocator<_Tp>::pointer = epd_t*]’:
../src/console/runepd.cpp:1258:1: warning: source locations for function ‘_ZN9__gnu_cxx13new_allocatorI5epd_tE9constructEPS1_RKS1_.isra.43’ have changed, the profile data may be out of date [enabled by default]
So anyway, what I did for the latest Window 64 compile was to install MinGW64 on my one dual-boot windows machine. I hated doing this as I'm a Unix guy through and through, but, it worked. And even better PGO worked without any problems, so for now this is the interim solution until I can track down *exactly* what's going wrong with my PGO run when I cross-compile in Linux.
regards,
--tom