Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-09-01
16:12 • Ticket [448ba5cbfd] MINGW build fails for 32bit on 64bit system status still... artifact: 44aa2cc1ec user: dkf
2015-07-13
08:24 • Ticket [448ba5cbfd]: 3 changes artifact: 5c6850776b user: jan.nijtmans
2015-07-11
09:58 • Ticket [448ba5cbfd]: 3 changes artifact: 1defdfc871 user: anonymous
2015-07-10
08:56 • Ticket [448ba5cbfd]: 5 changes artifact: bccecf7ecd user: jan.nijtmans
08:16 • New ticket [448ba5cbfd]. artifact: e37c6555a7 user: anonymous

MINGW build fails for 32bit on 64bit system

Open448ba5cbfda349b1e71b5193a50f746c84641410Created 11 years agoUpdated 10 years ago
Descriptionplain2015-07-10 08:16:41
I am building Tcl using MSYS2 and the TDM-GCC compiler. This works for 64 bit, if additionally --enable-64bit is passed, or for the static build. With this gcc version, it is also possible to build 32 bit by passing 

CFLAGS="-m32" LDFLAGS="-m32"

to the configure script, but it fails for two reasons. 
1. Linking to the precompiled zlib does not work
This can be circumvented by hacking the configure script to always build zlib (ZLIB_OBJ instead of ZLIB_DLL)

2. the resource compiler creates 64bit objects. 
This can be solved by passing --output-format=coff --target=pe-i386 to windres. But the configure script or Makefile doesn't honour RCFLAGS, so it is impossible to do that without hacking the Makefile

SUggested solution: 1. Always build the zlib objects. Why does the build system try to link with precompiled binaries? That would solve both zlib issues. 
2. Insert RCFLAGS into configure.in and Makefile.in
jan.nijtmanswiki2015-07-10 08:56:34

Since, effectively, this ticket is asking for support for the TDM gcc compiler, this is not a bug but a feature request. Since everything works out-of-the box with mingw32 and mingw-w64, it could as well be considered a bug in the TDM 32-bit compiler. Was it reported to TDM-gcc as well?

That said, introducing RCFLAGS looks like a good idea anyway, I'll have a look at that. But "Linking to the precompiled zlib does not work" sounds like a bug in TDM-gcc that should be reported there. Most likely, the binutils delivered by TDM doesn't support the COFF format, while binutils supplied by mingw32/mingw-w64 works just fine.

There is a workaround for the binutils problem in a branch, see: http://core.tcl.tk/tcl/info/f4b66e37c780769fd29a2e7449ffa20c5ecd7818 Does that work better for you?

See also bug [b5ced5865b] (this issue is probably a duplicate of that one, but I'm not sure while TDM isn't mentioned anywhere)

anonymousplain2015-07-11 09:58:35
The issue was not reported to TDM-gcc, because I haven't seen it as a failure of that particular compiler. Nevertheless, linking to the DLL directly also seems to work for the zlib problem. Still, without RCFLAGS, it can't be possible to create 32bit builds on a 64bit standard install, because the windres call has no arguments indicating a 32bit build. 

Actually, all I'm trying to do is to find an installation of MSYS / MINGW that is able to compile Tcl for both 32bit and 64bit, and so far it has been a painful experience. I installed several different distributions of the mingw compiler, and all failed and different points in the build process. I'm starting afresh now. Is there a recommended download of build tools?
jan.nijtmanswiki2015-07-13 08:24:13

Here is more info from other people: http://wiki.tcl.tk/14828

I'm using either the unmodified installer from mingw.org, or I cross-compile on Cygwin or Ubuntu. Instructions are here: http://core.tcl.tk/tcl/artifact/f783ead8576ad16c?ln=14-81

If something in those instructions is not correct any more, or is not clear enough, feel free to supply suggestions how to improve it.

dkf Ticket [448ba5cbfd]: 3 changes [History diff]2016-09-01 16:12:52
Log in (anonymous is fine) to add a comment.