<html><body><div style="font-size: 12pt; font-family: Calibri,sans-serif;">Hello,<div>EmbToolkit may be an option for you.</div><div>The latest git source tree is able to give you the needed --sysroot env (with different choices of c library) for you target arm, a cross compiler (clang/llvm or gcc, or both), build Linux kernel (gcc cross compiler), build a root filesystem.</div><div>All this under Mac os X.</div><div><br></div><div>Cheers,</div><div> awg</div><br><div id="htc_header">----- Reply message -----<br>De : "Hanbing Li" <hanbing.li@inria.fr><br>Pour : <llvmdev@cs.uiuc.edu><br>Objet : [LLVMdev] Cross-compiler to arm<br>Date : jeu., nov. 6, 2014 18:21</div></div><br><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Hi list,</div><div><br></div><div>I want to use LLVM to compile the C code to arm.</div><div>Host: Mac OS X 10.10</div><div>Target: Pandaboard, armv7l, ubuntu</div><div><br></div><div>I found some useful information but not worked yet.</div><div><br></div><div>I tried like this:</div><div><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">$ clang -fomit-frame-pointer -ggdb -emit-llvm --target=armv7l-unknown-linux-eabi -mcpu=cortex-a9 —mfpu=neon -mfloat-abi=softfp --sysroot=/... test.c -c -o test.bc</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">--></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">clang-3.5: error: no such file or directory: '—mfpu=neon'</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">clang-3.5: error: -emit-llvm cannot be used when linking</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">clang-3.5: error: no such file or directory: '—-sysroot=...'</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;" data-mce-style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;"><span data-mce-type="bookmark" id="mce_25_start" style="overflow:hidden;line-height:0px" data-mce-style="overflow: hidden; line-height: 0px;"></span>when I tried like this: </span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">$ clang -fomit-frame-pointer -ggdb -emit-llvm --target=armv7l-unknown-linux-eabi -mcpu=cortex-a9 test.c -c -o test.bc</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;" data-mce-style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">It worked. Then I did:</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">$ llc test.bc -o test.s</p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: 'times new roman', 'new york', times, serif; font-size: medium;" data-mce-style="font-family: 'times new roman', 'new york', times, serif; font-size: medium;">And sent the test.s to the </span><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;">pandaboard. On the board, I did:</span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;"></span><span style="font-family: Menlo; font-size: 11px;" data-mce-style="font-family: Menlo; font-size: 11px;">$ as -o test.o test.s</span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: Menlo; font-size: 11px;" data-mce-style="font-family: Menlo; font-size: 11px;">$ </span><span style="font-family: Menlo; font-size: 11px;" data-mce-style="font-family: Menlo; font-size: 11px;">ld -e main -o a.out test.o</span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;"></span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">$ ./a.out</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">--></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;">Segmentation fault (core dumped)</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">This is what I got. </span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">The test.c is very simple. Even like</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">int main(){</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">int i=0;</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">return 0;</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">}</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">Still no work.</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;"><br></span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;">BTW, someone said: <span style="color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff;" data-mce-style="color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff;">Toolchain on host : </span><span style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Arial, Helvetica, sans-serif; background-color: #f4f5f7; color: #555555; font-size: 12px; line-height: 17px;" data-mce-style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Arial, Helvetica, sans-serif; background-color: #f4f5f7; color: #555555; font-size: 12px; line-height: 17px;">sudo apt-get install gcc-arm-linux-gnueabi</span></span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: 'times new roman', 'new york', times, serif; font-size: medium;">How to realize this in MacOS?(port or brew)? I also found something here: <a href="https://launchpad.net/gcc-arm-embedded/+download">https://launchpad.net/gcc-arm-embedded/+download</a>. </span><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;"><br></span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: 'times new roman', 'new york', times, serif; font-size: medium;">Is this the same thing or not?</span></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-size: medium; font-family: 'times new roman', 'new york', times, serif;"><br></span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;">Does anyone know how to cross-compile from MacOS to arm? Or tell me what's wrong with my operations! Any suggestion or information is appreciated!</span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;"><br></span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;">Thanks,</span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;">Hanbing</span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;"><br></span></p><p style="margin: 0px;" data-mce-style="margin: 0px; font-size: 11px; font-family: Menlo;"><span size="3" data-mce-style="font-size: medium;" style="font-size: medium;"><br></span></p></div></div></body></html>