MinGW collect2: CreateProcess: No such file or directory

MinGW collect2: CreateProcess: No such file or directory

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

MinGW collect2: CreateProcess: No such file or directory

Post by SpliFF »

Code: Select all

Using built-in specs.
COLLECT_GCC=C:\MinGW32\bin\g++.exe
COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.0/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.0 (GCC) 
COMPILER_PATH=c:/mingw32/bin/../libexec/gcc/mingw32/4.5.0/;c:/mingw32/bin/../libexec/gcc/;c:/mingw32/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw32/bin/../lib/gcc/mingw32/4.5.0/;c:/mingw32/bin/../lib/gcc/;c:/mingw32/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/lib/;c:/mingw32/bin/../lib/gcc/mingw32/4.5.0/../../../
COLLECT_GCC_OPTIONS='-mwindows' '-march=i686' '-msse' '-mfpmath=sse' '-mthreads' '-fsingle-precision-constant' '-frounding-math' '-mieee-fp' '-pipe' '-fno-strict-aliasing' '-O2' '-DNDEBUG' '-g' '-o' '..\..\..\spring.exe' '-v' '-shared-libgcc'
 c:/mingw32/bin/../libexec/gcc/mingw32/4.5.0/collect2.exe --subsystem windows -Bdynamic -u ___register_frame_info -u ___deregister_frame_info -o ..\..\..\spring.exe c:/mingw32/bin/../lib/gcc/mingw32/4.5.0/../../../crt2.o c:/mingw32/bin/../lib/gcc/mingw32/4.5.0/crtbegin.o -Lc:/mingw32/bin/../lib/gcc/mingw32/4.5.0 -Lc:/mingw32/bin/../lib/gcc -Lc:/mingw32/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/lib -Lc:/mingw32/bin/../lib/gcc/mingw32/4.5.0/../../.. --verbose --enable-auto-import @CMakeFiles\engine-default.dir\objects1.rsp --out-implib libspring.dll.a --major-image-version 0 --minor-image-version 0 -lmingw32 D:\Source\mingwlibs\lib\libSDLmain.a D:\Source\mingwlibs\dll\SDL.dll -lpthread -lopengl32 -lglu32 D:\Source\mingwlibs\dll\glew32.dll D:\Source\mingwlibs\dll\freetype6.dll ..\..\System\Sound\libsound.a D:\Source\mingwlibs\lib\libdevil.a D:\Source\mingwlibs\lib\libboost_regex-mt.a D:\Source\mingwlibs\lib\libboost_thread-mt.a D:\Source\mingwlibs\lib\libboost_program_options-mt.a D:\Source\mingwlibs\lib\libboost_system-mt.a D:\Source\mingwlibs\lib\libboost_signals-mt.a ..\..\lib\lua\liblua.a ..\..\lib\7z\lib7zip.a ..\..\lib\oscpack\liboscpack.a ..\..\lib\minizip\libminizip.a ..\..\lib\streflop\libstreflop.a ..\..\lib\lobby\liblobby.a -limagehlp -lws2_32 -lwinmm -lmingw32 D:\Source\mingwlibs\dll\OpenAL32.dll D:\Source\mingwlibs\dll\ogg.dll D:\Source\mingwlibs\dll\vorbisfile.dll D:\Source\mingwlibs\dll\vorbis.dll -lmingw32 D:\Source\mingwlibs\lib\libSDLmain.a D:\Source\mingwlibs\dll\SDL.dll -lpthread D:\Source\mingwlibs\dll\zlib1.dll D:\Source\mingwlibs\lib\libboost_thread-mt.a D:\Source\mingwlibs\lib\libboost_system-mt.a ..\..\lib\streflop\libstreflop.a -limagehlp -lws2_32 -lwinmm ..\..\lib\md5\libmd5.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lstdc++ -lmingwthrd -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lgdi32 -lcomdlg32 -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingwthrd -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw32/bin/../lib/gcc/mingw32/4.5.0/crtend.o
collect2: CreateProcess: No such file or directory
Has anyone else seen this one?

I'm assuming that collect2 is trying to run another program (perhaps ld.exe) but I can't figure out the specifics. Is there a way to track execution requests or get more verbose output?

I've had the problem occur under several different installations of MinGW. I suspect it's because I'm not installing under C:\MinGW but while the official MinGW says to install there the TDM install specifically says NOT to and offers C:\MinGW32 as the default. They wouldn't offer a default if it didn't work so what gives?

I'm using TDM installer stable 4.5.0 and as far as I can tell everything is where it is supposed to be.

PATH variable: C:\MinGW32\bin;C:\MinGW32\libexec\gcc\mingw32\4.5.0
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by SpliFF »

Ah. Running collect2 with -debug has revealed the problem. It's unwrapping the @response file and passing the entire file list to ld.exe.

That completely defeats the purpose of using a response file in the first place (to get around the 32k limit on args).

I wonder if anybody in the Spring community has successfully built Spring on Win32/MinGW lately? I mean using the latest git source (as of last week), GCC 4.5.0+ and git mingwlibs. As far as I can tell linking spring.exe will exceed 32k characters and cause this error yet I seem to be the only person who is affected.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by hoijui »

you remember my advice of using a shorter path to spring sources?
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by SpliFF »

Yes, but this time your advice was bogus. The paths in question are relative paths generated by CMake. They look like this:

CMakeFiles\engine-default.dir\__\__\Game\Game.cpp.obj
CMakeFiles\engine-default.dir\__\__\Game\GameData.cpp.obj
.... etc ....

So it really doesn't matter where the build directory is located because what counts is the paths inside the Spring source tree.

There's a couple of paths to library files in the commandline but shortening them won't save enough characters. As it is right now the complete arguments weight in at 33491 characters and the most I can save by reducing the build root is less than 100 characters.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: MinGW collect2: CreateProcess: No such file or directory

Post by jK »

SpliFF wrote:Yes, but this time your advice was bogus. The paths in question are relative paths generated by CMake. They look like this:
...
Doesn't sound like you tested it ...
Why open a thread when you don't even test the advices?
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by SpliFF »

jK, I guarentee it won't make the slightest bit of difference.

If you want to try and prove me wrong be my guest. I may not be the worlds' greatest expert on building complex projects like Spring but I've spent a LOT of time on this particular bug and I know exactly what is happening. I knew the first time hoijoi mentioned it that it wasn't going to work.

I've already reported this to the mingw and TDM bug trackers as it's almost certainly an issue with the MinGW binary releases.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45749
https://sourceforge.net/tracker/?func=d ... tid=974439

Even if shortening paths did help (it doesn't) it would still just be delaying the inevitable. Sooner or later we'd be using C:\ as our build directories because as Spring grows so do the number of objects (at least until somebody refactors the whole project).

But as I said the paths causing the issue are all relative to the spring build directory, not the drive root. The few absolute paths being passed amount to a total of no more than about 200 characters in total while the amount of characters over 32k is something like 1400.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: MinGW collect2: CreateProcess: No such file or directory

Post by imbaczek »

good job on reporting this, but unfortunately i believe the only real fix for now will be to split spring into at least two libraries; any fix to the toolchain will find its way into release builds in at least 6 months.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by SpliFF »

There is another option, though I'm not looking forward to it.

With help from the GCC bug report I believe I've tracked the problem down to an issue in the configuration of the TDM and official builds. The linker supports response files and collect supports passing them but it only does so if the toolchain was configured using --with-gnu-ld or it autodetects this from the ld on the build system. In other words the feature is there but it must be explicitly enabled when GCC is built.

The solution then is to rebuild gcc with this option set. This will create a collect2.exe that passes its args in a new response file to ld.exe.

I can't imagine building a working MinGW GCC is going to be easy but I do have a working linux hosted mingw32 cross-compiler so it isn't out of the realm of possibility either.

I could just resume building spring cross-compiled. My original motive for building on windows was to have a working GDB.exe but I've since learned about gdbserver which solves this issue for cross builds.

On the other hand that basically means until spring is split up, or the upstream packages adopt the fix, or a workaround is found, spring can no longer be built on windows (unless the VS builds work, which I doubt). So I'm going to try my hand at building a 4.5.0/dwarf2 based mingw32 GCC and put it up on my mirror if successful. No promises though.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: MinGW collect2: CreateProcess: No such file or directory

Post by aegis »

remove spring-headless, spring-dedicated, and spring-multithreaded from your build and you should have no problems building spring on windows (will greatly reduce the amount of arguments passed)
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by SpliFF »

I've tried "make spring" in the past. It doesn't solve the problem.

The arguments in question are all objects (*.obj) being linked into spring.exe (though I believe spring-multithreaded is also affected).

To help people understand the issue better, I've attached the response file used by engine targets (which should be both spring and spring-multiheaded)
Attachments
objects1.rsp.txt
D:\SpringTest\debug\rts\builds\default\CMakeFiles\engine-default.dir\objects1.rsp
(30.88 KiB) Downloaded 27 times
cranphin
Posts: 136
Joined: 13 Jun 2005, 16:37

Re: MinGW collect2: CreateProcess: No such file or directory

Post by cranphin »

I'm running into the same problem, too many arguments to ld.exe building spring.exe, using master out of git.

Is there like an official way of solving this yet? :)
Mayby a hint on the wiki would be a good idea? :)

Cheers :)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: MinGW collect2: CreateProcess: No such file or directory

Post by jK »

I just replaced the collect2.exe with the one from my gcc 3.4.5 install. :mrgreen:
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by SpliFF »

I couldn't get MinGW to build after trying for a few hours so I gave up and went back to cross-compiling on linux. I'll just wait until there's an upstream fix. I don't even need this anymore because I learned how to use gdbserver and my linux box compiles ~12 times faster than my Windows box.

There are long-term plans to make spring more modular, which will reduce the number of C++ files built at once (you build libraries then link those). I wouldn't hold my breath for it though.

Seems like the best shortterm solution is to do what jK did and try to get a working collect2.exe from somewhere else. I'm surprised though that the 3.4.5 versions works with a newer GCC.

jK, can you upload your working collect2? I'm going to make one last attempt to build GCC using a cross-compiler but if that fails I'm not going to waste any more time on this and that will have to be our official workaround (or VS 2005 for those that use it).
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: MinGW collect2: CreateProcess: No such file or directory

Post by jK »

I first tried a 4.4.0 one, but it failed too. So I tried the 3.4.5, which works and wonders me too, because the file is just 10% in size of the 4.5.0 one.

here the 3.4.5 one:
collect2.zip
(43.68 KiB) Downloaded 65 times
note: I needed to zip it because else the forum wouldn't allow me to upload it
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: MinGW collect2: CreateProcess: No such file or directory

Post by FLOZi »

Nevermind, delete this
cranphin
Posts: 136
Joined: 13 Jun 2005, 16:37

Re: MinGW collect2: CreateProcess: No such file or directory

Post by cranphin »

It seems that in response of the posted bug:
https://sourceforge.net/tracker/?func=d ... tid=974439
The issue has been fixed in TDM mingw. So one fix now (besides using TDM, which I don't feel like now ;) ), is to use collect2.exe from that package. I have tried that and it also works.

I made a report on 'stock' mingw, to see if they will apply the same patch :)
https://sourceforge.net/tracker/?func=d ... tid=102435
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: MinGW collect2: CreateProcess: No such file or directory

Post by hoijui »

nice! thanks cranphin!
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: MinGW collect2: CreateProcess: No such file or directory

Post by jK »

Spring compiling works fine WITHOUT ANY CHANGES with STOCK TDM-MingW32-dw2 here.
cranphin
Posts: 136
Joined: 13 Jun 2005, 16:37

Re: MinGW collect2: CreateProcess: No such file or directory

Post by cranphin »

jK wrote:Spring compiling works fine WITHOUT ANY CHANGES with STOCK TDM-MingW32-dw2 here.
Sweet :)
Hmm.. Do we want to make TDM the recommended MinGW then tho?
Not sure about that :)

Making a new how to build in windows wiki page (needs cleanup, a lot, feel free :D) at: http://springrts.com/wiki/Crans_Buildin ... indows_Log , why I'm asking :)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: MinGW collect2: CreateProcess: No such file or directory

Post by FLOZi »

The old collect2 is still required for current official gcc, but otherwise, working fine here, no changes necessary (using the GUI download tool even!).
Post Reply

Return to “Engine”