Author Topic: Howto - Cross Compiling in Linux using MingW32  (Read 623160 times)

Offline koen

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #15 on: November 18, 2006, 07:45:41 pm »
After installing MingW32, how do I proceed to install the required wxWidgets header files, so I can compile wxWidgets projects? I think I'm just a bit lost on where to put the files. Did anyone manage to do this and is he/she willing to share some information?
Read Topic:
Installing Code::Blocks from source on Windows or Linux or Fedora or ....

I browsed through those pages, but I couldn't find what I was looking for. Maybe my problem statement wasn't clear enough. Let me try to elaborate:

I have installed C::B on Linux and I am able to compile/build/run wxWidgets projects on Linux. Now I would like to cross-compile my program to Windows. As far as I understand, I need MingW32 to do the actual cross-compilations, so I installed that first. However, when I try to cross-compile my program, I get errors because wxWidgets-msw files are missing (the first one it complains about is wx/msw/chkconf.h), which makes sense. So I guess I have to install those, but I'm not sure where to put them or what would be the best way to do this.

The page you sent me to seems to be about installing C::B itself, but I've already got that running (on Linux).

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2808
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #16 on: November 18, 2006, 11:47:39 pm »
Sorry that I misunderstood.

I am unaware that wxWidgets for windows can be installed on Linux and then used to compile a windows pgm.

Maybe someone familiar with Wine or some such can help.

Offline koen

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #17 on: November 19, 2006, 01:52:59 am »
Sorry that I misunderstood.
I am unaware that wxWidgets for windows can be installed on Linux and then used to compile a windows pgm.
Maybe someone familiar with Wine or some such can help.

I don't think Wine should be necessary. Of course, for testing and debugging it may be used, but for cross-compiling, one shouldn't need Wine.

I found a page on cross-compiling wxWidgets under Linux (http://www.wxwidgets.org/wiki/index.php/Cross-Compiling_Under_Linux), which is supposed to result in a set of wxMSW header/object files. I ran configure, make and make install, and that seems to have worked out all OK. I'll check whether it has produced something useful later.

FreeSouth

  • Guest
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #18 on: May 29, 2007, 10:35:40 am »
Thank you ,,,,very useful to me~

Offline Morphius Faydal

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #19 on: October 19, 2007, 06:25:16 pm »
Now if only the Gentoo ebuilds of MinGW weren't broken...

Also; on a stylistic note; MingW32 isn't the proper name for the cross compiler.. MinGW is the "official" naming, standing for "Minimal GNU for Windows".. Min.. G.. W. :)

Offline alchemist

  • Multiple posting newcomer
  • *
  • Posts: 38
    • My Blog
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #20 on: October 20, 2007, 10:41:10 am »
Now if only the Gentoo ebuilds of MinGW weren't broken...

Also; on a stylistic note; MingW32 isn't the proper name for the cross compiler.. MinGW is the "official" naming, standing for "Minimal GNU for Windows".. Min.. G.. W. :)

Hello, what did you tried ? crossdev ?
Kind Regards,
Xavier Miller.
http://xaviermiller.be

Offline Morphius Faydal

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #21 on: October 20, 2007, 10:46:10 am »
Now if only the Gentoo ebuilds of MinGW weren't broken...

Also; on a stylistic note; MingW32 isn't the proper name for the cross compiler.. MinGW is the "official" naming, standing for "Minimal GNU for Windows".. Min.. G.. W. :)

Hello, what did you tried ? crossdev ?

The two actual ebuilds for MinGW in Portage both have notes in them stating that they're broken.

Offline alchemist

  • Multiple posting newcomer
  • *
  • Posts: 38
    • My Blog
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #22 on: October 20, 2007, 11:01:44 am »
Last year I tried crossdev with no success. I am emerging it now and testing it.

I think we could only use the non-ebuild cross-building scripts ;)
Kind Regards,
Xavier Miller.
http://xaviermiller.be

Offline alchemist

  • Multiple posting newcomer
  • *
  • Posts: 38
    • My Blog
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #23 on: October 20, 2007, 11:12:13 am »
OK, after running
Code
crossdev --target mingw32
I got
Code
#mingw32-g++ --version
mingw32-g++ (GCC) 4.2.2 (Gentoo 4.2.2 p1.0)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Next step : cross-build binutils, gcc, w32api et wxMSW ;)

EDIT: done (i'm in 64 bits)
Code
USE="-* contrib unicode xrc" ROOT=/data/mingw32-build/ CHOST=mingw32 CBUILD="x86_64-pc-linux-gnu" emerge -1av --nodeps sys-devel/binutils sys-devel/gcc w32api make wxGTK

but cross-compilation of code::blocks through emereg didn't worked:
Code
checking for wx-config... /usr/lib64/wx/config/gtk2-unicode-release-2.8
checking for wxWidgets version >= 2.6.0... no

I will take a look later.

Moreover, emerge installed binutils and gcc with too many symlinks I'll have to manually adjust.

Maybe I'll use the standard "./configure && make && make install" procedures.
« Last Edit: October 20, 2007, 12:34:25 pm by alchemist »
Kind Regards,
Xavier Miller.
http://xaviermiller.be

Offline wvdakker

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #24 on: November 19, 2007, 01:50:42 pm »
I have installed CodeBlocks, Mingw and wxWidgets in Linux.
Transfered a project created in Windows to the Linux env.
The DLL-files are build ok but there are no library files (.a) created.
The option 'Create import library' is enabled, but nothing there.

Any clue??

gr,
Willem

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #25 on: November 19, 2007, 01:59:43 pm »
I have installed CodeBlocks, Mingw and wxWidgets in Linux.
Transfered a project created in Windows to the Linux env.
The DLL-files are build ok but there are no library files (.a) created.
The option 'Create import library' is enabled, but nothing there.

Any clue??

gr,
Willem

There are no "import libraries" in linux. You create shared objects (.so, equivalent to .dll) or static libraries (.a).
Be patient!
This bug will be fixed soon...

Offline wvdakker

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #26 on: November 19, 2007, 04:17:55 pm »

There are no "import libraries" in linux. You create shared objects (.so, equivalent to .dll) or static libraries (.a).

If I am crosscompiling for windows then libs must be available... or ....??
Otherwise how do I link dll's to other dll's or exe files.


Offline wvdakker

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #27 on: November 23, 2007, 11:22:41 am »
Found the problem :)

These options where missing in the MingW32 Cross Compiler settings.
-Wl,--output-def=$def_output -Wl,--out-implib=$static_output -Wl,--dll

Adding them solved the problem.

Offline szurilo

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #28 on: February 29, 2008, 02:55:39 pm »
Hi!
I installed mingw32 and set up the parameters of the GNU GCC compiler.
I realized the i586-mingw32msvc-gcc g++ etc. files are not in the /usr directory but the /usr/bin.
So i set the correct paths and files and set this copy of the compiler as default as this thread write them.
After this, I created a new empty console application project and a new build target.
I don't know whether is a must or not to set the platform to 'Windows' or i can leave it to 'All'.
Anyway i tried both. Actually i am really confused about the Project Settings tab, because its also consists a Platform option. :shock:
So i checked my Build target Files and click OK.
I selected my build target in the Build menu and push the magic Build button.
The output can be different according to i set the platforms type in the Project/Properties menu.
If i set it 'Windows', i got this message and no output created:
"proba" does not support the current platform. Skipping...
Nothing to be done.
If i leave the platform type on 'All' my project is builded and i got one output file without 'exe' extension and i cant run it with wine bec. its a Linux file, i guess.
So what is the problem?
CB 4893 nightly; wxWidgets 2.8.7; distro: Debian;

Szurilo

Offline HalfNote5

  • Single posting newcomer
  • *
  • Posts: 5
Re: Howto - Cross Compiling in Linux using MingW32
« Reply #29 on: April 10, 2008, 06:43:02 pm »
Thanks!

I'm an old C++ programmer, but new to Code::Blocks.  It's great to be able to write a C++ program, and without moving it back and forth, be able to write it on my linux lappy, and compile it for all with Win32 machines of the clients that are buying it.  ; )


Many thanks!
You're  a kind person to detail the steps for the rest of us.