LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-12-2014, 04:45 AM   #1
Dark_Oppressor
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Linux Mint
Posts: 45

Rep: Reputation: 15
Cross-compiling for OS X


I've recently started using x86_64 Linux Mint 17, and decided to try building some of my software (games and little things) on there. I quickly got my x86_64 Linux builds working. I then decided (WHY) to try to figure out how to build for other OSes from here, with the thought of only having to build on one machine in the back of my mind.

My engine currently builds for Windows (x86 and x86_64), Linux (x86 and x86_64), OS X (x86_64), and Android (arm, armv7a, x86). Until today, I had a 64-bit Windows install, a 32-bit Linux install, a 64-bit Linux install, and a 64-bit OS X install used for building. I use gcc for Linux, mingw for Windows, clang for OS X, and gcc (via the NDK) for Android.
So naturally, being able to build all from one place would be AWESOME. I had zero experience with building for different platforms or architectures (excepting Android, which is done through the NDK and so I didn't really have to do anything there) before today.

I have so far managed:
gcc compiles x86_64 and x86 Linux binaries
gcc-mingw-w64 compiles x86_64 and x86 Windows binaries

I am now trying to figure out if there is any way to compile OS X binaries on Linux. I was hoping to discover some sort of gcc-apple-darwin or something along those lines. Is there anything like this that I've just missed?
 
Old 10-13-2014, 03:09 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
? Ask Google .. mac os x cross compiler for linux ..
https://www.google.com/webhp?hl=all&...iler+for+linux

The first hit http://wiki.lazarus.freepascal.org/C...g_OSX_on_Linux
 
Old 10-17-2014, 05:17 AM   #3
Dark_Oppressor
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Linux Mint
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by knudfl View Post
Well, of cours I'd Googled it before I came here! The link you posted appears to be for pascal (I may have forgotten to specify what language I'm working in, but it's c++), and it doesn't support recent/x86_64 OS X it seems.

I did however discover this: https://github.com/tpoechtrager/osxcross
You download that project, package an OS X SDK (on OS X), bring it over to Linux, and run a script that the project comes with. It builds a full compiler setup for you that works in Linux. It is amazing, and its creator is my hero.
It took hours of playing around with build options (Mainly boost, holy crap it did not want to build with this compiler. I ended up having to dig deep into the .jam files. Most of my libraries built fine without issue), but I was able to build an OS X binary, and it ran on my OS X machine! Woo!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
learning cross compiling-compiling library from soruce brianmay27 Linux - Software 1 12-31-2012 06:28 AM
Cross compiling qwerty4061 Linux - Newbie 5 12-03-2011 02:30 PM
Cross-compiling v/s cross-building kushalkoolwal Programming 3 05-13-2009 06:49 AM
Cross Compiling dosnlinux Programming 5 03-01-2006 12:12 PM
cross compiling cerin Linux - Software 1 02-11-2006 11:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration