digitalmars.D.ldc - Cross compiling linux x86_64 to linux arm
I created runtime and phobos lib for arm as described here: https://wiki.dlang.org/Building_LDC_runtime_libraries This command ran and created the libs successfully: CC=arm-linux-gnueabihf-gcc ldc-build-runtime --ninja --dFlags="-w;-mtriple=arm-linux-gnueabihf" --targetSystem="Linux;UNIX" Now I am confused how to use these files to cross compile my application. I tried: ldc2 -mtriple=arm-linux-gnueabihf lib/libdruntime-ldc.a lib/libphobos2-ldc.a app.d /usr/bin/ld: app.o: Relocations in generic ELF (EM: 40) (above line repeated several times) /usr/bin/ld: app.o: Relocations in generic ELF (EM: 40) app.o: error adding symbols: File in wrong format collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 It failed with above error, any help is appreciated.
Apr 09 2018
On Monday, 9 April 2018 at 22:30:20 UTC, user wrote:I created runtime and phobos lib for arm as described here: https://wiki.dlang.org/Building_LDC_runtime_libraries This command ran and created the libs successfully: CC=arm-linux-gnueabihf-gcc ldc-build-runtime --ninja --dFlags="-w;-mtriple=arm-linux-gnueabihf" --targetSystem="Linux;UNIX" Now I am confused how to use these files to cross compile my application. I tried: ldc2 -mtriple=arm-linux-gnueabihf lib/libdruntime-ldc.a lib/libphobos2-ldc.a app.d /usr/bin/ld: app.o: Relocations in generic ELF (EM: 40) (above line repeated several times) /usr/bin/ld: app.o: Relocations in generic ELF (EM: 40) app.o: error adding symbols: File in wrong format collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 It failed with above error, any help is appreciated.You need to use the C cross-compliler and the linker it prefers in order for linking to work. See this wiki page for examples: https://wiki.dlang.org/Programming_in_D_tutorial_on_Embedded_Linux_ARM_devices You can also set CC to the C cross-compiler and pass many linker options from the command-line if you want: https://wiki.dlang.org/Build_D_for_Android#Cross-compilation_3
Apr 09 2018