TDM-GCC w64 script to change windres for 32bit?
Asked Answered
S

1

5

Trying to get the TDM-GCC(4.7.1) running on XP SP3 - I just need a c++ 32bit build for now. It seems that windres is not in the right format, my .rc file is failing the build:

x86_64-w64-mingw32-g++.exe  -Wall -m32 -s -D_M_X86 -DBUILD_DLL -DNDEBUG     -c C:\SynthEditSDK\TD_SV\SV.cpp -o obj\Release\TD_SV\SV.o
windres.exe  -J rc -O coff -i C:\SYNTHE~1\TD_SV\TD_SV.rc -o obj\Release\TD_SV\TD_SV.res
x86_64-w64-mingw32-g++.exe -shared -Wl,--output-def=bin\Release\libTD_SV -Wl,--out-implib=bin\Release\libTD_SV -Wl,--dll  obj\Release\se_sdk3\mp_sdk_audio.o obj\Release\se_sdk3\mp_sdk_common.o obj\Release\TD_SV\SV.o  obj\Release\TD_SV\TD_SV.res  -o bin\Release\TD_SV.sem -Wl,--kill-at  -static-libgcc -m32  -luser32 
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `obj\Release\TD_SV\TD_SV.res' is incompatible with i386 output
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 2 seconds)
0 errors, 2 warnings (0 minutes, 2 seconds)

My resource file(TD_SV.rc) seems to be the error:

TD_SV.res' is incompatible with i386 output

I've been googling for hours and the closest I got to a solution is here:

http://backyardcode.com/

He suggests this script - but I can't figure out how to change it to suit my needs - Any help appreciated!

$rescomp [[ if(GetProjectManager().GetActiveProject().GetActiveBuildTarget().Matches(_T("Debug32")) || GetProjectManager().GetActiveProject().GetActiveBuildTarget().Matches(_T("Release32"))) { print(_T("-D USE_X86_MODE -F pe-i386")); } ]] -i $file -J rc -o $resource_output -O coff $res_includes

Also - is there any TDM-GCC (pre-built/installer type) alternatives? All I really need is 32bit build with graphite options. Also using CodeBlocks IDE.

Regards Andrew

Swaddle answered 14/9, 2013 at 18:40 Comment(3)
It is not very clear what you're trying to accomplish. Did you have problems installing TDM-GCC 32bit? You said you think your .rc file may be the culprit: you should post it (or a shortened form that displays the problem). What do you mean by "windres is not in the right format"? windres is the GCC Windows resource compiler, not a data/text/source file which "has a format". Try to be clearer.Whirly
Hey Lorenzo - I got the problem sorted out - I just unistalled TDM-GCC, it was generating 64bit resources with a -m32 build! I replaced it with a w64 build from mingwbuilds - and it works perfectly now. TDM-GCC is not very standardised - IMHO. Thanks for trying to help, much appreciated!Swaddle
You're welcome. Yep, TDM-GCC 32 bit is quite good, but 64 bit version has issues.Whirly
S
7

To see all possble windres parameters, you can request help:

x86_64-w64-mingw32-windres.exe --help

For Windows 32 bit format you need coff format with pe-i386 target.

Basically, you have to add -F pe-i386 (or --target=pe-i386) after -O coff flag to your command line if you generate it manually.

In GNU autotools it's about the RCFLAGS. So if there's some configure script, just add

./configure RCFLAGS="--output-format=coff --target=pe-i386" ........

Suppression answered 10/11, 2013 at 21:1 Comment(1)
Apparently, not all configure scripts support RCFLAGS. In this case, WINDRES='windres --output-format=coff --target=pe-i386' ./configure might help.Confab

© 2022 - 2024 — McMap. All rights reserved.