[LLVMdev] How to Cross Compile libcompiler_rt Static Library?
705 views
Skip to first unread message
Chao Yan
unread,
Mar 29, 2015, 4:18:15 AM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to LLVM Developers Mailing List
Hi,
I've cross-compiled musl-libc to arm binaries with clang. It needs functions from static runtime library "libcompiler_rt.a". I tried to build compile_rt outside the llvm source tree. Using command like "make clang_linux", I can easily build "libcompiler_rt.a" for my host machine, which is X86_64. But how can I *cross-compile* the compiler_rt runtime libraries?
It seems that the makefile does not support non-X86 targets. Someone tried cmake failed as well. Any suggestions?
Thanks,
Chao
Ed Schouten
unread,
Mar 29, 2015, 4:36:50 AM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chao Yan, LLVM Developers Mailing List
Hi there,
2015-03-29 10:14 GMT+02:00 Chao Yan <yanch...@gmail.com>:
> I've cross-compiled musl-libc to arm binaries with clang. It needs functions
> from static runtime library "libcompiler_rt.a". I tried to build compile_rt
> outside the llvm source tree. Using command like "make clang_linux", I can
> easily build "libcompiler_rt.a" for my host machine, which is X86_64. But
> how can I *cross-compile* the compiler_rt runtime libraries?
I am cross-compiling compiler-rt for my specific use-case. That said,
I'm cross-compiling from x86-64 to x86-64, but for a different ABI.
This is what I use:
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ed Schouten, LLVM Developers Mailing List
2015-03-29 3:33 GMT-05:00 Ed Schouten <e...@80386.nl>:
I am cross-compiling compiler-rt for my specific use-case. That said,
I'm cross-compiling from x86-64 to x86-64, but for a different ABI.
This is what I use:
As you can see, I'm using CMake. Works pretty well so far. Hopefully
something like this will work for you as well?
I tried "cmake ../compiler-rt -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_NATIVE_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DTARGET_TRIPLE=armv-none-linux-gnueabi -DCMAKE_CROSSCOMPILING=True". It will still build X86_64 version.
I also tried "cmake ../compiler-rt -DCMAKE_C_COMPILER=/usr/local/arm-2009q3/bin/arm-none-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=/usr/local/arm-2009q3/bin/arm-none-linux-gnueabi-g++ -DLLVM_NATIVE_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DTARGET_TRIPLE=armv-none-linux-gnueabi -DCMAKE_CROSSCOMPILING=True
". the configure process generate errors:
CMake Error at cmake/config-ix.cmake:111 (message):
Cannot compile for x86_64:
It seems that the cmake only works for X86 target?
Thanks,
Chao
Daniel Dilts
unread,
Mar 29, 2015, 3:55:07 PM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chao Yan, LLVM Developers Mailing List
I asked about this same question in the past (month or three ago). It is not possible to cross compile compiler-rt on Windows. If you want to cross compile you should use the make build system, not the CMake build system.
Daniel Dilts
unread,
Mar 29, 2015, 4:14:00 PM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chao Yan, LLVM Developers Mailing List
I need to correct myself. It is possible to cross compile it on Windows, but not using the provided build systems.
Chao Yan
unread,
Mar 29, 2015, 4:31:52 PM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
I need to correct myself. It is possible to cross compile it on Windows, but not using the provided build systems.
Hi Daniel,
Thanks for helping. I'm using ubuntu 14.04 x86_64 system. I've tried cmake for couple of days until I give up. You are right, using make build system seems more feasible. I've combined the compiler_rt/make/platform/clang_linux.mk and the compiler_rt/make/platform/clang_macho_embedded.mk. So far it could cross-compile all of the files in "compiler-rt/lib/builtins/" (*.c files). However, the libcompiler_rt.a still missing functions such as "__aeabi_memset", "__aeabi_memcpy". These functions were in "compiler_rt/lib/biltins/arm/" (*.S) files. They are not included in any of the *.mk files. Do you have any idea on how to add these assembly sources to the build list? BTW, did you build the complete libcompiler_rt.a at the end?
Thanks,
Chao
Daniel Dilts
unread,
Mar 29, 2015, 5:14:43 PM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chao Yan, LLVM Developers Mailing List
I was attempting to cross compile on Windows. I ended up having to find the list in the CMake build system (not very hard) and manually creating a makefile to compile them. Took maybe 2 hours total.
Richard Pennington
unread,
Mar 29, 2015, 8:46:29 PM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to llv...@cs.uiuc.edu
On 03/29/2015 04:11 PM, Daniel Dilts wrote:
> I was attempting to cross compile on Windows. I ended up having to
> find the list in the CMake build system (not very hard) and manually
> creating a makefile to compile them. Took maybe 2 hours total.
>