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?
According to the following websites:
https://www.bountysource.com/issues/5139020-linux-arm-platform-support-missing-for-compiler-rt-cross-compiler
https://www.bountysource.com/issues/5139002-addresssanitizer-tests-fail-with-dllvm_targets_to_build-arm
It seems that the makefile does not support non-X86 targets. Someone tried cmake failed as well. Any suggestions?
Thanks,
Chao
It seems that the cmake only works for X86 target?
Thanks,
Chao
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.
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
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.
I also use my own Makefiles to build compiler-rt for ELLCC. I build for ARM, Mips, Microblaze, PowerPC, and x86. This is the list of files I came up with: http://ellcc.org/viewvc/svn/ellcc/trunk/libecc/src/compiler-rt/sources.mk?view=markup
More info at http://ellcc.org
-Rich
I've check the compiler-rt source code and try to run "make
arm-linux-engeabi" in ellcc/libecc directory. I got the following errors:
Making libcompiler-rt for arm-linux-engeabi in compiler-rt-build
arm-linux-engeabi
cp: cannot stat ‘Makefile.lib’: No such file or directory
I've searched through the directory but there is no "Makefile.lib". Run
"locate Makefile.lib" I find:
/usr/src/linux-headers-3.13.0-45/scripts/Makefile.lib
/usr/src/linux-headers-3.13.0-45/scripts/dtc/libfdt/Makefile.libfdt
/usr/src/linux-headers-3.13.0-45-generic/scripts/Makefile.lib
/usr/src/linux-headers-3.13.0-46/scripts/Makefile.lib
/usr/src/linux-headers-3.13.0-46/scripts/dtc/libfdt/Makefile.libfdt
/usr/src/linux-headers-3.13.0-46-generic/scripts/Makefile.lib
/usr/src/linux-headers-3.13.0-48/scripts/Makefile.lib
/usr/src/linux-headers-3.13.0-48/scripts/dtc/libfdt/Makefile.libfdt
/usr/src/linux-headers-3.13.0-48-generic/scripts/Makefile.lib
I've tried to use these Makefile.lib but they are not working properly:
arm-linux-engeabi
make[1]: *** No rule to make target `install'. Stop.
Am I missing something? BTW in your makefile line 49:
$(OUT)cp -p Makefile.lib compiler-rt-build/$@/Makefile
The $(OUT) stuff at the beginning seems not useful?
Thanks,
Chao
Hi Chao, I don’t want to bring noise to the mailing list. I’ll respond privately. -Rich