I m running Mac OS X 10.5.8 and want to compile for target CentOS 5.3 with GCC 4.1.2. How could I:
- Compile GCC 4.1.2 toolchain and related tools?
- Use that tool to cross compile for target CentOS 5.3?
Any help is greatly appreciated!
I m running Mac OS X 10.5.8 and want to compile for target CentOS 5.3 with GCC 4.1.2. How could I:
Any help is greatly appreciated!
Your simplest solution is to just run CentOS 5.3 in a VM (e.g. Sun VirtualBox). This requires minimal setup, has quite reasonable overhead (assuming an Intel Mac), and you ll be able to actually test and debug what you are building.
If you really insist on cross-compiling, you must build a cross-compiler. Instructions are here and here, but beware: it will likely take you several days to get it right, and then you ll still need a VM to test the result, so I don t see any point in doing it that way.
Nowadays you can probably do it with Docker for Mac, I didn t test it because I have no mac. Docker basically creates a Linux VM and provides some nice-to-have functions.
docker run -ti centos5.3 /bin/bash
(search the official Docker Hub for your desired target)sudo yum group install "Development Tools"
)docker ps -a
to obtain your container iddocker commit [id] centos:build
Now you can use your created build environment for CentOS builds.
docker run -it --mount type=bind,source=$(pwd),target=/mnt centos:build /bin/sh -c "cd /mnt && bash"
gcc ...
or ./configure
or make
or ninja
or whatever to do your buildWith docker you can use your beloved terminal with your familiar theme and keymap. Furthermore it most probably will consume less resources for startup and while running.
If your app is graphical and you test it by using interaction with its GUI I guess a VM is still a better option (see @employed-russian s solution).
Use Cocotron to cross-compile directly from Xcode. There s a good getting-started guide here: http://blog.tlensing.org/tag/cocotron/
I struggled to get crosstool-ng to build on OSX 10.9 for x86_64 Linux. I used the very helpful post on how to build a gcc cross-compiler by Jeff Preshing and his script here as the basis for a script that worked for me. His script in the link doesn t work when compiling glibc on my version of OSX (which seems to be a very common complaint for those cross-compiling from OSX to Linux).
My script is here: https://github.com/johnlondon/Cross-compile-toolchain-for-linux-on-OSX
You can use crosstool-ng, or if you don t want to spend too much time to configure it, you can download a pre-configured cross-compiler, as Linaro. Here s the guide for installing it in Mac OS X.
Following along from this question: how-do-i-check-if-gcc-is-performing-tail-recursion-optimization, I noticed that using gcc with -fPIC seems to destroy this optimization. I am creating a shared ...
I would like to know how to generate assembler code from a C program using Unix. I tried the gcc: gcc -c file.c I also used firstly cpp and then try as but I m getting errors. I m trying to build an ...
OK, I have old Metrowerks code for Mac and Windows where the previous developer used pre-compiled headers for every project that this code base builds. How does one get rid of Pre-compiled headers, ...
I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....
I ve recently set up a MinGW + MSYS environment on my laptop to check how things are with Netbeans C/C++ support. Everything seems to work fine, however, during my testing I have noticed a difference ...
I d like to compile my application for version 10.5 and forward. Ever since I upgraded to Snow Leopard and installed the latest XCode, gcc defaults to 10.6. I ve tried -isysroot /Developer/SDKs/...
We can get the type returned by function in gcc using the typeof operator as follows: typeof(container.begin()) i; Is it possible to do something similar for functions taking some arguments, but not ...
Is it possible to create binaries of other platform on Linux? Say I have a program that can be compiled using gcc to .o file but can we use it to output exe that can be run on windows ?