LLVM Cross-Compiler: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
No edit summary |
m Bot: Replace deprecated source tag with syntaxhighlight |
||
Line 30: | Line 30: | ||
For GIT, in bash: |
For GIT, in bash: |
||
< |
<syntaxhighlight lang="bash"> |
||
mkdir crossllvm |
mkdir crossllvm |
||
cd crossllvm |
cd crossllvm |
||
Line 38: | Line 38: | ||
cd ../projects |
cd ../projects |
||
git clone http://llvm.org/git/compiler-rt.git |
git clone http://llvm.org/git/compiler-rt.git |
||
</syntaxhighlight> |
|||
</source> |
|||
For SVN, in bash: |
For SVN, in bash: |
||
< |
<syntaxhighlight lang="bash"> |
||
mkdir crossllvm |
mkdir crossllvm |
||
cd crossllvm |
cd crossllvm |
||
Line 50: | Line 50: | ||
cd ../projects |
cd ../projects |
||
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt |
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt |
||
</syntaxhighlight> |
|||
</source> |
|||
=== Building from sources (Possibly Unstable) === |
=== Building from sources (Possibly Unstable) === |
||
After having checked out the sources (see above), in bash, from the "crossllvm" directory: |
After having checked out the sources (see above), in bash, from the "crossllvm" directory: |
||
< |
<syntaxhighlight lang="bash"> |
||
mkdir build |
mkdir build |
||
cd build |
cd build |
||
Line 60: | Line 60: | ||
make |
make |
||
make install |
make install |
||
</syntaxhighlight> |
|||
</source> |
|||
Note: This Autoconf build has been removed from current versions of the LLVM build. All new builds must use CMake. |
Note: This Autoconf build has been removed from current versions of the LLVM build. All new builds must use CMake. |
||
Line 66: | Line 66: | ||
Or with CMake (adjust the source path as needed): |
Or with CMake (adjust the source path as needed): |
||
< |
<syntaxhighlight lang="bash"> |
||
mkdir build |
mkdir build |
||
cd build |
cd build |
||
Line 72: | Line 72: | ||
make |
make |
||
make install |
make install |
||
</syntaxhighlight> |
|||
</source> |
|||
Now you have got LLVM and Clang built! |
Now you have got LLVM and Clang built! |
||
Line 82: | Line 82: | ||
=== Debian === |
=== Debian === |
||
Open a terminal |
Open a terminal |
||
< |
<syntaxhighlight lang="bash"> |
||
sudo apt-get install clang |
sudo apt-get install clang |
||
</syntaxhighlight> |
|||
</source> |
|||
Note, you might have to disable host functionality. See Useful Flags |
Note, you might have to disable host functionality. See Useful Flags |
||
== Building libc++ == |
== Building libc++ == |
||
< |
<syntaxhighlight lang="bash"> |
||
$ git clone http://llvm.org/git/libcxx.git |
$ git clone http://llvm.org/git/libcxx.git |
||
$ export TRIPLE=-apple- |
$ export TRIPLE=-apple- |
||
$ cd libcxx/lib |
$ cd libcxx/lib |
||
$ ./buildit |
$ ./buildit |
||
</syntaxhighlight> |
|||
</source> |
|||
Built libc++ is not installed by default, you can use make install or copy files manually. |
Built libc++ is not installed by default, you can use make install or copy files manually. |
||
Line 103: | Line 103: | ||
For example, for cross compiling to ARM, you can use |
For example, for cross compiling to ARM, you can use |
||
< |
<syntaxhighlight lang="bash"> |
||
-march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-elf |
-march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-elf |
||
</syntaxhighlight> |
|||
</source> |
|||
Since 3.1, it can be shortened to |
Since 3.1, it can be shortened to |
||
< |
<syntaxhighlight lang="bash"> |
||
-target armv7--eabi -mcpu=cortex-a9 |
-target armv7--eabi -mcpu=cortex-a9 |
||
</syntaxhighlight> |
|||
</source> |
|||
An example for compiling to a generic X86 ELF target would be: |
An example for compiling to a generic X86 ELF target would be: |
||
< |
<syntaxhighlight lang="bash"> |
||
--target=i686-pc-none-elf -march=i686 |
--target=i686-pc-none-elf -march=i686 |
||
</syntaxhighlight> |
|||
</source> |
|||
=== Useful Flags === |
=== Useful Flags === |