librelist archives

« back to archive

cross compile from linux ?

cross compile from linux ?

From:
Daniel Aquino
Date:
2012-01-08 @ 13:49
I imagine it shouldn't be that hard wondering if anyone has attempted
or documented it ?

I have a game I develop and automatically build releases for linux
using gcc, mingw for windows, and for mac people have to install wine.

I would to continuing providing automatic builds for people on every
commit but for this I need ability to cross compile using gcc for mac.

Targeting x11.app is fine so I don't need to bring in all the
complexity involved with attempting to cross compile for quartz
(unless that's easy?).

Thanks.

Re: [homebrew] cross compile from linux ?

From:
Mike McQuaid
Date:
2012-01-08 @ 14:31
On 8 Jan 2012, at 13:49, Daniel Aquino wrote:

> I imagine it shouldn't be that hard wondering if anyone has attempted
> or documented it ?
> 
> I have a game I develop and automatically build releases for linux
> using gcc, mingw for windows, and for mac people have to install wine.
> 
> I would to continuing providing automatic builds for people on every
> commit but for this I need ability to cross compile using gcc for mac.
> 
> Targeting x11.app is fine so I don't need to bring in all the
> complexity involved with attempting to cross compile for quartz
> (unless that's easy?).

From someone who does cross-platform development/consulting for a living: 
it's not that easy I'm afraid. Relying on X11 being installed is not a 
good idea, most end-users will not have it (not part of the default 
install) and it results in a pretty shoddy end-user experience.

In theory it's possible to cross-compile very simple applications but 
you'd need to download and build the Apple supplied GCC on Linux, 
something which is maybe possible but not common.

Additionally I would always suggest using Visual Studio (the Express 
version is free) for Windows compilation as it results in much more 
performant code.

If you target Windows I presume that you're not relying on X11 anyway but 
some sort of intermediate layer. I would suggest you investigate using 
something like SDL or even Qt which is built in a way to abstract the 
differences for these platforms and then compiling them natively on each 
platform's default compiler (e.g. MSVC 2010 Express on Windows, GCC on 
Linux, LLVM-GCC on OSX).

--
Mike McQuaid
http://mikemcquaid.com

Re: [homebrew] cross compile from linux ?

From:
Daniel Aquino
Date:
2012-01-08 @ 20:05
Wow...

>Relying on X11 being installed is not a good idea, most end-users will 
not have it (not part of the default install) and it results in a pretty 
shoddy end-user experience.

Blame Apple for that.

Also the current process is  x11 + homebrew / mac ports + build wine.

You must find that more favorable to just installing x11.app which
already comes with osx.

> Additionally I would always suggest using Visual Studio (the Express 
version is free) for Windows compilation as it results in much more 
performant code.

I ported away from msvc and visual studios some time ago.

Regardless it still compiles using linux gcc, winegcc, mingw gcc, and msvc.

I have never had an issue with mingw performance and find using a
standard gcc toolchain for my entire build process a better approach
as the unix tools are friendlier to use and open source where as msvc
is a proprietary mess that offers nothing.

The binaries automatically compile on every commit without the need
for me to have a windows or mac laying around.

Nor do I even want to have a mac or windows machine in the first place.

> If you target Windows I presume that you're not relying on X11 anyway 
but some sort of intermediate layer. I would suggest you investigate using
something like SDL or even Qt which is built in a way to abstract the 
differences for these platforms

Already uses sdl and other cross platform libraries ...  Using these
libraries does not magically make your application work on another
platform that locks down it's development environment like a dictator.

> and then compiling them natively on each platform's default compiler 
(e.g. MSVC 2010 Express on Windows, GCC on Linux, LLVM-GCC on OSX).

Who gets the right to tell me what's default ?  Obviously the homebrew
community doesn't like excepting what they tell you is the default
unix environment..

I'm not here to be forced to buy every platform just to compile for
them especially since I don't even own windows or a mac and don't
desire to.

Mingw is a great product and the moment I ported to gcc I instantly
began to find bugs that msvc did not report , my experience became
smoother , and I have a wealth of other gnu tools like gprof and gdb
for free where on msvc your only option is to buy licenses for
upgrades and full versions.. on top of that other great tools like
valgrind have been invaluable in porting, cleaning and debugging such
a large code base ..

There is no reason I shouldn't be able to cross compile from one unix
to another, drawin was based off of bsd and there is no issue
compiling back and forth between linux and bsd..

Apple doesn't want an open system that's easy to target from outside
probably because of some PR mantra like on the iphone vs android
debates, "we want to control quality of applications" yet a video game
which uses 3d rendering could easily be cross compiled and package up
a nice dmg experience so it's not like I even need to care about the,
"mac look and feel".

All I can do is tell those few users that have ever asked to play on a
mac to go through the lengthy install homebrew and build wine.

And that's not such a bad idea anyway because who wouldn't want
homebrew to bring some gnu / open source love to mac osx system...

Re: [homebrew] cross compile from linux ?

From:
Mike McQuaid
Date:
2012-01-08 @ 20:47
On 8 Jan 2012, at 20:05, Daniel Aquino wrote:

> Also the current process is  x11 + homebrew / mac ports + build wine.

You could distribute binaries for OSX and Windows.

> Already uses sdl and other cross platform libraries ...  Using these
> libraries does not magically make your application work on another
> platform that locks down it's development environment like a dictator.

SDL has a Quartz backend so using X11 is unnecesary on OSX.

> Who gets the right to tell me what's default ?  Obviously the homebrew
> community doesn't like excepting what they tell you is the default
> unix environment..

I'm not the Homebrew community. I'm someone who writes cross-platform 
software for a living. Linux isn't certified Unix, OSX is. No-one is 
telling you anything. Try to be more polite if people are trying to help 
you out for free at a weekend.

If you want to talk about this any more please take it off list. It 
doesn't really seem to be about Homebrew any more.

--
Mike McQuaid
http://mikemcquaid.com

Re: [homebrew] cross compile from linux ?

From:
Daniel Aquino
Date:
2012-01-08 @ 22:03
> You could distribute binaries for OSX and Windows.

I release linux and windows binaries.

I stated that I use mingw for windows various times.

> SDL has a Quartz backend so using X11 is unnecesary on OSX.

The entire point of the thread is "cross compiling" and my statement
pointed out that using sdl does that instantly make mac cross
compilable.

>> Who gets the right to tell me what's default ?  Obviously the homebrew
>> community doesn't like excepting what they tell you is the default
>> unix environment..
>
> I'm not the Homebrew community. I'm someone who writes cross-platform 
software for a living. Linux isn't certified Unix, OSX is. No-one is 
telling you anything. Try to be more polite if people are trying to help 
you out for free at a weekend.

Ok they call it "unix-like" at this point I don't really care it's the
best and most open environment for me.

Try to answer the question instead of making assumptions and derailing
the thread.

Nothing you said was of any help and then you tried to dictate how
people should build their software.

The thread was started to look into how to run gcc from linux to build
osx compatible binaries to get around the need of the user building
wine.

> If you want to talk about this any more please take it off list. It 
doesn't really seem to be about Homebrew any more.

I figure the Homebrew community would have some good insight and would
like the idea.

Let them speak for them selves as you stated your not part of them.