Code::Blocks Forums

User forums => Help => Topic started by: wumbo on August 12, 2009, 06:22:34 pm

Title: Static Build in Codeblocks
Post by: wumbo on August 12, 2009, 06:22:34 pm
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
Title: Re: Static Build in Codeblocks
Post by: MortenMacFly on August 12, 2009, 08:33:02 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.
Title: Re: Static Build in Codeblocks
Post by: 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...
Title: Re: Static Build in Codeblocks
Post by: MortenMacFly on August 12, 2009, 09:31:45 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?
Title: Re: Static Build in Codeblocks
Post by: 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.... :)

Thanks for your help
Title: Re: Static Build in Codeblocks
Post by: MortenMacFly on August 13, 2009, 08:41:11 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.
Title: Re: Static Build in Codeblocks
Post by: wumbo on August 13, 2009, 09:36:27 am
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.
Title: Re: Static Build in Codeblocks
Post by: Jenna on August 13, 2009, 09:52:31 am
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 ?
Title: Re: Static Build in Codeblocks
Post by: wumbo on August 13, 2009, 11:01:43 am
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