Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Indrekis on March 18, 2006, 04:05:38 am

Title: Buildig CodeBlocks using autotools under windows
Post by: Indrekis on March 18, 2006, 04:05:38 am
Hi, All!

First of all, I want to thank you for this great project. I am using it (more or less) for a year and still impressed by it's capabilities and rapid progress.

Several weeks ago I decided to try to compile CodeBlocks for  windows using autotools. I do managed to compile (and even to link ;-) ) it. But obtained executable is not useable.

It launches, can load projects (including self CB project). But most (if not all???) plugins fail. For example, if codecompletion plugin is "enabled" (present in plugins folder), CB crushes almost immediately after loading any project with opened in editor files. Crash report in attached in codecompcrush.txt.

Using "Settings/Compiler and debugger" from the main menu  fails when codestat plugin is enabled (codestatcrush.txt).

CodeStat itself fails too. (It occasionally worked fine for HelloWorld project, but only once. Strange... ).
And so on...
wxSmith plugin fails to load. (<CBFOLDER>/trunk/src/output/share/codeblocks/plugins/libwxsmith.dll: not loaded (file exists?) )
On the other hand Astyle plugin works fine. So Class wizard and Plugin wizard do.

 And main problem with compiled that perverted ;-) way CB is that it refuses to compile even simplest project.It straight off proceeds with linking BEFORE compiling:

g++.exe   -o dummy.exe .objs\main.o   
g++.exe: .objs\main.o: No such file or directory
g++.exe: no input files

And tells "Nothing to be done." when I try to "Compile current file".

Could someone help me to resolve (or understand the reason) of this behavour?

Additional information:

OS: WindowsXP SP2
Compiler framework: MSYS 1.0.11 / MinGW based.
gcc 3.4.4
autoconf 2.59
automake 1.8.2
libtool 1.5.20
wxWidgets: 2.6.2
(ANSI, debug, non-monolithic, multi-threaded, native widgets - for now I do not have compiled non-debug wxWidgets)

CodeBlocks - SVN revision  2199.

Patch for build system is attached. I do my best to not break Linux builds, but I cannot test it.

CB was compiled both in-place and in separated folder. For the second case executables and dlls were manually copied into tree, generated by update. Than wx dlls and mingwm10.dll were copied into folder where codeblocks.exe exists. 

configure arguments:

CXXFLAGS="-fmessage-length=0 -Winvalid-pch"
CPPFLAGS="-DHAVE_W32API_H -D__WXMSW__  -DcbDEBUG -DTIXML_USE_STL -DCB_PRECOMP -DWX_PRECOMP  -D__WXDEBUG__"
./configure --with-wx-config=<wxWidgets folder>/bin/wx-config --with-wx-prefix=<wxWidgets folder> --enable-contrib --with-platform=win32

Bootstrap was called before the configure.

Additional comments:


PS. Please, excuse my English - I am not very experienced in this language.


[attachment deleted by admin]
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: mandrav on March 18, 2006, 10:57:49 am
Well, I never tested the autotools build in anything else than linux. In fact it shouldn't be possible to build without tweaking, but I guess that's what your patches are for ;)
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: tomjnx on May 01, 2011, 06:39:46 pm
I've now succeeded in cross compiling mingw32 binaries on Fedora.

I've attached the patch against current trunk. I've tested that it still builds natively as well as cross compiles for mingw32.

There are some differences to the codeblocks build, namely the DLL names, as libtool really wants library (DLL) names to start with "lib".

I haven't tested native builds using mingw32 on windows, but I suspect this should be close to working.

Tom
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: oBFusCATed on May 01, 2011, 07:35:58 pm
Code
+AM_CFLAGS = $(WX_CFLAGS)
+if WIN32
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+else
+AM_CPPFLAGS = $(WX_CPPFLAGS)
+endif
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+if WIN32
+AM_LDFLAGS = $(WX_LIBS) -Wl,--enable-auto-image-base -Wl,--add-stdcall-alias -Wl,--enable-auto-import
+else
+AM_LDFLAGS = $(WX_LIBS)
+endif
+
Why are you doing this all over the place?
Have you tried to put it in the configure.in/.ac?
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: tomjnx on May 02, 2011, 12:13:58 am
Why are you doing this all over the place?
Have you tried to put it in the configure.in/.ac?

Because not all directories need the same flags.

That is likely the reason why already now the WX flags/libraries are in their separate variables and not in the global CPPFLAGS/LIBS.

Generally I've tried to stay close to the flags used by the C::B windows build.

It's possible that some windows build flags are harmless on unix, so the use of if WIN32 could probably be cut down. But then again I am not yet that familiar with the C::B codebase
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: tomjnx on May 03, 2011, 04:07:02 pm
Version 2 of the patch. I reduced if WIN32 usage a lot, and removed lots of unnecessary defines.
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: oBFusCATed on May 03, 2011, 05:52:05 pm
Why don't you define a CROSS_COMP_CFLAGS/LDFLAGS in the configure.in/.ac and then used them, when they are needed?
If the current compile is not for CrossComp, define them blank.
This way the ifdefs will be only in one file.
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: tomjnx on May 04, 2011, 11:50:08 am
Why don't you define a CROSS_COMP_CFLAGS/LDFLAGS in the configure.in/.ac and then used them, when they are needed?
If the current compile is not for CrossComp, define them blank.
This way the ifdefs will be only in one file.

That could work for some of the LDFLAGS (namely the auto import/export all options), but it does not work for the CFLAGS, due to the windows dllimport/dllexport stupidity and the way wx conventions handle these. There aren't many CFLAGS conditionals left anyway.

Thinking about how this could help the LDFLAGS case.
Title: Re: Buildig CodeBlocks using autotools under windows
Post by: tomjnx on May 04, 2011, 04:28:48 pm
Ok most conditionals zapped.