Compiling statically linked app with wxwidgets Topic is solved

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
NoeMurr
Knows some wx things
Knows some wx things
Posts: 32
Joined: Sat Mar 31, 2018 2:26 pm

Compiling statically linked app with wxwidgets

Post by NoeMurr »

Hi all,

I'm trying to compile an application statically in windows 10, I've already compiled wxWidgets 3.0.4 with the command:

Code: Select all

mingw32-make -j4 -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 RUNTIME_LIBS=static BUILD=release VENDOR=custom SHELL=CMD.exe
The problem is that now when I compile my application the linker cannot find the references to all the wxwidgets components. Where is the static library of wxwidgets located under windows 10 compiled with MinGW gcc?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Compiling statically linked app with wxwidgets

Post by PB »

It's in WXWIN/lib/gcc_lib

BTW those UNICODE and RUNTIME_LIBS parameters have no actual effect. The former is default, the latter is only for MSVC.

Make sure the build finished successfully and the libraries are actually there.
NoeMurr
Knows some wx things
Knows some wx things
Posts: 32
Joined: Sat Mar 31, 2018 2:26 pm

Re: Compiling statically linked app with wxwidgets

Post by NoeMurr »

The compilation seems to be completed without errors... but in the lib/gcc_lib I've only theese files:
  • libwxexpat.a
  • libwxjpeg.a
  • libwxpng.a
  • libwxregexu.a
  • libwxscintilla.a
  • libwxtiff.a
  • libwxzlib.a
and a directory mswu with:

Code: Select all

mswu
│   libwxexpat.a
│   libwxjpeg.a
│   libwxpng.a
│   libwxregexu.a
│   libwxscintilla.a
│   libwxtiff.a
│   libwxzlib.a
│
└───mswu
    │   build.cfg
    │
    └───wx
        │   setup.h
        │
        └───msw
                rcdefs.h
I prepare the makefile with cmake (that doesn't show problems) and the program compiles without errors, but in linking phase all the wxwidgets references can not be found...
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Compiling statically linked app with wxwidgets

Post by PB »

As you can see in your list, the main wxWidgets library (as well as the Open GL one) is not there. For the static monolithic release build, the files in the lib folder should be
libwxexpat.a
libwxjpeg.a
libwxmsw30u.a
libwxmsw30u_gl.a

libwxpng.a
libwxregexu.a
libwxscintilla.a
libwxtiff.a
libwxzlib.a
You need to take a look at the build output, the last messages there in particular.

If you really used only the command you posted above, that usually does not work. If you want to use parallel bulds with gcc, you need to build the setup_h target first.

But there can be other issue, the only way to know is checking the build output...
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Compiling statically linked app with wxwidgets

Post by ONEEYEMAN »

Hi,
Also, keep in mind that using monolithic, while supported, does not give any advantages. But produces more headaches in the long run.
Also, it is always better to have wxWidgets compiled in both DEBUG and RELEASE modes and start with the former in order to be sure that everything works as it should.

Thank you.
NoeMurr
Knows some wx things
Knows some wx things
Posts: 32
Joined: Sat Mar 31, 2018 2:26 pm

Re: Compiling statically linked app with wxwidgets

Post by NoeMurr »

thanks to all,

there was 2 different errors in my command, the first was to use -j4 without build setup_h first, the second was to use MONOLITHIC=1 I don't know why but with that option the library don't compile on my system.
Post Reply