From b42405f4ed80218cdfbf9b94aad048e01f088f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20P=C3=B6chtrager?= Date: Wed, 13 Nov 2013 20:47:04 +0100 Subject: [PATCH] switch to a markdown-formatted README --- README | 40 ------------------- README.gcc | 17 -------- README.md | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 57 deletions(-) delete mode 100644 README delete mode 100644 README.gcc create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index d12ae55..0000000 --- a/README +++ /dev/null @@ -1,40 +0,0 @@ -- OSXCross: OS X cross toolchain for linux - - -OSXCross is a tool which helps you to cross compile source code easily with clang on linux for OS X. - -After the installation you will have "o32-clang", "o32-clang++", "o64-clang" and "o64-clang++" available as compiler. - -You can optionally build an update-to-date gcc as well, please see README.gcc. - -Make sure you have the following installed on your linux-system: - - Clang 3.2+, llvm-devel, automake, autogen, libtool, - libxml2-devel, libuuid-devel, openssl-devel and the bash shell - -Then edit TARGET and so on in build.sh, so it fits your requirements. - -Then run - -./build.sh - -to build the OS X cross toolchain (it will guide you through the installation). - - -SDK Download: - - * Links: - - * Installation: - -> Download the SDK to the tarballs/ directory and do not forget to adjust - -> the SDK_VERSION in build.sh! - - -LICENSE: - bash scripts: GPLv2 - cctools: APSL 2.0 - xar: New BSD - - -CREDITS: - cjacker for the CCTOOLS linux port, checkout his ios-toolchain-based-on-clang-for-linux project: - https://code.google.com/p/ios-toolchain-based-on-clang-for-linux diff --git a/README.gcc b/README.gcc deleted file mode 100644 index b884d36..0000000 --- a/README.gcc +++ /dev/null @@ -1,17 +0,0 @@ -- OSXCross: OS X cross toolchain for linux - - -After finishing ./build.sh you can optionally build gcc as well. - -Don't forget to run "source ~/.profile" after adding the PATH exports to your .bashrc or .profile, -or simply start a new shell session. - -Then make sure you have got the build dependencies for gcc installed on your system, -see: http://gcc.gnu.org/install/prerequisites.html - -On debian like systems you can run 'apt-get build-dep gcc' to install them. - -After that edit GCC_VERSION in build_gcc.sh, so it fits your requirements, then finally -run ./build_gcc.sh to start building gcc. - -If everything went well, then you'll have "x86_64-apple-darwinXX-gcc, i386-apple-darwinXX-g++" -(or o32-gcc, o64-g++, ... as shortcuts) available as compiler. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a15a58 --- /dev/null +++ b/README.md @@ -0,0 +1,112 @@ +# OSXCross: OS X cross toolchain for Linux # + +### WHAT IS THE GOAL OF OSXCROSS? ### + +The goal of OSXCross is to deliever you a high quality cross toolchain targeting OS X on Linux. + +### HOW DOES IT WORK? ### + +[Clang/LLVM is a cross compiler by default](http://clang.llvm.org/docs/CrossCompilation.html) and is now available on nearly every Linux distrubtion. +Therefore we "just" need a proper +[port](https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/source/browse/#svn%2Ftrunk%2Fcctools-porting%2Fpatches) +of the [cctools](http://www.opensource.apple.com/tarballs/cctools) (ld, lipo, ...) for Linux, and the OS X SDK. + +If you want, then you can build an up-to-date vanilla GCC as well. + +### WHAT IS NOT WORKING (YET)? ### + +* Clang: + * using [libc++](http://libcxx.llvm.org/) (`-stdlib=libc++`) doesn't work yet (missing headers, besides that it should work) +* GCC: + * debug info is weak, because of the [missing](https://github.com/tpoechtrager/osxcross/blob/master/patches/gcc-dsymutil.patch) + [`dsymutil`](http://www.manpagez.com/man/1/dsymutil) (shows only function names, no line numbers) + * GCC itself [doesn't build with GCC](https://github.com/tpoechtrager/osxcross/commit/12f5dcdde4bc1000180d25ffda229f0a13cf723d), +but builds fine when clang is used to build GCC + +Everything else besides that should work. + +### WHAT CAN I BUILD WITH IT? ### + +Basically everything you can build on OS X with clang/gcc should build with this cross toolchain as well. + +### INSTALLATION: ### + +Download the SDK version you want to the tarball/ (important!) directory. + +Then assure you have the following installed on your Linux box: + +`Clang 3.2+`, `llvm-devel`, `automake`, `autogen`, `libtool`, +`libxml2-devel`, `libuuid-devel`, `openssl-devel` and the `bash shell`. + +Now edit the `SDK_VERSION` in `build.sh`, so it matches the version you have downloaded before. + +Then run `./build.sh` to build the cross toolchain (It will build in it's own directory). + +**Don't forget** to add the printed `export PATH=...` to your `~/.profile` or `~/.bashrc`. +Then either run `source ~/.profile` or restart your shell session. + +That's it. See Usage Examples below. + +##### Building GCC: ##### + +If you want to build GCC as well, then you can do this by running `./build_gcc.sh`. +But before you do this, make sure you have got the gcc build depedencies installed on your system, +on debian like systems you can run `apt-get build-dep gcc` to install them. + +### SDK DOWNLOAD LINKS: ### + +### Usage Examples: ### + +##### Let's say you want to compile a file called test.cpp, then you can do this by running: ##### + +* Clang: + + * 32 bit: `o32-clang test.cpp -O3 -o test` OR `i386-apple-darwinXX-clang test.cpp -O3 -o test` + * 64 bit: `o64-clang test.cpp -O3 -o test` OR `x86_64-apple-darwinXX-clang test.cpp -O3 -o test` + +* GCC: + + * 32 bit: `o32-gcc test.cpp -O3 -o test` OR `i386-apple-darwinXX-gcc test.cpp -O3 -o test` + * 64 bit: `o64-gcc test.cpp -O3 -o test` OR `x86_64-apple-darwinXX-gcc test.cpp -O3 -o test` + +XX= the target version, you can find it out by running `osxcross-conf` and then see TARGET. + +You can use the shorting `o32-...` or `i386-apple-darwin...` what ever you like more. + +*I'll continue from now on with `o32-clang`, but remember you can simply replace it with `o32-gcc` or `i386-apple-darwin...`* + +##### Building Makefile based projects: ##### + + `make CC=o32-clang CXX=o32-clang++` + +##### Building automake based projects: ##### + + `CC=o32-clang CXX=o32-clang++ ./configure --host=i386-apple-darwinXX` + +##### Building test1.cpp and test2.cpp with LTO (Link Time Optimization): ##### + + * build the first object file: `o32-clang++ test1.cpp -O3 -flto -c` + * build the second object file: `o32-clang++ test2.cpp -O3 -flto -c` + * link them with LTO: `o32-clang++ -O3 -flto test1.o test2.o -o test` + +##### Building a universal binary: ##### + +clang: + + `o64-clang++ test.cpp -O3 -arch i386 -arch x86_64 -o test` + +GCC: + + * build the 32 bit binary: `o32-g++ test.cpp -O3 -o test.i386` + * build the 64 bit binary: `o64-g++ test.cpp -O3 -o test.x86_64` + * use lipo to generate the universal binary: `x86_64-apple darwinXX-lipo -create test.i386 test.x86_64 -output test` + + +### LICENSE: #### + * bash scripts: GPLv2 + * cctools: APSL 2.0 + * xar: New BSD + + +### CREDITS: #### + * [cjacker for the cctools linux port](https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/source/browse/#svn%2Ftrunk%2Fcctools-porting%2Fpatches)