How does one cross compile llvm ? When I attempt to cross compile I get : ................................................ ............................................... configure: creating ./config.status config.status: creating Makefile.common config.status: executing setup commands config.status: executing Makefile commands config.status: executing lib/Makefile commands config.status: executing lib/sample/Makefile commands config.status: executing tools/Makefile commands config.status: executing tools/sample/Makefile commands checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking type of operating system we're going to host on... Linux checking target architecture... x86 checking for gcc... arm-none-linux-gnueabi-gcc checking for C compiler default output file name... a.out checking whether the C compiler works... configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details. I configured as follows : AS=arm-none-linux-gnueabi-as AR=arm-none-linux-gnueabi-ar CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ LD=arm-none-linux-gnueabi-ld NM=arm-none-linux-gnueabi-nm OBJCOPY=arm-none-linux-gnueabi-objcopy OBJDUMP=arm-none-linux-gnueabi-objdump RANLIB=arm-none-linux-gnueabi-ranlib READELF=arm-none-linux-gnueabi-readelf SIZE=arm-none-linux-gnueabi-size STRINGS=arm-none-linux-gnueabi-strings STRIP=arm-none-linux-gnueabi-strips llvm-2.5/configure \ --with-llvmgccdir=/home/LLVM-2.5/llvm-gcc4.2-2.5-x86-linux-RHEL4 \ --enable-optimized \ --enable-jit \ --disable-threads \ --enable-pic \ --disable-shared \ --with-pic \ --prefix=/home/VIREMENT/src_virement/llvm \ --build=i686-pc-linux-gnu \ --host=arm-linux-gnueabi I am attaching config.log -- Be Yourself @ mail.com! Choose From 200+ Email Addresses Get a Free Account at www.mail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090610/3930a2df/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: config.log Type: application/octet-stream Size: 239622 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090610/3930a2df/attachment.obj>
On Wed, Jun 10, 2009 at 10:17 AM, hannibal hannibal<hannibal_08 at mail.com> wrote:> checking whether the C compiler works... configure: error: cannot run C > compiled programs. > If you meant to cross compile, use `--host'.DId you try reading this error message? ("--host" is an option to configure.) -Eli
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I stumbled over this one too, recently. hannibal hannibal wrote:> ................................................ > ............................................... > configure: creating ./config.status > config.status: creating Makefile.common > config.status: executing setup commands > config.status: executing Makefile commands > config.status: executing lib/Makefile commands > config.status: executing lib/sample/Makefile commands > config.status: executing tools/Makefile commands > config.status: executing tools/sample/Makefile commandsAFIAK what is following is the configure in the BuildTools folder where tablegen ant the like are built.> checking build system type... i686-pc-linux-gnu > checking host system type... i686-pc-linux-gnu > checking target system type... i686-pc-linux-gnu > checking type of operating system we're going to host on... Linux > checking target architecture... x86 > checking for gcc... arm-none-linux-gnueabi-gccAs you see the only compiler it finds is the arm-cross-compiler, but not the i686-pc-linux-gnu-compiler to build tablegen natively for the build environment. Its no use of setting the CC environment variable to the arm-compiler since the whole build is using it. You have to have both (the system compiler for i686-pc-linux-gnu and the cross compiler for arm-none-linux-gnueabi on your path. At the configure (with --host=ppc64-linux in this case) you get:> configure: WARNING: If you wanted to set the --build type, don't use --host. > If a cross compiler is detected then cross compile mode will be used. > checking build system type... x86_64-unknown-linux-gnu > checking host system type... powerpc64-unknown-linux-gnu > checking target system type... powerpc64-unknown-linux-gnuThats the proper systems.> checking type of operating system we're going to host on... Linux > checking target architecture... PowerPC > checking for ppc64-linux-gcc... ppc64-linux-gccSo (in this case) the cross-compiler has to be named ppc64-linux-gcc>........ > checking for gcc... gccAnd then its also checking for the native compiler to build the BuildTools. So: puth both compilers (the native one and the cross-compiler) onto the path and name the cross-compiler so configure finds it. Andi -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkoxR+sACgkQPiYq0rq7s/AjQACfUPt+aRozBLt7FAYgx54BCiYC h6UAnRyOtOivOancU6UucqXnC/CuZpls =AwkH -----END PGP SIGNATURE-----
You can try cross-compiling with cmake if the traditional approach doesn't work for you. Yesterday I tried mingw on Linux and it worked fine (apart from a bug related to mingw's binutils that appears late on the build process). http://www.llvm.org/docs/CMake.html -- Óscar
I've committed my scripts that simplify building Linux/x86 -> Linux/ARM crosstool. There are 2 parts to using this: * llvm/utils/crosstool/create-snapshots.sh creates tarballs for LLVM and LLVM-GCC from HEAD SVN or a specific revision of your choice * llvm/utils/crosstool/ARM/build-install-linux.sh builds and installs a Linux/x86 -> Linux/ARM crosstool using the snapshots generated by the above script. It also uses the CodeSourcery GCC-based cross toolchain to avoid having to rebuild cross-binutils and glibc, but if you don't have it, it'll tell you where to download it from. Note that HEAD revision of SVN doesn't work for me, but I listed the latest one I've tried that does, which is 70786. Let me know if this approach works for you. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090611/3d147359/attachment.html>
On Jun 11, 2009, at 7:18 PM, Misha Brukman wrote:> I've committed my scripts that simplify building Linux/x86 -> Linux/ > ARM crosstool. There are 2 parts to using this: > > * llvm/utils/crosstool/create-snapshots.sh > creates tarballs for LLVM and LLVM-GCC from HEAD SVN or a specific > revision of your choice > * llvm/utils/crosstool/ARM/build-install-linux.sh > builds and installs a Linux/x86 -> Linux/ARM crosstool using the > snapshots generated by the above script. It also uses the > CodeSourcery GCC-based cross toolchain to avoid having to rebuild > cross-binutils and glibc, but if you don't have it, it'll tell you > where to download it from. > > Note that HEAD revision of SVN doesn't work for me, but I listed the > latest one I've tried that does, which is 70786. > Let me know if this approach works for youThanks, this should be useful. What problem did you have with svn revisions after 70786?
On Jun 11, 2009, at 7:18 PM, Misha Brukman wrote:> I've committed my scripts that simplify building Linux/x86 -> Linux/ > ARM crosstool. There are 2 parts to using this: > > * llvm/utils/crosstool/create-snapshots.sh > creates tarballs for LLVM and LLVM-GCC from HEAD SVN or a specific > revision of your choice > * llvm/utils/crosstool/ARM/build-install-linux.sh > builds and installs a Linux/x86 -> Linux/ARM crosstool using the > snapshots generated by the above script. It also uses the > CodeSourcery GCC-based cross toolchain to avoid having to rebuild > cross-binutils and glibc, but if you don't have it, it'll tell you > where to download it from.Just a note. CodeSourcery gcc tools is GPLv3. I think referencing the tools in a script is fine (except for those of us who are not allowed to even use them). But please never bring them into the llvm tree. Thanks, Evan> > > Note that HEAD revision of SVN doesn't work for me, but I listed the > latest one I've tried that does, which is 70786. > Let me know if this approach works for you. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev