Page 1 of 2

Resource Compiler broken - looking for work-around

Posted: Thu Apr 29, 2021 7:53 pm
by MeerMusik

Hello.

As the Resource Compiler ignores the existing *.RC File and also the wx.rc File, it constantly links against the default-manifest.o

After already loosing 3 Days, I found out that I have to manually enable the usage of the Resource Compiler in the Project File, as there is no Checkbox to enable / disable it from within the IDE. Unfortunately the Resource Compiler still does nothing. Not sure if this is correctly modified:

Code: Select all

<ResourceCompiler Options="-i /c/Dev/CodeLiteWorkspaceTest/CodeLiteWorkspaceTest/wxWidgetsTest/wxWidgetsTest.exe.rc -O coff -o /c/Dev/CodeLiteWorkspaceTest/CodeLiteWorkspaceTest/wxWidgetsTest/wxWidgetsTest.exe.res" Required="yes"/>

While trying to get this to work somehow, I added a Pre-Build Command:

Code: Select all

windres -i /c/Dev/CodeLiteWorkspaceTest/CodeLiteWorkspaceTest/wxWidgetsTest/wxWidgetsTest.exe.rc -O coff -o /c/Dev/CodeLiteWorkspaceTest/CodeLiteWorkspaceTest/wxWidgetsTest/wxWidgetsTest.exe.res

1 Step done. Now I need to tell G++ somehow to use the RC File. If I simply add 'wxWidgetsTest.exe.rc' as a Compiler Flag, I always end with the error

Code: Select all

linker input file unused because linking not done

And yes, the wxWidgets.exe.manifest and the contained Version Info are working correctly, if I add the Resource File manually to basic C++ File. It is only a Problem with CodeLite IDE ignoring the File.

System Config:

  • Windows 10 20H2, x86_64
  • MSYS2, MinGW-w64, 10.2.0, x86_64
  • CodeLite 15.0.2, x86_64

Any hint is greatly appreciated as I am literally since 3 Days stuck with a blurry Application and outdated Windows Version compatibility Infos.
Thank you!
Oliver


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 12:21 am
by MeerMusik

Just be to absolutely sure that the Resource File and the Manifest are working 100 percent, I also added both Files to a Test Example from within the IDE of a more-or-less competing Project and yes, the Files are working and getting linked into the executable just fine. The IDE also has auto-handling of Resource Files after adding the File to the Project. The Resource Compiler in CodeLite is definitely broken in one way or another.

As my CodeLite knowledge is still very thin, I am out of Ideas for now. Again, any Hint what I could modify, to force G++ to link against the Resource File, is welcome. Thank you in Advance!


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 9:31 am
by eranif

can you zip your sample project and upload it here?
we do use .rc files (even within CodeLite itself)
so I wonder whats the differences


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 2:31 pm
by MeerMusik
eranif wrote: Sat May 01, 2021 9:31 am

can you zip your sample project and upload it here?
we do use .rc files (even within CodeLite itself)
so I wonder whats the differences

Hello.

Attached is a (now totally messy) wxWidgets Hello World Tutorial copied together from the wxWidgets Wiki. So please ignore the overall Mess if you can. If you need additional Files let me know. File Format is 7Zip.

Thanks for looking into this. I just found out that you have switched to wxWidgets 3.1.5 - I will try to install an older CodeLite Version and see if this Issue exists there (if this is the cause of the Issue). Something different: Are you aware that the "Settings -> LLDB Settings..." Widgets are minimized without the possibility to resize them? Only the Vertical Slider(?) under the "Types" Tab works. Only tested on Windows. I am not using it anyway so no Priority for me. But I can create another Bug Report if necessary.

EDIT01: With i.e. 13.0.8, the Resource Compiler picks up the Resource File and puts it in the build Directory as

Code: Select all

wxWidgetsTest.exe.rc.o

but the whole Process ends up with the Error

Code: Select all

mkdir cannot create Directory 'Release': File exists

as it tries to put everything under

Code: Select all

C:\Dev\CodeLiteWorkspaceTest\CodeLiteWorkspaceTest\wxWidgetsTest\Release

With Version 15.0.0+ the build happens under

Code: Select all

C:\Dev\CodeLiteWorkspaceTest\CodeLiteWorkspaceTest\build-Release\wxWidgetsTest

Seems something does not get picked up correctly at some point.

Also the above first Error could be because I downgraded from 15.0.2 -> 14.0.4 -> etc. and everything in between down to 13.0.8 and the Project File is probably even more messy by now. I will create a basic Project in 13.0.8 later to test this more thoroughly. Need my Breakfast first.

Just as a FYI: The LLDB Widgets are broken (size-wise) in those Versions as well.


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 4:38 pm
by eranif

Thanks for uploading the project.
I opened and cleaned it from all the hard coded values you used here...

and it compiles fine. Here is the build output:

Code: Select all

C:/compilers/mingw64/bin/mingw32-make.exe -j24 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ wxWidgetsTest - Release ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Eran/Downloads/TestResource/wxWidgetsTest'
C:/compilers/mingw64/bin/windres.exe -i "C:/Users/Eran/Downloads/TestResource/wxWidgetsTest/wxWidgetsTest.exe.rc" --define __WXMSW__ --define _UNICODE --include-dir C:/src/wxWidgets/lib/gcc_dll/mswu --include-dir C:/src/wxWidgets/include --define WXUSINGDLL    -o ../build-Release/wxWidgetsTest/wxWidgetsTest.exe.rc.o
C:/compilers/mingw64/bin/g++.exe  -c  "C:/Users/Eran/Downloads/TestResource/wxWidgetsTest/HelloWorldApp.cpp" -Wfatal-errors -std=c++11 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/src/wxWidgets/lib/gcc_dll/mswu -IC:/src/wxWidgets/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -o ../build-Release/wxWidgetsTest/HelloWorldApp.cpp.o -I.
C:/compilers/mingw64/bin/g++.exe -o ..\build-Release\bin\wxWidgetsTest @../build-Release/wxWidgetsTest/ObjectsList.txt -L.   -mwindows  -mthreads -LC:/src/wxWidgets/lib/gcc_dll -lwxmsw31u_richtext -lwxmsw31u_xrc -lwxmsw31u_aui -lwxmsw31u_html -lwxmsw31u_adv -lwxmsw31u_core -lwxbase31u_xml -lwxbase31u_net -lwxbase31u -lwxscintilla -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lversion -lshlwapi -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -luxtheme -loleacc
mingw32-make.exe[1]: Leaving directory 'C:/Users/Eran/Downloads/TestResource/wxWidgetsTest'
====0 errors, 0 warnings====

The main difference between my settings and your:

  • I used MinGW native compiler while you are using MSYS one
  • I used wx-config to get all the values I need.

For example, the in the project settings -> compiler -> c++ compiler options the only value I have is this: -std=c++11;-Wall;$(shell wx-config --cflags)
Under project settings -> resources -> Resources compiler options I have set this: $(shell wx-config --rcflags)

Attached is the fixed workspace

TestResource.7z

Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 7:44 pm
by MeerMusik

Thanks for looking into this. There are some Problems here:
1.) '--rcflags' does not exist and looking through the Web, it seems to be on purpose. Need to find out how to add it on Windows with MSYS2
2.) As I am using MSYS2, CodeLite only compiles when I use the Unix based Makefile Generator - otherwise it instantly errors out with "/bin/sh: -c: line 2: syntax error: unexpected end of file" - it does not play nice with the Unix based Line Endings.

It seems that the Resource Compiler is working correctly but that disabling the 'windres.exe' is hardcoded somewhere somehow.

I removed all Compiler Settings and readded them. Here are the Results to create the wxWidgetsTest:

A.) CodeLite Makefile Generator:
(Opened an external cmd.exe so of course it cant find the WXWIN etc. Settings)

Code: Select all

C:/Dev/msys64/mingw64/bin/mingw32-make.exe -j32 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ wxWidgetsTest - Release ]----------"

Please use the --prefix flag (as in wx-config --prefix=C:/wxWidgets)
or set the environment variable WXWIN (as in WXWIN=C:/wxWidgets)
to specify where is your installation of wxWidgets.

Please use the --prefix flag (as in wx-config --prefix=C:/wxWidgets)
or set the environment variable WXWIN (as in WXWIN=C:/wxWidgets)
to specify where is your installation of wxWidgets.
mingw32-make[1]: Entering directory 'C:/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest'
C:/Dev/msys64/mingw64/bin/windres.exe -i "C:/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest/wxWidgetsTest.exe.rc"    -o ../build-Release/wxWidgetsTest/wxWidgetsTest.exe.rc.o
/usr/bin/sh: -c: line 2: syntax error: unexpected end of file
/usr/bin/sh: -c: line 2: syntax error: unexpected end of file
mingw32-make[1]: *** [wxWidgetsTest.mk:88: MakeIntermediateDirs] Error 2
mingw32-make[1]: *** Waiting for unfinished jobs....
mingw32-make[1]: *** [wxWidgetsTest.mk:92: ../build-Release/wxWidgetsTest/.d] Error 2
/usr/bin/sh: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/sh: -c: line 2: syntax error: unexpected end of file
mingw32-make[1]: *** [wxWidgetsTest.mk:103: ../build-Release/wxWidgetsTest/HelloWorldApp.cpp.o.d] Error 2
C:\Dev\msys64\mingw64\bin\windres.exe: ../build-Release/wxWidgetsTest/wxWidgetsTest.exe.rc.o: No such file or directory
mingw32-make[1]: *** [wxWidgetsTest.mk:109: ../build-Release/wxWidgetsTest/wxWidgetsTest.exe.rc.o] Error 1
mingw32-make: *** [Makefile:5: All] Error 2
mingw32-make[1]: Leaving directory 'C:/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest'
====0 errors, 0 warnings====

B.) Switched from CodeLite Makefile Generator -> CodeLite Makefile Generator - UNIX (without changing from mingw32-make -> make). You can see that the call of 'windres.exe' is missing - even if we still calling mingw32-make.

Code: Select all

C:/Dev/msys64/mingw64/bin/mingw32-make.exe -j32 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ wxWidgetsTest - Release ]----------"

Please use the --prefix flag (as in wx-config --prefix=C:/wxWidgets)
or set the environment variable WXWIN (as in WXWIN=C:/wxWidgets)
to specify where is your installation of wxWidgets.

Please use the --prefix flag (as in wx-config --prefix=C:/wxWidgets)
or set the environment variable WXWIN (as in WXWIN=C:/wxWidgets)
to specify where is your installation of wxWidgets.
mingw32-make[1]: Entering directory 'C:/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest'
/usr/bin/sh: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/sh: -c: line 2: syntax error: unexpected end of file
mingw32-make[1]: *** [wxWidgetsTest.mk:101: ../build-Release/wxWidgetsTest/HelloWorldApp.cpp.o.d] Error 2
mingw32-make[1]: *** Waiting for unfinished jobs....
mingw32-make: *** [Makefile:5: All] Error 2
mingw32-make[1]: Leaving directory 'C:/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest'
====0 errors, 0 warnings====

C.) After changing the Path to MSYS2 'make.exe' and also re-adding the correct Path to 'mkdir' it compiles as it should except that neither wx.rc nor my RC File gets linked into the executable - obviously as UNIX is defined.

Code: Select all

C:/Dev/msys64/usr/bin/make.exe -j32 -e -f  Makefile
----------Building project:[ wxWidgetsTest - Release ]----------
make[1]: Entering directory '/c/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest'
C:/Dev/msys64/mingw64/bin/g++.exe  -c  "C:/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest/HelloWorldApp.cpp" -static -static-libgcc -static-libstdc++ -Wfatal-errors -std=c++11 -Wall -IC:/Dev/Sources/wxWidgetsx64Release/lib/wx/include/msw-unicode-static-3.1 -IC:/Dev/Sources/wxWidgetsx64Release/include/wx-3.1 -D__WXMSW__ -pthread -D__WXMSW__ -DNDEBUG -D_UNICODE -DUNICODE -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS  -o ../build-Release/wxWidgetsTest/HelloWorldApp.cpp.o -I. -IC:/Dev/Sources/wxWidgetsx64Release/include/wx-3.1 -IC:/Dev/Sources/wxWidgetsx64Release/lib/wx/include/msw-unicode-static-3.1 -IC:/Dev/msys64/mingw64/x86_64-w64-mingw32/include -IC:/Dev/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.2.0/include -IC:/Dev/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32 -IC:/Dev/msys64/mingw64/include/c++/10.2.0
C:/Dev/msys64/mingw64/bin/g++.exe -o ..\build-Release\bin\wxWidgetsTest @../build-Release/wxWidgetsTest/ObjectsList.txt -L.   -mwindows -static -LC:/Dev/Sources/wxWidgetsx64Release/lib -pthread C:/Dev/Sources/wxWidgetsx64Release/lib/libwx_mswu_xrc-3.1.a C:/Dev/Sources/wxWidgetsx64Release/lib/libwx_mswu_qa-3.1.a C:/Dev/Sources/wxWidgetsx64Release/lib/libwx_baseu_net-3.1.a C:/Dev/Sources/wxWidgetsx64Release/lib/libwx_mswu_html-3.1.a C:/Dev/Sources/wxWidgetsx64Release/lib/libwx_mswu_core-3.1.a C:/Dev/Sources/wxWidgetsx64Release/lib/libwx_baseu_xml-3.1.a C:/Dev/Sources/wxWidgetsx64Release/lib/libwx_baseu-3.1.a -lwx_mswu_core-3.1 -lwxjpeg -lwxpng -lwxtiff -lwx_baseu-3.1 -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme -lwxzlib -lwxregexu  -lssp
make[1]: Leaving directory '/c/Dev/CodeLiteWorkspaceTest/RCTest111/wxWidgetsTest'
====0 errors, 0 warnings====

The Question now is: Is there a way to overwrite a Macro, Flag or whatever it is, to force the call of windres.exe or am I out of luck here.

Well Sorry for wasting your time. I had a lot of IDE's and being using MinGW-w64 and MSYS2 MinGW-w64 for multiple years (with breaks inbetween) and never had that Issue. So I assumed it is another Bug in CodeLite.

Thanks again!
Oliver


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 7:47 pm
by eranif

Yes, the CodeLite Makefile Generator - UNIX generates Makefiles that are compatible with MSYS environment (i.e. bash)
the one without the -UNIX suffix, generates with Windows native paths and slashes (\)

Let me check the code for the latter generator, it might be omitting the resource compiler part


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 7:51 pm
by eranif

OK, quick checking in the code seems that:

BuilderGnuMakeMSYS subclassing BuilderGnuMake:

Code: Select all

BuilderGnuMakeMSYS::BuilderGnuMakeMSYS()
{
    m_name = "CodeLite Makefile Generator - UNIX";
    m_isWindows = false;
}

BuilderGnuMakeMSYS::BuilderGnuMakeMSYS(const wxString& name, const wxString& buildTool,
                                       const wxString& buildToolOptions)
    : BuilderGnuMake(name, buildTool, buildToolOptions)
{
    m_isWindows = false;
}

BuilderGnuMakeMSYS::~BuilderGnuMakeMSYS() {}

somewhere in the BuilderGnuMake, we have this check:

Code: Select all

        if(ft.kind == Compiler::CmpFileKindResource && !m_isWindows) {
            continue;
        }

which skips resource compiler
I will fix this


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 7:53 pm
by eranif

Quick question: did you compiler wxWidgets your self, or did you download a pre-built package?
Can you share the download link so I can test it locally? (assuming you downloaded it from somewhere on the web)


Re: Resource Compiler broken - looking for work-around

Posted: Sat May 01, 2021 8:11 pm
by eranif

With my latest fix, resource is now compiled successfully using MSYS, see below:

Code: Select all

C:/msys64/usr/bin/make.exe -j24 -e -f  "wxcHelloWorldFrame.mk"  MakeIntermediateDirs && C:/msys64/usr/bin/make.exe -j24 -e -f  "wxcHelloWorldFrame.mk"  ../build-Debug/wxcHelloWorldFrame/win_resources.rc.o
----------Building project:[ wxcHelloWorldFrame - Debug ] (Single File Build)----------
C:/msys64/usr/bin/windres.exe -i "C:/Users/Eran/Documents/HelloWorld/wxcHelloWorldFrame/win_resources.rc" --define __WXMSW__ --define _UNICODE --include-dir C:/src/wxWidgets/lib/gcc_dll/mswu --include-dir C:/src/wxWidgets/include --define WXUSINGDLL    -o ../build-Debug/wxcHelloWorldFrame/win_resources.rc.o
C:/msys64/usr/bin/windres: warning: 24: 1: 1033: duplicate value
====0 errors, 0 warnings====