<div dir="ltr">Anton,<div><br></div><div>The compiler I'm using is this one: <a href="https://launchpad.net/gcc-linaro/+milestone/4.8-2013.08">https://launchpad.net/gcc-linaro/+milestone/4.8-2013.08</a> . This just happens to be the latest linaro compiler installed on the central package database at ARM. I'd assume the ubuntu one would work just as well.</div>
<div><br></div><div>Cheers,</div><div><br></div><div>James</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 8 October 2013 17:09, Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I've noticed you've used linaro toolchain instead of ubuntu's gcc-4.7-arm-linux-gnueabihf (and other packages from <a href="http://llvm.org/docs/HowToCrossCompileLLVM.html" target="_blank">http://llvm.org/docs/HowToCrossCompileLLVM.html</a>).<div>

Can you write what packages should be downloaded and installed from <a href="http://www.linaro.org/downloads/" target="_blank">http://www.linaro.org/downloads/</a> ?</div><div><br></div><div>Thanks and regards,</div><div>
Anton.</div></div><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/8 Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Thanks, James.<div><br></div><div>I will give it a try right now!</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/8 James Molloy <span dir="ltr"><<a href="mailto:james@jamesmolloy.co.uk" target="_blank">james@jamesmolloy.co.uk</a>></span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Anton,<div><br></div><div>I'm very confused about your setup. The subject of these emails suggests you want to use arm-linux-gnueabihf, but the CMake verbose output you showed shows you've told it to use clang++ (/usr/local/bin/clang++   -target armv7a-linux-gnueabihf). The compiler flags also seem to be a frankenmix of x86 and ARM ( -L/usr/lib/gcc/x86_64-linux-gnu/4.7 is never gonna work!)</div>



<div><br></div><div>I managed a build without any problems using:</div><div><br></div><div>mkdir build; cd build; cmake .. -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_NAME=Linux</div>



<div><br></div><div>As the CMake cross-compilation wiki says, "CMAKE_SYSTEM_NAME" is very important as it tells CMake that it's cross compiling.</div><div><br></div><div>I also went and looked at the wiki page you quoted, and went and tried it out. That page is written for someone who wants to cross compile *with clang*. You want to cross-compile with gcc, so there are some changes you need to make.</div>



<div><br></div><div>You must remove the "-target" parameter. You must also remove the "-ccc-gcc-name" parameter. You also still need the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER arguments. So the line becomes:</div>



<div><br></div><div>cmake .. -DCMAKE_C_COMPILER=/work/tools/linaro/gnueabi/2013.08-20130816/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=/work/tools/linaro/gnueabi/2013.08-20130816/bin/arm-linux-gnueabihf-g++ -DCMAKE_CROSSCOMPILING=True -DLLVM_TABLEGEN=/work/llvm/build7/../build6/native/bin/llvm-tblgen -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DCMAKE_CXX_FLAGS=' -mcpu=cortex-a9 -I/usr/arm-linux-gnueabihf/include/c++/4.7.2/arm-linux-gnueabihf/ -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard'<br>



</div><div><br></div><div>Where '/work/llvm/build7/../build6/native/bin' is the location of a previously-built x86 llvm-tblgen.</div><div><br></div><div>Hopefully this has helped. My preference would be the first command line I pasted - using -DCMAKE_SYSTEM_NAME=Linux. That seems the simplest way to me, and it gets LLVM to auto-create its own native llvm-tblgen.</div>



<div><br></div><div>Cheers,</div><div><br></div><div>James</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On 8 October 2013 09:07, Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">I can confirm that after editing there is no -L/lib64 in invocation line,<div>
but the problem remains. I think previously compiled files were compiled/linked with -L/lib64 and this</div>
<div>corrupts the build.</div>
<div><br></div><div>How can it be fixed/walked-around?</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/8 Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span><br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">As far as i understood, invocation line is saved in <span style="font-family:arial,sans-serif;font-size:13px">CMakeFiles/llvm-tblgen.dir/</span><span style="font-family:arial,sans-serif;font-size:13px">link.txt.</span><div>





<span style="font-family:arial,sans-serif;font-size:13px">I've edited it to remove -L/lib64 and invoked the last command line manually but the problem remains.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>





</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">What can i do in order to avoid adding -L/lib64 ?</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>





<span style="font-family:arial,sans-serif;font-size:13px">Thanks,</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Anton</span></div></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">
2013/10/8 Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div dir="ltr">Hello.<div><br></div><div>Similar question to what i asked few days ago but was not resolved. </div><div><br></div><div>I've followed guide (<a href="http://llvm.org/docs/HowToCrossCompileLLVM.html" target="_blank">http://llvm.org/docs/HowToCrossCompileLLVM.html</a>) step-by-step.</div>








<div>The only changes i've done is installed g++ package since i've received "no g++ found" on clear virtual machine (ubuntu 13.04_64).</div><div><br></div><div>First i've compiled for host (to use tblgens), then for ARM.</div>








<div>When cross-compiling for ARM (tried both ninja and autotools) i'm getting linker error:</div><div><br></div><div>Linking CXX executable ../../bin/llvm-tblgen<br>../../lib/libLLVMSupport.a: could not read symbols: File format not recognized<br>







clang: error: linker command failed with exit code 1 (use -v to see invocation)<br>make[2]: *** [bin/llvm-tblgen] Error 1<br>make[1]: *** [utils/TableGen/CMakeFiles/llvm-tblgen.dir/all] Error 2<br><br></div><div>Verbose output (make VERBOSE=1):<br>







<br>cd /home/asmirnov/llvm_arm_cmake_build/utils/TableGen && /usr/bin/cmake -E cmake_link_script CMakeFiles/llvm-tblgen.dir/link.txt --verbose=1<br>/usr/local/bin/clang++   -target armv7a-linux-gnueabihf -mcpu=cortex-a9 -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/ -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard -ccc-gcc-name arm-linux-gnueabihf-gcc -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -fno-rtti -O3 -DNDEBUG    CMakeFiles/llvm-tblgen.dir/AsmMatcherEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/AsmWriterEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/AsmWriterInst.cpp.o CMakeFiles/llvm-tblgen.dir/CallingConvEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/CodeEmitterGen.cpp.o CMakeFiles/llvm-tblgen.dir/CodeGenDAGPatterns.cpp.o CMakeFiles/llvm-tblgen.dir/CodeGenInstruction.cpp.o CMakeFiles/llvm-tblgen.dir/CodeGenMapTable.cpp.o CMakeFiles/llvm-tblgen.dir/CodeGenRegisters.cpp.o CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o CMakeFiles/llvm-tblgen.dir/CodeGenTarget.cpp.o CMakeFiles/llvm-tblgen.dir/DAGISelEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/DAGISelMatcherEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/DAGISelMatcherGen.cpp.o CMakeFiles/llvm-tblgen.dir/DAGISelMatcherOpt.cpp.o CMakeFiles/llvm-tblgen.dir/DAGISelMatcher.cpp.o CMakeFiles/llvm-tblgen.dir/DFAPacketizerEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/DisassemblerEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/FastISelEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/FixedLenDecoderEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/InstrInfoEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/IntrinsicEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/OptParserEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/PseudoLoweringEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/RegisterInfoEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/SetTheory.cpp.o CMakeFiles/llvm-tblgen.dir/SubtargetEmitter.cpp.o CMakeFiles/llvm-tblgen.dir/TGValueTypes.cpp.o CMakeFiles/llvm-tblgen.dir/TableGen.cpp.o CMakeFiles/llvm-tblgen.dir/X86DisassemblerTables.cpp.o CMakeFiles/llvm-tblgen.dir/X86ModRMFilters.cpp.o CMakeFiles/llvm-tblgen.dir/X86RecognizableInstr.cpp.o CMakeFiles/llvm-tblgen.dir/CTagsEmitter.cpp.o  -o ../../bin/llvm-tblgen  -L/usr/lib/gcc/x86_64-linux-gnu/4.7  -L/lib64  ../../lib/libLLVMTableGen.a ../../lib/libLLVMSupport.a -lrt -ldl -lpthread -lpthread <br>







../../lib/libLLVMSupport.a: could not read symbols: File format not recognized<br>clang: error: linker command failed with exit code 1 (use -v to see invocation)<br>make[2]: *** [bin/llvm-tblgen] Error 1<br>make[2]: Leaving directory `/home/asmirnov/llvm_arm_cmake_build'<br>







make[1]: *** [utils/TableGen/CMakeFiles/llvm-tblgen.dir/all] Error 2<br>make[1]: Leaving directory `/home/asmirnov/llvm_arm_cmake_build'<br>make: *** [all] Error 2<br><br></div><div> Can it be walked-around by invocation without -L/lib64 ?</div>





<span><font color="#888888">
<div><br></div><div>Anton</div><div><br></div></font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>