Journeyer J. Joh
2012-Jun-20 07:40 UTC
[LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
Hello, Thank you for your kind attention to my issue and your help. I changed the tool chain and tried again. And there is a little progress but still have some problem. Using --sysroot doesn't make clang use linker(ld) in the cross tool. Most important question is how I can make clang use cross tool linker. Let me show you my experiment and questions below. There are two questions. [Run] ./clang -v --save-temps -emit-llvm -ccc-host-triple arm-none-linux-gnueabi --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc hello.c [Question] 1. How am I supposed to use --sysroot? Though I used "--sysroot" above, Clang uses native linker, "/usr/bin/ld" not the one in the tool chain, "/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-ld". [Output] clang version 3.2 (trunk 158784) Target: arm-none-linux-gnueabi Thread model: posix "/home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/clang" -cc1 -triple armv4t-none-linux-gnueabi -E -disable-free -main-file-name hello.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-abi aapcs-linux -target-cpu arm7tdmi -mfloat-abi soft -target-feature +soft-float-abi -target-linker-version 2.22 -momit-leaf-frame-pointer -v -resource-dir /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2 -isysroot /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/local/include -internal-isystem /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2/include -internal-externc-isystem /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/include -internal-externc-isystem /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/include -fno-dwarf-directory-asm -fdebug-compilation-dir /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin -ferror-limit 19 -fmessage-length 205 -mstackrealign -fno-signed-char -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o hello.i -x c hello.c clang -cc1 version 3.2 based upon LLVM 3.2svn default target i386-pc-linux-gnu ignoring nonexistent directory "/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/local/include" ignoring nonexistent directory "/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/include" #include "..." search starts here: #include <...> search starts here: /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2/include /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/include End of search list. "/home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/clang" -cc1 -triple armv4t-none-linux-gnueabi -emit-llvm-bc -disable-free -main-file-name hello.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-abi aapcs-linux -target-cpu arm7tdmi -mfloat-abi soft -target-feature +soft-float-abi -target-linker-version 2.22 -momit-leaf-frame-pointer -v -resource-dir /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2 -fno-dwarf-directory-asm -fdebug-compilation -dir /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin -ferror-limit 19 -fmessage-length 205 -mstackrealign -fno-signed-char -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o hello.o -x cpp-output hello.i clang -cc1 version 3.2 based upon LLVM 3.2svn default target i386-pc-linux-gnu #include "..." search starts here: End of search list. "/usr/bin/ld" <<<<<<<<<< Problem #1 : wrong linker! ld in cross toolchain is needed! --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc -z relro -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux.so.3 <<<<<<<<<< Problem #2 : All libraries have to be of the cross toolchain! -o a.out /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crt1.o /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crti.o crtbegin.o <<<<<<<<<< Problem #3 : All libraries have to be of the cross toolchain! (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o needs to be used!!!) -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/lib -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib -plugin /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/LLVMgold.so <<<<<<<<<< Problem #4 : There is no LLVMgold.so in llvm/clang bin/ hello.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o <<<<<<<<<< Problem #5 : All libraries have to be of the cross toolchain! (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o needs to be used!!!) /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crtn.o /usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi Supported emulations: elf_i386 i386linux elf32_x86_64 elf_x86_64 elf_l1om elf_k1om clang: error: linker command failed with exit code 1 (use -v to see invocation) Problem #1 : wrong linker! ld in cross toolchain is needed! Problem #2 : All libraries have to be of the cross toolchain! Problem #3 : All libraries have to be of the cross toolchain! (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o needs to be used!!!) Problem #4 : There is no LLVMgold.so in llvm/clang bin/ Problem #5 : All libraries have to be of the cross toolchain! (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o needs to be used!!!) Workaround #1 : tried to run /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/bin/ld manually. Workaround #2 : Ignored this library in this manual run. Workaround #3 : /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o used instead. Workaround #4 : Ignored this library in this manual run. Workaround #5 : /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o used instead. [Workaround - Manual Run] /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-ld --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc -z relro -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -o a.out /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crt1.o /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crti.o /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/lib -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib hello.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crtn.o [Output] hello.o: file not recognized: File format not recognized [Test] "file hello.o" prints out : hello.o: LLVM bitcode [Question] 2. Am I using a wrong cross toolchain? Doesn't feeding LLVM bitcode to the ARM cross linker make sense? Thank you very much. Sincerely Journeyer J. Joh 2012/6/19 Anton Korobeynikov <anton at korobeynikov.info>> Hello > > > ./clang -v -emit-llvm -ccc-host-triple arm-none-linux-gnueabi > > -I/home/hum/Documents/Projects/llvm_clang/gnuarm-4.0.2/arm-elf/include > > -L/home/hum/Documents/Projects/llvm_clang/gnuarm-4.0.2/arm-elf/bin > hello.c > You forgot about sysroot here. > > > /home/hum/Documents/Projects/llvm_clang/gnuarm-4.0.2/arm-elf/bin/ld: > > unrecognised emulation mode: armelf_linux_eabi > > Supported emulations: armelf > 1. Your ld is too old > 2. Your ld was built for arm-elf, not arm-linux-eabi > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-- ---------------------------------------- Journeyer J. Joh o o s a p r o g r a m m e r a t g m a i l d o t c o m ---------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120620/431f8201/attachment.html>
Journeyer J. Joh
2012-Jun-20 08:59 UTC
[LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
Hello, Please ignore my previous email. I received the final binary with command below. I had to get rid of the option, -emit-llvm. ./clang -v --save-temps -ccc-host-triple arm-none-linux-gnueabi --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc hello.c file hello.i hello.i: ASCII C program text file hello.s hello.s: ASCII assembler program text /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-as -mfloat-abi=softfp -o hello.o hello.s file hello.o hello.o: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-ld --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc -z relro -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -o a.out /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crt1.o /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crti.o /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/lib -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t hello.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crtn.o file a.out a.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=0x7825ca07341b2f337c4f10b5711055c997820a9c, not stripped The only thing remained is to specify the cross tool chain location to the clang so that clang uses cross-as and ld automatically. If someone provide these information, it would be welcomed! Thank you very much. Journeyer J. Joh 2012/6/20 Journeyer J. Joh <oosaprogrammer at gmail.com>> Hello, > > Thank you for your kind attention to my issue and your help. > > I changed the tool chain and tried again. And there is a little progress > but still have some problem. > > Using --sysroot doesn't make clang use linker(ld) in the cross tool. > Most important question is how I can make clang use cross tool linker. > > Let me show you my experiment and questions below. > There are two questions. > > [Run] > ./clang -v --save-temps -emit-llvm -ccc-host-triple arm-none-linux-gnueabi > --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc > hello.c > > [Question] > 1. How am I supposed to use --sysroot? Though I used "--sysroot" above, > Clang uses native linker, "/usr/bin/ld" not the one in the tool chain, > "/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-ld". > > [Output] > clang version 3.2 (trunk 158784) > Target: arm-none-linux-gnueabi > Thread model: posix > > "/home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/clang" > -cc1 > -triple armv4t-none-linux-gnueabi > -E > -disable-free > -main-file-name hello.c > -mrelocation-model static > -mdisable-fp-elim > -fmath-errno > -mconstructor-aliases > -target-abi aapcs-linux > -target-cpu arm7tdmi > -mfloat-abi soft > -target-feature +soft-float-abi > -target-linker-version 2.22 > -momit-leaf-frame-pointer > -v > -resource-dir > /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2 > -isysroot > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc > -fmodule-cache-path /var/tmp/clang-module-cache > -internal-isystem > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/local/include > -internal-isystem > /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2/include > -internal-externc-isystem > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/include > -internal-externc-isystem > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/include > -fno-dwarf-directory-asm > -fdebug-compilation-dir > /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin > -ferror-limit 19 > -fmessage-length 205 > -mstackrealign > -fno-signed-char > -fgnu-runtime > -fobjc-runtime-has-arc > -fobjc-runtime-has-weak > -fobjc-fragile-abi > -fdiagnostics-show-option > -fcolor-diagnostics > -o hello.i > -x c > hello.c > > clang -cc1 version 3.2 based upon LLVM 3.2svn default target > i386-pc-linux-gnu > ignoring nonexistent directory > "/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/local/include" > ignoring nonexistent directory > "/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/include" > #include "..." search starts here: > #include <...> search starts here: > > /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2/include > > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/include > End of search list. > > > "/home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/clang" > -cc1 > -triple armv4t-none-linux-gnueabi > -emit-llvm-bc > -disable-free > -main-file-name hello.c > -mrelocation-model static > -mdisable-fp-elim > -fmath-errno > -mconstructor-aliases > -target-abi aapcs-linux > -target-cpu arm7tdmi > -mfloat-abi soft > -target-feature +soft-float-abi > -target-linker-version 2.22 > -momit-leaf-frame-pointer > -v > -resource-dir > /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/clang/3.2 > -fno-dwarf-directory-asm > -fdebug-compilation > -dir /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin > -ferror-limit 19 > -fmessage-length 205 > -mstackrealign > -fno-signed-char > -fgnu-runtime > -fobjc-runtime-has-arc > -fobjc-runtime-has-weak > -fobjc-fragile-abi > -fdiagnostics-show-option > -fcolor-diagnostics > -o hello.o > -x cpp-output > hello.i > > clang -cc1 version 3.2 based upon LLVM 3.2svn default target > i386-pc-linux-gnu > #include "..." search starts here: > End of search list. > > > "/usr/bin/ld" <<<<<<<<<< Problem #1 : wrong linker! ld in cross toolchain > is needed! > > --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc > -z relro > -X > --hash-style=gnu > --build-id > --eh-frame-hdr > -m armelf_linux_eabi > -dynamic-linker /lib/ld-linux.so.3 <<<<<<<<<< Problem #2 : All libraries > have to be of the cross toolchain! > -o a.out > > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crt1.o > > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crti.o > crtbegin.o <<<<<<<<<< Problem #3 : All libraries have to be of the cross > toolchain! > (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o > needs to be used!!!) > > -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/lib > > -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib > -plugin > /home/hum/Documents/Projects/clang_llvm/build/Debug+Asserts/bin/../lib/LLVMgold.so > <<<<<<<<<< Problem #4 : There is no LLVMgold.so in llvm/clang bin/ > hello.o > -lgcc > --as-needed > -lgcc_s > --no-as-needed > -lc > -lgcc > --as-needed > -lgcc_s > --no-as-needed > crtend.o <<<<<<<<<< Problem #5 : All libraries have to be of the cross > toolchain! > (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o > needs to be used!!!) > > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crtn.o > > /usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi > Supported emulations: elf_i386 i386linux elf32_x86_64 elf_x86_64 elf_l1om > elf_k1om > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > > Problem #1 : wrong linker! ld in cross toolchain is needed! > Problem #2 : All libraries have to be of the cross toolchain! > Problem #3 : All libraries have to be of the cross toolchain! > (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o > needs to be used!!!) > Problem #4 : There is no LLVMgold.so in llvm/clang bin/ > Problem #5 : All libraries have to be of the cross toolchain! > (/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o > needs to be used!!!) > > > Workaround #1 : tried to run > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/bin/ld > manually. > Workaround #2 : Ignored this library in this manual run. > Workaround #3 : > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o > used instead. > Workaround #4 : Ignored this library in this manual run. > Workaround #5 : > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o > used instead. > > > > [Workaround - Manual Run] > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-ld > --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc > -z relro -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi > -o a.out > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crt1.o > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crti.o > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtbegin.o > -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/lib > -L/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib > hello.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed > -lgcc_s --no-as-needed > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/crtend.o > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc/usr/lib/crtn.o > > [Output] > hello.o: file not recognized: File format not recognized > > [Test] > "file hello.o" prints out : > hello.o: LLVM bitcode > > [Question] > 2. Am I using a wrong cross toolchain? Doesn't feeding LLVM bitcode to the > ARM cross linker make sense? > > > > Thank you very much. > > Sincerely > Journeyer J. Joh > > > > > 2012/6/19 Anton Korobeynikov <anton at korobeynikov.info> > >> Hello >> >> > ./clang -v -emit-llvm -ccc-host-triple arm-none-linux-gnueabi >> > -I/home/hum/Documents/Projects/llvm_clang/gnuarm-4.0.2/arm-elf/include >> > -L/home/hum/Documents/Projects/llvm_clang/gnuarm-4.0.2/arm-elf/bin >> hello.c >> You forgot about sysroot here. >> >> > /home/hum/Documents/Projects/llvm_clang/gnuarm-4.0.2/arm-elf/bin/ld: >> > unrecognised emulation mode: armelf_linux_eabi >> > Supported emulations: armelf >> 1. Your ld is too old >> 2. Your ld was built for arm-elf, not arm-linux-eabi >> >> -- >> With best regards, Anton Korobeynikov >> Faculty of Mathematics and Mechanics, Saint Petersburg State University >> > > > > -- > ---------------------------------------- > Journeyer J. Joh > o o s a p r o g r a m m e r > a t > g m a i l d o t c o m > ---------------------------------------- > >-- ---------------------------------------- Journeyer J. Joh o o s a p r o g r a m m e r a t g m a i l d o t c o m ---------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120620/88b14326/attachment.html>
Journeyer J. Joh
2012-Jun-21 02:22 UTC
[LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
Hi Joerg, Thank you very much! I finally found a working command string to cross-compile for ARM on x86. ./clang -v --save-temps -ccc-host-triple arm-none-linux-gnueabi --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc -gcc-toolchain /home/hum/Documents/Projects/arm_toolchain/arm-2010.09 hello.c -o hello Above works fine! Important options are -ccc-host-triple arm-none-linux-gnueabi --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc -gcc-toolchain /home/hum/Documents/Projects/arm_toolchain/arm-2010.09 And the environment variable PATH doesn't need to be changed. Thank you everyone who answered for my questions. Regards Journeyer J. Joh 2012/6/20 Joerg Sonnenberger <joerg at britannica.bec.de>> On Wed, Jun 20, 2012 at 05:59:07PM +0900, Journeyer J. Joh wrote: > > > /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-ld > > Make sure the directory is in PATH, it will pick up LD automatically > then. > > Joerg >-- ---------------------------------------- Journeyer J. Joh o o s a p r o g r a m m e r a t g m a i l d o t c o m ---------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120621/a9a3a620/attachment.html>
Journeyer J. Joh
2012-Jun-27 12:24 UTC
[LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
Hello, With your kind concern and help, I now can make a binary for ARM target. ./clang -v --save-temps -ccc-host-triple arm-none-linux-gnueabi --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc -gcc-toolchain /home/hum/Documents/Projects/arm_toolchain/arm-2010.09 hello.c -o hello The build command is shown above. After that, I prepared an ARM laptop, AC100 - TOSHIBA. I installed Ubuntu 12.04 in the way guided from the link below. https://wiki.ubuntu.com/ARM/TEGRA/AC100 So I moved the final binary from host PC to AC100 and executed. But the binary DIDN'T RUN. $./hello returns an error message below. bash: ./hello: No such file hello I need to understand why it doesn't run on ARM laptop. I compiled another sample program hi.c on the ARM laptop and compared both - the one cross compiled "hello" and the other self host compiled "hi". Output message of utility "file" is almost the same except Linux version, one is 2.6.16 and the other is 2.6.31. But the output of "ldd" shows something meaningful. ldd hi libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ecf000) /lib/ld-linux-armhf.so.3 (0xb6fc3000) ldd hello not a dynamic executable I guess I have to use a cross toolchain for my ARM target - AC 100. It has been equipped with Ubuntu 12.04. Could you provide me any hint to analize this problem? Thank you in advance. Journeyer J. Joh 2012/6/21 Journeyer J. Joh <oosaprogrammer at gmail.com>> Hi Joerg, > > Thank you very much! > > I finally found a working command string to cross-compile for ARM on x86. > > ./clang -v --save-temps -ccc-host-triple arm-none-linux-gnueabi > --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc > -gcc-toolchain /home/hum/Documents/Projects/arm_toolchain/arm-2010.09 > hello.c -o hello > > Above works fine! Important options are > > -ccc-host-triple arm-none-linux-gnueabi > > --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc > -gcc-toolchain /home/hum/Documents/Projects/arm_toolchain/arm-2010.09 > > And the environment variable PATH doesn't need to be changed. > > Thank you everyone who answered for my questions. > > Regards > Journeyer J. Joh > > 2012/6/20 Joerg Sonnenberger <joerg at britannica.bec.de> > >> On Wed, Jun 20, 2012 at 05:59:07PM +0900, Journeyer J. Joh wrote: >> > >> /home/hum/Documents/Projects/arm_toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-ld >> >> Make sure the directory is in PATH, it will pick up LD automatically >> then. >> >> Joerg >> > > > > -- > ---------------------------------------- > Journeyer J. Joh > o o s a p r o g r a m m e r > a t > g m a i l d o t c o m > ---------------------------------------- > >-- ---------------------------------------- Journeyer J. Joh o o s a p r o g r a m m e r a t g m a i l d o t c o m ---------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120627/2f144ec6/attachment.html>
Reasonably Related Threads
- [LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
- [LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
- [LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
- [LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
- [LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?