Having problems with v3.1.2 and mingw

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Blinkinhek
Experienced Solver
Experienced Solver
Posts: 91
Joined: Tue Aug 16, 2005 10:54 am

Having problems with v3.1.2 and mingw

Post by Blinkinhek »

I have just downloaded wxWidgets 3.1.2 and the libraries were produced without any problems. However, when I tried to compile the simple program from the Code::Blocks wxWidgets wizard I got a linker error message for all the libraries used by the program.
eg "...skipping incompatible C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31ud_core.a when searching for -lwxmsw31ud_core"

I am using the same mingw compiler/linker as used in creating the libraries in the first place.
What am I missing?

TIA
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Having problems with v3.1.2 and mingw

Post by ONEEYEMAN »

Hi,
How did you compile the library and what options did you use in C::B?

Thank you.
Blinkinhek
Experienced Solver
Experienced Solver
Posts: 91
Joined: Tue Aug 16, 2005 10:54 am

Re: Having problems with v3.1.2 and mingw

Post by Blinkinhek »

I have a separate mingw setup, rather than the CB one. So, in CB the Toolchain Executeables are all set to point to my mingw setup, which is also listed in the Windows PATH statement. After downloading wxWidgets 3.1.2, I simply went to the build\msw directory and ran mingw32-make on makefile.gcc. I repeated that with the BUILD=release option. All appears to have gone ok, as all the libs appeared.

When using CB, I set the Globale Variable editor base field to C:\wxWidgets-3.1.2 and then used the wizard and pointed to a 3.1.x project and created the project.

I have not, as far as I know twiddled with any other settings = which may be the issue!

I am using mingw64 (so my linker executable is x86_64-w64-mingw32-g++.exe )
My setup of the mingw may be the actual issue.
I installed this new one, rather than use the CB-included mingw as I am trying to get a working program to use touchpad/gestures, and the CB setup did not like the 3.1.2 new stuff around themes and gestures.
I probably need to start stepping back :(
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Having problems with v3.1.2 and mingw

Post by ONEEYEMAN »

Hi,
Keep in mind that when compiling your code all options has to match the ones you used for compilinmg the library.

So it is better to explicitly set the compilation options when compiling the library (debug vs release, monolithic vs multi-lib, etc), so that there will be no mismatches when building your own code.

Thank you.
Blinkinhek
Experienced Solver
Experienced Solver
Posts: 91
Joined: Tue Aug 16, 2005 10:54 am

Re: Having problems with v3.1.2 and mingw

Post by Blinkinhek »

I reverted to wxWidgets 3.0.4, and rebuilt the libraries using the mingw64, which appeared to have been produced without error.
I created the CB wxWidgets demo again, and using the mingw64 again, instead of the mingw that came with CB, I get the same error messages on compiling
eg "../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\wxWidgets-3.0.4\lib\gcc_lib/libwxmsw30ud_core.a when searching for -lwxmsw30ud_core"

So it seems to me that my mingw64 setup is wrong somehow .... <sigh>
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Having problems with v3.1.2 and mingw

Post by PB »

I am not really familiar with MinGW but it looks as a compiler/linker mismatch.

First, I advise against putting any compiler toolchains into PATH% I believe this is not a good idea.

Second, are you trying to build 32- or 64 bit (it seems it is 64-bit)? Is the compiler toolchain you set selected in the project's build options? I would make sure I am not mixing compilers for 32- and 64-bits and removed any GCC-based compiler toolchains from the PATH (using where gcc.exe from command line to make sure). TBH, I do not know if you can switch between 32- and 64-bit targets with the same compiler toolchain using -m32 and -m64 command line switches (take a look if any of the two is checked on in project build options / Compiler Settings / Compiler Flags in C:B.

FWIW, this is my compiler setup for 32-bit MinGW-w64 (i686-8.1.0-posix-dwarf-rt_v6-rev0)
cbcmplr.png
cbcmplr.png (53.24 KiB) Viewed 2294 times
I have built wxWidgets 3.1.2 in static Debug and Release configurations with a batch file looking something like this

Code: Select all

set PATH=C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%

cd %WXWIN%\build\MSW

REM debug static
mingw32-make -f makefile.gcc BUILD=debug CXXFLAGS="-std=c++17" setup_h
mingw32-make -j2 -f makefile.gcc BUILD=debug CXXFLAGS="-std=c++17"
IF %ERRORLEVEL% NEQ 0 goto FAIL:

REM release static
mingw32-make -f makefile.gcc BUILD=release CXXFLAGS="-std=c++17" setup_h
mingw32-make -j2 -f makefile.gcc BUILD=release CXXFLAGS="-std=c++17"
IF %ERRORLEVEL% NEQ 0 goto FAIL:

goto SUCCESS:

:FAIL
echo Build failed!
pause
goto :FINISHED

:SUCCESS

:FINISHED
Blinkinhek
Experienced Solver
Experienced Solver
Posts: 91
Joined: Tue Aug 16, 2005 10:54 am

Re: Having problems with v3.1.2 and mingw

Post by Blinkinhek »

Thank you for that - and you are right that there are mismatches between 64bit and 32bit.
Based on your screenshot, I installed mingw-64 as 32bit and repeated the demo compile. Things have moved on and the linker is giving a different error message:
C:\wxWidgets-3.0.4\lib\gcc_lib/libwxbase30ud.a(baselib_convauto.o): In function `ZNK10wxConvAuto7ToWCharEPwjPKcj':
C:\wxWidgets-3.0.4\build\msw/../../src/common/convauto.cpp:272: undefined reference to `__gxx_personality_sj0'
C:\wxWidgets-3.0.4\build\msw/../../src/common/convauto.cpp:272: undefined reference to `_Unwind_SjLj_Register'
C:\wxWidgets-3.0.4\build\msw/../../src/common/convauto.cpp:321: undefined reference to `_Unwind_SjLj_Resume'
C:\wxWidgets-3.0.4\build\msw/../../src/common/convauto.cpp:321: undefined reference to `_Unwind_SjLj_Unregister'

not quite sure what the libwxbase30ud is missing though - but possibly I should have chosen the sjlj option on install
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Having problems with v3.1.2 and mingw

Post by ONEEYEMAN »

Hi,
Check here.

Thank you.
Blinkinhek
Experienced Solver
Experienced Solver
Posts: 91
Joined: Tue Aug 16, 2005 10:54 am

Re: Having problems with v3.1.2 and mingw

Post by Blinkinhek »

Yes, installed the sjlj option on mingw32. 3.0.4 working now .... so will re-try 3.1.2
Post Reply