News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Static Build in Codeblocks

Started by wumbo, August 12, 2009, 06:22:34 PM

Previous topic - Next topic

wumbo

Hi guys,

I have compiled wxWidgets as an static-ansi-release build on Ubuntu.
Everything works fine in Codeblocks except my build, because Codeblocks creates my binary as a dynamically linked binary.
How can I let Codeblocks build a static linked binary as already provided in my wxWidgets build.

Thanks

MortenMacFly

Quote from: wumbo on August 12, 2009, 06:22:34 PM
How can I let Codeblocks build a static linked binary as already provided in my wxWidgets build.
Use the appropriate compiler and linker options in the build properties.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

wumbo

Thanks for your reply but I already added "static" compiler flags but it doesn´t work anyway...

MortenMacFly

Quote from: wumbo on August 12, 2009, 09:05:54 PM
Thanks for your reply but I already added "static" compiler flags but it doesn´t work anyway...
It's not enough (and even wrong) to enable "static" as linker (!) flag. You'll need to setup the wxWidgets defines, includes and lib names accordingly.

Why don't you just use the wx wizard that ships with C::B and let C::B create such a project setup for you?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

wumbo

Cause I don´t know wx wizard, have never heard of it and don´t know where to find, but I will have a look.... :)

Thanks for your help

MortenMacFly

Quote from: wumbo on August 13, 2009, 08:33:53 AM
Cause I don´t know wx wizard, have never heard of it and don´t know where to find, but I will have a look.... :)
File -> New -> Project

Surely you'll need to have the scripted wizard plugin installed and enabled.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

wumbo

Yepp! My settings are as follows:
Compiler settings->Other options: `wx-config --cflags`
Linker settings->Other linker options:`wx-config --libs`

But this doesn´t seem to be enough as gcc still links dynamically.

Jenna

What's the output of the calls wx-config on console, what's the default wxWidgets configuration ?
Have you tried the --static parameter with wx-config ?

wumbo

Hi.Here is the output of wx-config --cflags:
-I/usr/local/lib/wx/include/gtk2-ansi-release-static-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread

wx-config --libs:
-L/usr/local/lib -pthread   /usr/local/lib/libwx_gtk2_richtext-2.8.a /usr/local/lib/libwx_gtk2_aui-2.8.a /usr/local/lib/libwx_gtk2_xrc-2.8.a /usr/local/lib/libwx_gtk2_qa-2.8.a /usr/local/lib/libwx_gtk2_html-2.8.a /usr/local/lib/libwx_gtk2_adv-2.8.a /usr/local/lib/libwx_gtk2_core-2.8.a /usr/local/lib/libwx_base_xml-2.8.a /usr/local/lib/libwx_base_net-2.8.a /usr/local/lib/libwx_base-2.8.a -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lgio-2.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lXinerama -lSM -lpng -ljpeg -lexpat -lwxtiff-2.8 -lz -ldl -lm

I´ve build wxWidgets as an static-ansi-release and no monolithic build.

The --static flag in my compiler option `wx-config --cflags --static` makes no changes -> still dynamically linked

Very many thanks for your help guys