Is there an easy to use tool-chain to compile code for Darwin (mac's OS) from Linux?
For example, I would like to compile libpcap (or tcpdump) on a Linux machine and run in on my MAC. I've come across osxcross
but it requires getting the Xcode SDK and such, has anyone tried this before ?
Thanks.
You may have heard that Macintosh OSX is just Linux with a prettier interface. That's not actually true. But OSX is built in part on an open source Unix derivative called FreeBSD. And until recently, FreeBSD's co-founder Jordan Hubbard served as director of Unix technology at Apple.
For instance when installing GCC, the GNU Compiler Collection, we can use --target= target to specify that we want to build GCC as a cross-compiler for target . Mixing --build and --target , we can cross-compile a cross-compiler; such a three-way cross-compilation is known as a Canadian cross.
You should give darling a spin.
Darling is:
Darling is a runtime environment for OS X applications.
It's like WINE for Mac OS X. Although it is still relatively a small project, you can already compile applications using Xcode using darling.
Darling [~]$ hdiutil attach Xcode_7.2.dmg
/Volumes/Xcode_7.2
Darling [~]$ cp -r /Volumes/Xcode_7.2/Xcode.app /Applications
Darling [~]$ export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
Darling [~]$ echo 'void main() { puts("Hello world"); }' > helloworld.c
Darling [~]$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang helloworld.c -o helloworld
Darling [~]$ ./helloworld
Hello world
I'm not sure a more complicated program will compile correctly and will work on Mac, but it's worth a try.
Alternatively, you can run Mac OS X on a Virtualbox inside Linux, and then transfer the compiled files to the destination machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With