Author Topic: wxWidgets cross-compile libraries for debian available on my server  (Read 14979 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
I just uploaded wxWidgets cross-compiling libraries to my server (see signature).

They are called:
libwxmsw2.8-dbg_2.8.7.1-0_XXX.deb
libwxmsw2.8-dev_2.8.7.1-0_XXX.deb
wx2.8-headers-msw_2.8.7.1-0_XXX.deb

where XXX stands for the architecture (either i386 or amd64).

The are based on the slightly modified source-code in debian experimental.
Because of this modifications I also uploaded the source-tar-ball.

The packages are build in the same p-builder-chroot then the C::B-binaries, so they should work with all debian-suites from etch to experimental.
I only tested un unstable/experimental, so if there are any issues feel free to sen me a PN or a mail.

To use them you will also need the ming32 package from your suite.

To setup C::B for cross-compiling create a new Compiler by copying the standard GNU GCC Compiler and call it as you like (I named mine: Mingw GNU GCC Cross-Compiler for Windows).
<Edit>
As next step you have to clear the search-directories, otherwise the compiler/linker/resource-compiler will conflict with the standard libs and headers.
I'm not sure if you can rely on this if you build pure console-applications. I think it's better to put mingw32's include and lib dirs here: /usr/i586-mingw32msvc/include/ for Compiler and Resource Compiler and /usr/i586-mingw32msvc/lib/ for Linker.
</Edit>

Then you have to setup your "Toolchain Executables": they are named as the standards for linux, except that they have a "i586-mingw32msvc-"-prefix.
As binary for the windows-resource compiler you have to use `wx-config --host=i586-mingw32msvc --rescomp`.
The directory can stay unchanged.
I did not use the debugger or the make program until now, but there are no executables in mingw32-package, so I left them unchanged for now.

If you have a working wxWidgets-project (either an old one or newly created) you can add a new Build target, for example "WinRelease".
You do that by duplicating an existing Build target.
In projects properties go to the "Build targets"-tab, chose the target to duplicate (in my case "Release") and click duplicate.
Then change the "Output filename" from "bin/Release/<filename>" to "bin/WinRelease/<filename>.exe", and uncheck at least "Auto-generate filename extension".

In the "Build options" of your project you have to move `wx-config --cflags` from the global "Compiler settings -> Other options" to the one for the standard build targets (Debug and Release) and do the same for the "Linker Settings -> Other options".
The appropriate calls to "wx-config" for the WinRelease must have the parameter: --host=i586-mingw32msvc included and if you want to use it with the C::B standard wxWidgets install on windows (monolithic) you have to add a --static also.

Oh and I nearly forgot, you have to change the compiler's name to the one of your new cross-compiler.

You will need the mingwm10.dll to run your binary with wine or on win. You can find it gzipped in /usr/share/doc/mingw32-runtime/.

If you try to run an executable build with the none-static libs (wx-config called without --static) you have to make the appropriate dll's visible for wine.
I created symlinks from /usr/i586-mingw32msvc/lib/*.dll to ~/.wine/drive_c/windows/system32/ (by the way that would also be a good place to put mingwm10.dll to.

If there are any questions or suggestions, feel free to ask.
I prefer to answer questions in the forum, not via PN or mail, because there might be other users that have the same problem.

Running the about box in the "test.exe" leads to this message (on debian of course):


[attachment deleted by admin]
« Last Edit: March 14, 2008, 02:32:00 pm by jens »

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #1 on: March 14, 2008, 06:32:57 pm »
Maybe this should be structured to become an entry on the wiki  :wink: or update the current one

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #2 on: March 14, 2008, 06:42:33 pm »
Maybe this should be structured to become an entry on the wiki  :wink: or update the current one
I thought about that, and maybe this weekend I find the time to do so.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #3 on: March 16, 2008, 11:47:00 pm »
Maybe this should be structured to become an entry on the wiki  :wink: or update the current one
I thought about that, and maybe this weekend I find the time to do so.
I just started to write a new wiki article, but I have less time then I would like to have.
You can read and give any suggestions of course, even if the article is not yet ready.
The thumbs of my pictures are not visible, but this is either a problem on the server (missing executable) or wanted. Nevertheless if you click on the link below the thumbs you can see the whole picture.

Ahh... I think I forgot something ...
... the link to the wiki-entry: here it is.

And yes, I know that there is another article about cross-compiling, but I don't want to change it, but I will have a linkt to it (and some other articles in the web) when I'm ready.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #4 on: March 17, 2008, 12:32:07 am »
Really nice! I will try that setup for a crossplatform project I'm working on, since I'm using a virtual machine on ubuntu, I will try that to stop the need of using windows to compile. Is great, really helpful  :D

Offline cryx

  • Single posting newcomer
  • *
  • Posts: 4
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #5 on: March 18, 2008, 10:57:09 pm »

Hi, Thank you for you great tutorial, I was following your instructions -
I installed your .deb files and also compiled a static library on my own.
I created a standard wxWidgets project (wxSmith, Dialog) which compiles fine for my Ubuntu 7.10 64bit..
But Crosscompiling does have problems: It seems to compile fine but has thousands of link reference errors:
Here is some Build output:

-------------- Build: WinRelease in crosstest ---------------
Compiling: crosstesetApp.cpp
Compiling: crosstesetMain.cpp
Linking executable: bin/WinRelease/crossteset.exe
obj/Release/crosstesetApp.o:crosstesetApp.cpp:(.text+0x47): undefined reference to `wxAppConsole::CheckBuildOptions(char const*, char const*)'
obj/Release/crosstesetApp.o:crosstesetApp.cpp:(.text+0x68): undefined reference to `wxApp::wxApp()'
obj/Release/crosstesetApp.o:crosstesetApp.cpp:(.text+0xc2): undefined reference to `wxAppConsole::ms_appInstance'
obj/Release/crosstesetApp.o:crosstesetApp.cpp:(.text+0xe6): undefined reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'
obj/Release/crosstesetApp.o:crosstesetApp.cpp:(.text+0x146): undefined reference to `wxInitAllImageHandlers()'
..........


Does somebody know a solution to this?

I'm on Ubuntu 7.10 64 bit, Codeblocks 8.02
Ubuntu 7.10 64bit - Gnome - Code::Blocks 8.02

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #6 on: March 18, 2008, 11:51:48 pm »
Did you setup the "Linker Settings" in the "Build Options" for your cross-target correctly ?
There should be something like:
Code
`wx-config --host=i586-mingw32msvc --static --libs`

If yes , can you please turn on full commandline logging and post the output of the Build Log.
To turn it on, go to "Settings -> Compiler and Debugger... -> [your cross-compiler] -> Other settings (the rightmost tab) -> Compiler Logging" and switch it to "Full command line".

Offline cryx

  • Single posting newcomer
  • *
  • Posts: 4
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #7 on: March 19, 2008, 10:22:31 am »
Thanks for the answer.
Now I removed your packages and removed and  reinstalled mingw32 and did the following from scratch:
(btw, now I have a totally different problem than yesterday  :) )

I have the wxWidgets 2.8 sources and configured it with:
Code
./configure --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc --disable-shared --enable-unicode --enable-release --build=x86_64-linux --enable-monolithic
then I did make and sudo make install

I configured a new Compiler in CodeBlocks like described int the Wiki

Created a new Build also like described in the Wiki with only some changes:
other linker options: `wx-config --prefix=/usr/i586-mingw32msvc --libs --host=i586-mingw32msvc --static --unicode --release`
other compiler options: `wx-config --prefix=/usr/i586-mingw32msvc --cflags --host=i586-mingw32msvc  --unicode --release --static`

Now I get this error,

-------------- Build: WinRelease in crossteset ---------------
i586-mingw32msvc-g++ -Wall -O2 2.8 -I/usr/i586-mingw32msvc/lib/wx/include/i586-mingw32msvc-msw-unicode-release-static-2.8 -I/usr/i586-mingw32msvc/include/wx-2.8 -D__WXMSW__ -mthreads -I/usr/i586-mingw32msvc/include/ -c /home/jahn/Projects/crossteset/crosstesetApp.cpp -o obj/WinRelease/crosstesetApp.o
i586-mingw32msvc-g++ -Wall -O2 2.8 -I/usr/i586-mingw32msvc/lib/wx/include/i586-mingw32msvc-msw-unicode-release-static-2.8 -I/usr/i586-mingw32msvc/include/wx-2.8 -D__WXMSW__ -mthreads -I/usr/i586-mingw32msvc/include/ -c /home/jahn/Projects/crossteset/crosstesetMain.cpp -o obj/WinRelease/crosstesetMain.o
i586-mingw32msvc-g++: 2.8: No such file or directory
i586-mingw32msvc-g++: 2.8: No such file or directory


it seems that the command ist not build right, there is no file such as 2.8
but I really don't know where this might come from
I would appreciate any help on this.
« Last Edit: March 19, 2008, 10:34:02 am by cryx »
Ubuntu 7.10 64bit - Gnome - Code::Blocks 8.02

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #8 on: March 19, 2008, 10:36:22 am »
Leave the --release (in the wx-config command-line) away !!!
It shows the release number and g++ interpretes it as input-file, what (of course) does not exist.

You should also be able to run wx-config without the --prefix=... switch.

Offline cryx

  • Single posting newcomer
  • *
  • Posts: 4
Re: wxWidgets cross-compile libraries for debian available on my server
« Reply #9 on: March 19, 2008, 11:02:35 am »
Thanks!  without the --release it worked like a charm!
But I have to use the --prefix=/usr/i586-mingw32msvc option
otherwise it won't include the right include directories and I get include errors like:
/home/cryx/Projects/crossteset/crosstesetApp.h:13:20: wx/app.h: No such file or directory

BTW: I use the --prefix=/usr/i586-mingw32msvc option also in my compiler>toolchain executables> Resource compiler setting

Maybe this is Ubuntu specific, I dont know.. 
I also think the --build=x86_64-linux  switch for ./configure was necessary , when I was configuring without it and compiling it gave me a config named msw-unicode-release-static-2.8  instead of i586-mingw32msvc-msw-unicode-release-static-2.8
I don't know if that matters  but I could post all the things I did to get it running if this might help others.
Ubuntu 7.10 64bit - Gnome - Code::Blocks 8.02