digitalmars.D.ldc - merge-2.067: Cross compiling for AArch64
- Kai Nacke (39/39) May 05 2015 Hi!
- Dan Olson (2/4) May 06 2015 Nice. I plan to follow in a month with hardware.
- Kai Nacke (5/10) May 07 2015 Note that the vararg code is currently horrible broken (ICE).
- Temtaime (1/1) May 07 2015 It's good to hear about aa64. But what about win32?
- Kai Nacke (7/8) May 07 2015 Win32 exception handling is currently added to LLVM. If this is
- Temtaime (3/3) May 08 2015 I'm glad to hear that :)
- Johan Engelen (2/2) May 07 2015 Great stuff. I think you should add this to the wiki somewhere!
- Kai Nacke (4/6) May 07 2015 I added the status to the wiki. Thanks for the hint.
Hi! The merge-2.067 is already in a good shape. I though I could try to cross compile to AArch64. Normally I use real hardware for porting but AArch64 metal is still rare. Here is what I did: I am using Gentoo Linux. First I emerged qemu with QEMU_USER_TARGETS="aarch64". There is nothing special here - it compiles a qemu-aarch64 binary. The next step was to create a cross compiler with crossdev: USE="-fortran -sanitize" crossdev -t aarch64-pc-linux-gnu This created gcc 4.8.4, binutils 2.25 and glibc 2.20 for AArch64. It is a bit tricky to find a working triple and the right versions to use. In order to create the D libraries for AArch64, I needed to change the file runtime/CMakeLists.txt in the LDC source. Before the main configuration I added set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_C_COMPILER aarch64-pc-linux-gnu-gcc) set(CMAKE_CXX_COMPILER aarch64-pc-linux-gnu-c++) This tells CMake to use the cross compiler. I also added -mtriple=aarch64-pc-linux-gnu to the D_FLAGS variable. Run cmake and compile with make -k. You might need to run make twice. There is still a problem with core.stdc.stdarg and phobos has still errors because of this. The libraries in the lib folder are compiled for AArch64. Create a "Hello World" program and compile it with: bin/ldc2 -mtriple=aarch64-pc-linux-gnu -gcc=aarch64-pc-linux-gnu-gcc -L-rpath=/usr/lib/gcc/aarch64-pc-linux-gnu/4.8.4 (I add the -rpath= option because I do not know how to tell qemu where to find libgcc_s.so.) To execute the binary just type qemu-aarch64 -L /usr/aarch64-pc-linux-gnu ./hello Success! I could also run a unittest - e.g. core.bitop. I hope this post helps if someone wants to cross compile to a different architecture. Regards, Kai
May 05 2015
"Kai Nacke" <kai redstar.de> writes:The merge-2.067 is already in a good shape. I though I could try to cross compile to AArch64.Nice. I plan to follow in a month with hardware.
May 06 2015
On Thursday, 7 May 2015 at 03:44:38 UTC, Dan Olson wrote:"Kai Nacke" <kai redstar.de> writes:Note that the vararg code is currently horrible broken (ICE). Which hardware do you want to use? iPhone? Regards, KaiThe merge-2.067 is already in a good shape. I though I could try to cross compile to AArch64.Nice. I plan to follow in a month with hardware.
May 07 2015
"Kai Nacke" <kai redstar.de> writes:On Thursday, 7 May 2015 at 03:44:38 UTC, Dan Olson wrote:Yeah - iPhone"Kai Nacke" <kai redstar.de> writes:Note that the vararg code is currently horrible broken (ICE). Which hardware do you want to use? iPhone?The merge-2.067 is already in a good shape. I though I could try to cross compile to AArch64.Nice. I plan to follow in a month with hardware.
May 08 2015
Dan Olson <zans.is.for.cans yahoo.com> writes:"Kai Nacke" <kai redstar.de> writes:Oh, and an Android arm64 tablet too. I have to wait until mid-summer though because I am in a busy spell right now.On Thursday, 7 May 2015 at 03:44:38 UTC, Dan Olson wrote:Yeah - iPhone"Kai Nacke" <kai redstar.de> writes:Note that the vararg code is currently horrible broken (ICE). Which hardware do you want to use? iPhone?The merge-2.067 is already in a good shape. I though I could try to cross compile to AArch64.Nice. I plan to follow in a month with hardware.
May 18 2015
It's good to hear about aa64. But what about win32?
May 07 2015
On Thursday, 7 May 2015 at 15:15:01 UTC, Temtaime wrote:It's good to hear about aa64. But what about win32?Win32 exception handling is currently added to LLVM. If this is done I will create a native Win32 client. (Yes, I consider the Windows platform important. But the exception handling stuff is very complicated and easily broken...) Regards, Kai
May 07 2015
I'm glad to hear that :) I'll try to build ldc with llvm trunk today i think as win64 target.
May 08 2015
Great stuff. I think you should add this to the wiki somewhere! -Johan
May 07 2015
On Thursday, 7 May 2015 at 19:08:13 UTC, Johan Engelen wrote:Great stuff. I think you should add this to the wiki somewhere! -JohanI added the status to the wiki. Thanks for the hint. Regards, Kai
May 07 2015