Opened 14 months ago

Last modified 13 months ago

#15601 confirmed build error

Add RCFLAGS support to MinGW makefiles

Reported by: csteenwyk Owned by:
Priority: low Milestone:
Component: build Version: 3.0.0
Keywords: mingw, windres, bakefile Cc:
Blocked By: Blocking:
Patch: no

Description

Add the ability to pass arguments to windres in makefile.gcc by:

Add 'RCFLAGS' to makefile.gcc and config.gcc

Add option '$(RCFLAGS)' to all windres lines in makefile.gcc.

eg: windres --use-temp-file -i$< -o$@ $(RCFLAGS) ...

Without this using the w64 version of MinGW with the -m32 build will run windres in x64 mode. Using the RCFLAGS parameter you can pass the options to specify x86 mode.

Attachments (3)

config.gcc.patch download (119 bytes) - added by csteenwyk 14 months ago.
makefile.gcc.patch download (25.4 KB) - added by csteenwyk 14 months ago.
makefile.gcc.2.patch download (25.5 KB) - added by csteenwyk 14 months ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 14 months ago by vadz

  • Status changed from new to infoneeded_new

Sorry, what exactly is the problem? I.e. what are you doing and what happens, what errors are you getting?

And if you could describe more precisely what do you suggest to be done to avoid it (ideally attach a simple patch with your proposed changes), it would be very helpful as well.

TIA!

Changed 14 months ago by csteenwyk

Changed 14 months ago by csteenwyk

Changed 14 months ago by csteenwyk

comment:2 follow-up: Changed 14 months ago by csteenwyk

  • Status changed from infoneeded_new to new

Specifically I am trying to comiple using MinGW 4.8 w64 in 32-bit mode.

Details:
MinGW 4.8 w64 compiles, links, and generates windows resource files in 64-bit mode by default. To generate 32-bit binaries you must specify 32-bit mode using the -m32 option. In build/msw/config.gcc you can make the following modifications to specify -m32:

CFLAGS=-m32
CXXFLAGS=-m32
LDFLAGS=-m32

Unfortunately there is no flag to modify the default behavior of the windows resource compiler ('windres') and you get errors similar to the following for every .rc.o file:

c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw3
2/bin/ld.exe: i386:x86-64 architecture of input file `gcc_mswuddll32\basedll_ver
sion_rc.o' is incompatible with i386 output
collect2.exe: error: ld returned 1 exit status
mingw32-make: * [..\..\lib\gcc_dll32\wxbase294ud_gcc_32bits.dll] Error 1

To overcome this you can pass '-F pe-i386' to the command lines to windres, but there is no way to do that without directly modifying makefile.gcc.

So, I modified build/msw/config.gcc to add a configuration parameter RCFLAGS, and then modified build/msw/makefile.gcc to use this variable in all windres commands.

See attachments:
config.gcc.patch
makefile.gcc.2.patch

comment:3 in reply to: ↑ 2 Changed 14 months ago by neis

Unfortunately there is no flag to modify the default behavior of the windows resource compiler ('windres')

Not sure about this specific case (since I didn't download the source and files and look at them), but it's generally helpful to keep in mind that it might be possible to add the flags to the name of the binary itself, e.g. by setting something like WINDRES="windres -F pe-i386" without requiring a separate variable for the flags.

comment:4 Changed 14 months ago by vadz

  • Keywords bakefile added; x64 removed
  • Milestone 3.0 deleted
  • Priority changed from normal to low
  • Status changed from new to confirmed
  • Summary changed from Support for x86 using MinGW w64 4.8.1 to Add RCFLAGS support to MinGW makefiles

Unfortunately we don't even have a WINDRES variable, right now it's hardcoded in the makefile. I'm going to add such a variable for now, support for RCFLAGS will be done later, when we switch to new bakefile.

comment:5 Changed 14 months ago by VZ

(In [75074]) Make windres command used in MinGW build configurable.

This allows to pass extra arguments to windres, which is especially important
when using 64 bit windres for building 32 bit applications as the generated .o
file uses a wrong architecture unless "-F pe-i386" is explicitly specified.

See #15601.

comment:6 Changed 13 months ago by vadz

  • Version changed from 3.0.0-rc1 to 3.0.0

Just changing version as these tickets are still present in 3.0.0. final.

Note: See TracTickets for help on using tickets.