Simple Note created on Jun 02 - 2009 9:07 PM on Cross-compile on Mac OS X
for Win32 and Linux
Compile Win32 exe on Mac OS X
For Mac OS X 10.4 "Tiger"
use the older version,
http://crossgcc.rts-software.org/doku.php?do=revisions&id=start
since Tiger is born in 2007, use the version minGW 3.4.5.
For Mac OS X 10.5 Leopard and newer
use MinGW 4.3.0 above for Mac OS X and newer;
Link: http://crossgcc.rts-software.org/doku.php?id=start
Guide on the commands of compile code
Check the sample code of the related compiler's download page, like
g++ -o hello.out hello.cpp g++ file1.cpp file2.cpp file3.cpp # for multiple file into one program g++ -o lab7.out file1.cpp file2.cpp file3.cpp
Compile Linux binary on Mac OS X
- not much problem
- install i386-linux-gcc 4.1.1 above for Mac OS X (Intel) or newer at the same page above
- the output of the binary program is a.out
Issue and Problems
- “libiconv.2.dylib 7.0.0 version not found” problem on Mac OS X 10.4.
Because the Tiger use version 5 of that library, so new compiler born at Leopard time may expect version 7, so use a old version compiler on Tiger can solve the problem. - No new line at end of file when compiling Linux
Because there is “end of line tag” needed as \n on Unix;
while mac os use \r, thus, press an extra return in code for Linux.
Tips
set Path environment Method 1:
- open .profile
- export PATH=$PATH:/new_path_entry
- add above and close