Skip to content

[tools] Fix mingw toolchain rc file handling#1285

Merged
Aidan63 merged 1 commit into
HaxeFoundation:masterfrom
tobil4sk:fix/mingw-rc
Jul 1, 2026
Merged

[tools] Fix mingw toolchain rc file handling#1285
Aidan63 merged 1 commit into
HaxeFoundation:masterfrom
tobil4sk:fix/mingw-rc

Conversation

@tobil4sk

@tobil4sk tobil4sk commented Jan 3, 2026

Copy link
Copy Markdown
Member

Currently, the toolchain just passes the .rc file to the c++ compiler which results in the following warning:

 - Running command: x86_64-w64-mingw32-g++ -c -Wno-overflow -g -O2 -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHX_SMART_STRINGS -DHXCPP_API_LEVEL=430 -DHX_WINDOWS -m64 -DHXCPP_M64 -I/.../hxcpp/include ./ApplicationMain.rc -o/.../HelloWorld/Export/windows/obj/obj/mingw64-nc/20eab515_ApplicationMain.o
x86_64-w64-mingw32-g++: warning: ./ApplicationMain.rc: linker input file unused because linking not done

This means no object file is generated for the .rc, so this is followed by an error during link time:

 - Link: ApplicationMain.exe: x86_64-w64-mingw32-g++ -o ApplicationMain.exe -Wl,--enable-auto-import -mwindows -m64 -L/usr/x86_64-w64-mingw32/lib/libs @obj/mingw64-nc/all_objs -lws2_32
/usr/lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find obj/mingw64-nc/20eab515_ApplicationMain.o: No such file or directory
collect2: error: ld returned 1 exit status
Error: Error while running command
x86_64-w64-mingw32-g++ -o ApplicationMain.exe -Wl,--enable-auto-import -mwindows -m64 -L/usr/x86_64-w64-mingw32/lib/libs @obj/mingw64-nc/all_objs -lws2_32

windres is a utility that's part of mingw for processing .rc files, so that should be used here. We want to generate .o files instead of .res files like with msvc, since mingw cannot process .res files.

With this patch it is possible to build a haxe app using -D resourceFile=ApplicationMain.rc without linking errors. It is possible to verify that the resource has been added correctly, for example if the company name has been set:

exiftool bin/HelloWorld.exe | grep -i company

@tobil4sk tobil4sk changed the title Fix mingw toolchain rc file handling [tools] Fix mingw toolchain rc file handling Jan 7, 2026
@tobil4sk

tobil4sk commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

@Aidan63 Would it also be possible to merge this one as well? The scope is limited to mingw and it allows resource files to work like they already do on msvc builds.

@Aidan63 Aidan63 merged commit d779ec2 into HaxeFoundation:master Jul 1, 2026
133 checks passed
@tobil4sk tobil4sk deleted the fix/mingw-rc branch July 1, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants