Cross-compiling in RedHat / Fedora / CentOS

General help: new users, installing the Ecere SDK, using the IDE to compile and run applications.
Post Reply
redj
Posts: 105
Joined: Sun Jan 17, 2010 10:03 am

Cross-compiling in RedHat / Fedora / CentOS

Post by redj »

Now for the cross-compiler stuff.

This is bleeding edge stuff for now so make sure you have the latest tarball. I think the next pre-release will include all this out of the box but if not, at the very least this procedure will work.

Make sure you have a good installation of the SDK (Build & Install SDK in RedHat / Fedora / CentOS) but use the latest (post with download link) tarball.

Just the commands:

Code: Select all

su -c 'yum install mingw32-binutils mingw32-cpp mingw32-filesystem mingw32-gcc mingw32-gcc-c++ mingw32-runtime mingw32-w32api'
su -c 'yum install wine'
wine cmd
exit
wget http://ecere.com/downloads/winbin.zip
unzip -x winbin.zip
mv bin/ecere*.dll /home/user/.wine/drive_c/windows/system32/
Steps:

1. You need to install the mingw32 compiler.

Code: Select all

su -c 'yum install mingw32-binutils mingw32-cpp mingw32-filesystem mingw32-gcc mingw32-gcc-c++ mingw32-runtime mingw32-w32api'
2. If you want to run the programs you compile with this able compiler, you might want to install wine and go through a quick configuration by running cmd. (Exit command prompt afterwards.)

Code: Select all

su -c 'yum install wine'
wine cmd
exit
3. You need windows binaries in-place to easily link and run windows binaries. (Remember to replace /home/user to match your username.)

Code: Select all

wget http://ecere.com/downloads/winbin.zip
unzip -x winbin.zip
mv bin/ecere*.dll /home/user/.wine/drive_c/windows/system32/
4. This new compiler could use a configuration in the IDE.
  • a. Applications -> Programming -> Ecere IDE
    b. File -> Global Settings
    c. Compilers
    d. Duplicate the default compiler
    e. Name it mingw32
    e. In Toolchain
    • e.1. replace cpp by i686-pc-mingw32-cpp
      e.2. replace gcc by i686-pc-mingw32-gcc
    f. In Libraries, Add the following directories (Remember to change /home/user to match your username.) (The order is important here.)

    Code: Select all

    /usr/i686-pc-mingw32/sys-root/mingw/lib
    /usr/i686-pc-mingw32/lib
    /home/user/.wine/drive_c/windows/system32
    g. Ok
5. Let's try this new compiler.
  • a. Open a sample. (Project -> Open / CTRL+SHIFT+O)
    b. Select the mingw32 compiler. (Project -> Active Compiler)
    c. Build the sample! (Project -> Build / F7)
    d. Test this new windows executable.

    Code: Select all

    wine obj/helloWorld.debug.mingw32.win32/HelloWorld.exe
    wine obj/helloForm.debug.mingw32.win32/HelloForm.exe
That's it for now!

-redj

PS: This has been tested in Fedora 13. Feedback on all platforms is welcome.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Cross-compiling in RedHat / Fedora / CentOS

Post by jerome »

Thanks Redj this is great :)

I will make sure to try it out tonight and put up all the necessary files online so people can start using this :) Hope you're around a bit tonight! :D
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Cross-compiling in RedHat / Fedora / CentOS

Post by jerome »

I followed the instructions and everything works nicely!

Only extra steps I needed on CentOS:

1. Comment out the call to XOpenIM in ecere/src/gui/drivers/XInterface.ec (To work around a problem with the old X.org and input methods: Ecere application jam as soon as you touch the keyboard)
2. Add the EPEL repository to my configured repository before trying to fetch MinGW. Conveniently there is a one-line command you can use for this, thanks to an EPEL rpm package:

Code: Select all

su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm'
I put online a new bleeding edge source tarball with our latest fixes (and latest new bugs), including a patch for the trailing windows dragging around in an MDI workspace.

You can use it for the purpose of this cross-compiling:

http://www.ecere.com/downloads/ecere-sd ... 25.tar.bz2

I also put up Windows binaries so you can grab ecere.dll and ecereCOM.dll from there to put in your ~/.wine/drive_c/windows/system32 .

Easy cross-compiling from Linux for Windows target at last! :P
Post Reply