Author Topic: WxWidgets non-monolithic static build and several problems  (Read 4817 times)

Offline wost

  • Single posting newcomer
  • *
  • Posts: 2
WxWidgets non-monolithic static build and several problems
« on: February 13, 2013, 07:53:46 pm »
Hi. I have been trying and searching for 5 days and stil can't find solution for my problem. Firstly, I have installed CodeBlocks with MinGW compiler and unpacked WxMSW sources. Next I have compiled WxWidgets with BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1 flags. Then I have created new WxWidgets project and set "WxWidgets is build as monolithic library" and "Use Unicode" checked. Ok, sample window appliaction builds and runs. The executable size is about 2,4MB and ok, it should be because of static build with monolithic library. So 90% of the weight is taken by WxWidgets library file.

But, I have unpacked WxMSW separately into another folder and compiled with BUILD=release SHARED=0 MONOLITHIC=0 UNICODE=1 flags. As I had read in manuals it should be full static build where in the final executable there are attached only libraries used by the application. So, I deleted CodeBlocks configuration and started again. I created a new project, set WxWidgets non-monolithic folder location, checked only Unicode support and in the next step I had not selected any additional libraries because I though they were not necessary for sample window program. Unfortunately there are several errors while building application

Code: [Select]
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wno-attributes -Wall  -O2    -IC:\wxWidgets-2.8.12-nonmonolithic\include -IC:\wxWidgets-2.8.12-nonmonolithic\contrib\include -IC:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib\mswu  -c D:\test\test2\test2App.cpp -o obj\Release\test2App.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wno-attributes -Wall  -O2    -IC:\wxWidgets-2.8.12-nonmonolithic\include -IC:\wxWidgets-2.8.12-nonmonolithic\contrib\include -IC:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib\mswu  -c D:\test\test2\test2Main.cpp -o obj\Release\test2Main.o
windres.exe -IC:\wxWidgets-2.8.12-nonmonolithic\include -IC:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib\mswu  -J rc -O coff -i D:\test\test2\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -LC:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib  -o bin\Release\test2.exe obj\Release\test2App.o obj\Release\test2Main.o  obj\Release\resource.res  -s -mthreads  -lwxmsw28u_core -lwxbase28u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32  -mwindows
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x423): undefined reference to `jpeg_resync_to_restart'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x475): undefined reference to `jpeg_std_error'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x4e3): undefined reference to `jpeg_destroy_decompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x537): undefined reference to `jpeg_CreateDecompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x556): undefined reference to `jpeg_read_header'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x585): undefined reference to `jpeg_start_decompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x63e): undefined reference to `jpeg_read_scanlines'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x7ca): undefined reference to `jpeg_finish_decompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x7d2): undefined reference to `jpeg_destroy_decompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x803): undefined reference to `jpeg_finish_decompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x80b): undefined reference to `jpeg_destroy_decompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x8ed): undefined reference to `jpeg_std_error'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x97a): undefined reference to `jpeg_destroy_compress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x9dd): undefined reference to `jpeg_CreateCompress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xa30): undefined reference to `jpeg_set_defaults'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xb0c): undefined reference to `jpeg_set_quality'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xdea): undefined reference to `jpeg_start_compress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xe55): undefined reference to `jpeg_write_scanlines'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xe7b): undefined reference to `jpeg_finish_compress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xe89): undefined reference to `jpeg_destroy_compress'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x493): undefined reference to `TIFFClientOpen'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x4cd): undefined reference to `TIFFReadDirectory'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x4d9): undefined reference to `TIFFClose'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x53e): undefined reference to `TIFFSetDirectory'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x554): undefined reference to `TIFFClose'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x578): undefined reference to `TIFFGetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x590): undefined reference to `TIFFGetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x5b0): undefined reference to `TIFFGetFieldDefaulted'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x6f8): undefined reference to `_TIFFmalloc'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x740): undefined reference to `_TIFFfree'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x748): undefined reference to `TIFFClose'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x7cf): undefined reference to `TIFFReadRGBAImage'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x7e5): undefined reference to `_TIFFfree'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x8e7): undefined reference to `_TIFFfree'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x8ef): undefined reference to `TIFFClose'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x9d7): undefined reference to `TIFFClientOpen'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xa7b): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xa9f): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xac3): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xadf): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xafb): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xbeb): more undefined references to `TIFFSetField' follow
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xedf): undefined reference to `TIFFScanlineSize'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xf18): undefined reference to `TIFFDefaultStripSize'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xf30): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xff5): undefined reference to `TIFFWriteScanline'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x1045): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x1061): undefined reference to `TIFFSetField'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x10c1): undefined reference to `TIFFScanlineSize'
C:\wxWidgets-2.8.12-nonmonolithic\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x10d5): undefined reference to `TIFFScanlineSize'
Process terminated with status 1 (0 minutes, 19 seconds)
50 errors, 0 warnings (0 minutes, 19 seconds)
 

On the forum I found solution which said that adding jpg and tiff library should do the trick. Ok, I had created new project and selected JPG and TIFF additional libraries. The project now builds and runs. But the executable file size is again 2,4MB. Why? I had selected only JPG and TIFF additional libraries, I ommited HTML, Regex, RichText etc. So why sample window application is so huge? 2,4MB is the same as my first build with monolithic library. So the compiler again attached all libraries to the exe despite that I selected only JPG and TIFF? And I would like also to know why empty sample window can not compile without JPG and TIFF libraries, though I think simple grey window does not need these libs.

I hope someone could help me, because I would like to start coding instead of trying to make WxWidgets usable for 5 days.  :)

EDIT: My builds are targetted to Release, no Debug.
« Last Edit: February 13, 2013, 07:57:14 pm by wost »

Offline wost

  • Single posting newcomer
  • *
  • Posts: 2
Re: WxWidgets non-monolithic static build and several problems
« Reply #1 on: February 13, 2013, 11:22:31 pm »
Ok, I have read tons of topics here and on wx forums. I though I will be able to disable needless libraries to cut down the file size but I see there are for example links in image.h to jpeg and tiff library which means even sample window appliaction needs both tiff and jpeg library.
But I am not sure if I understood. There is no difference in exe file size when using monolithic static build and non-monolithic static build of WxWidgets? So what is the point of these two methods if I still have to link all libraries which would be linked automaticly in monolithic build to run simple application?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6554
    • My Best Post
Re: WxWidgets non-monolithic static build and several problems
« Reply #2 on: February 13, 2013, 11:47:09 pm »
Please ask you wxWidgets and MinGW Compiler question on a site that is likely to answer them.

I would suggest http://forums.wxwidgets.org/ as a likely site.

Edit: You do know that your question is NOT a valid topic for this site?
If not re-read the rules you agreed to follow when posting on this site.

Edit2: The rules http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.
« Last Edit: February 14, 2013, 01:36:26 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org