Ekaterina Sanina
2010-Nov-29 20:51 UTC
[LLVMdev] Does someone has experience with Canadian cross build of LLVM compiler?
Hi, Does anyone have experience with doing Canadian cross-builds of LLVM compiler? I need some help here... I'm a new with LLVM, so please don't be too harsh on me. I am building LLVM cross-compiler (and as I mentioned I'm doing it via canadian cross-build): Build platform = Linux, Host platform = Windows Target platform = Linux I'm using mingw32 compiler toolchain to cross-build LLVM cross-compiler. (My CC=i386-mingw32-gcc, CXX=i386-mingw32-g++, LD=i386-mingw32-ld, etc) During the build, configure complains that it can't run C compiled program on build platform (which makes sense, since mingw32 compiler creates an executable that cannot be run on build platform (linux)). SRC_DIR="/home/ksanina"; export SRC_DIR; BUILD_DIR="/home/ksanina/build/mx-debug-llvm-all"; export BUILD_DIR; PWD="/home/ksanina"; export PWD; PATH="/usr/local/bin:/bin:/usr/bin"; export PATH; BUILD_DIR=/home/ksanina/build/mx-debug-llvm ; export BUILD_DIR ; INSTALL_DIR=/home/ksanina/install/mx-debug ; export INSTALL_DIR ; AR="i386-mingw32-ar"; export AR; AS="i386-mingw32-as"; export AS; CC="i386-mingw32-gcc"; export CC; CXX="i386-mingw32-g++"; export CXX; LD="i386-mingw32-ld"; export LD; CFLAGS="-m32 -g"; export CFLAGS; CXXFLAGS="-m32 -g"; export CXXFLAGS; LDFLAGS=""; export LDFLAGS; CFLAGS="-std=gnu89 $CFLAGS" make -f /home/ksanina/Makefile.llvm -C $BUILD_DIR all CONFIG_FLAGS="--host=i386-mingw32 --build=x86_64-linux-gnu --target=i386-linux --prefix=/home/ksanina/install/mx-debug --enable-validation" MAKE_FLAGS="VERBOSE=1 " TESTSUITEmake[1]: Entering directory `/home/ksanina/build/mx-debug-llvm' make VERBOSE=1 make[2]: Entering directory `/home/ksanina/build/mx-debug-llvm' if [ ! -f BuildTools/Makefile ]; then \ /home/ksanina/llvm/autoconf/mkinstalldirs BuildTools; \ cd BuildTools ; \ unset CFLAGS ; \ unset CXXFLAGS ; \ /home/ksanina/llvm/configure --build=x86_64-pc-linux-gnu \ --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu; \ cd .. ; \ fi; \ (unset SDKROOT; \ make -C BuildTools \ BUILD_DIRS_ONLY=1 \ UNIVERSAL= \ ENABLE_OPTIMIZED=1 \ ENABLE_PROFILING= \ ENABLE_COVERAGE= \ DISABLE_ASSERTIONS=1 \ ENABLE_EXPENSIVE_CHECKS= \ CFLAGS= \ CXXFLAGS= \ ) || exit 1; checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking type of operating system we're going to host on... Linux checking type of operating system we're going to target... Linux checking target architecture... x86_64 checking for x86_64-pc-linux-gnu-gcc... i386-mingw32-gcc checking for C compiler default output file name... a.exe 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. make[3]: Entering directory `/home/ksanina/build/mx-debug-llvm/BuildTools' make[3]: *** No targets specified and no makefile found. Stop. make[3]: Leaving directory `/home/ksanina/build/mx-debug-llvm/BuildTools' make[2]: *** [cross-compile-build-tools] Error 1 make[2]: Leaving directory `/home/ksanina/build/mx-debug-llvm' make[1]: *** [make] Error 2 make[1]: Leaving directory `/home/ksanina/build/mx-debug-llvm' make: *** [mx-debug-llvm-all] Error 2 rm /home/ksanina/build/mx-debug-llvm/.dir To resolve this issue, I end up setting up additional environment variables, BUILD_CC=gcc BUILD_CXX=g++ BUILD_AR =ar BUILD_LD=ld etc. Also, I modified llvm/Makefile to use my BUILD_CC, BUILD_AS, BUILD_LD, etc instead of CC, AS, LD, etc. for cross-compile-build-tools target. cross-compile-build-tools: $(Verb) if [ ! -f BuildTools/Makefile ]; then \ $(MKDIR) BuildTools; \ cd BuildTools ; \ unset CFLAGS ; \ unset CXXFLAGS ; \ + AR=$(BUILD_AR) ;\ + AS=$(BUILD_AS) ;\ + LD=$(BUILD_LD) ;\ + CC=$(BUILD_CC) ;\ + CXX=$(BUILD_CXX) ;\ $(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \ --host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE); \ cd .. ; \ This workaround worked. But I'm sure there is some other, more elegant way of doing it (without actually changing llvm/Makefile). I'm sure other people have done Canadian cross build and resolve this issue some other way. If you've done it before, please advise on how better to do it. Thanks a lot! Ekaterina. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101129/0cbb0e47/attachment.html>
Anton Korobeynikov
2010-Nov-29 22:12 UTC
[LLVMdev] Does someone has experience with Canadian cross build of LLVM compiler?
Hello Ekaterina,> Does anyone have experience with doing Canadian cross-builds of LLVM > compiler?Works for me w/o any problems. Note that full canadian cross does not make any sense in LLVM world, since it can generate code for any target w/o extra configure stuff.> This workaround worked. But I'm sure there is some other, more elegant way > of doing it (without actually changing llvm/Makefile). I'm sure other people > have done Canadian cross build and resolve this issue some other way. If > you've done it before, please advise on how better to do it.How have you configured LLVM ? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
NAKAMURA Takumi
2010-Nov-30 04:18 UTC
[LLVMdev] Does someone has experience with Canadian cross build of LLVM compiler?
Hello, Ekaterina. FYI, my configure has '--host=i686-pc-mingw32' w/o any additional variables. and then the build host (ppc fedora 12) has toolchain 'i686-pc-mingw32-*'. It could build everything successfully, but I have not built it for a few months :p 2010/11/30 Ekaterina Sanina <ekaterina.sanina at gmail.com>:> cross-compile-build-tools: > $(Verb) if [ ! -f BuildTools/Makefile ]; then \ > $(MKDIR) BuildTools; \ > cd BuildTools ; \ > unset CFLAGS ; \ > unset CXXFLAGS ; \ > + AR=$(BUILD_AR) ;\ > + AS=$(BUILD_AS) ;\ > + LD=$(BUILD_LD) ;\ > + CC=$(BUILD_CC) ;\ > + CXX=$(BUILD_CXX) ;\ > $(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \ > --host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE); \ > cd .. ; \+1. It would be useful when buildhost's cc is not 'gcc'. eg. BUILD_CXX='ccache g++' ...Takumi
Ekaterina Sanina
2010-Dec-03 18:55 UTC
[LLVMdev] Does someone has experience with Canadian cross build of LLVM compiler?
Hi Takumi, Thank you for the reply. It turned out that my problem was caused by setting up environment (CC, LD, etc) variables before invoking configure. That kind of stuff seems to confuse configure. Anton Korobeynikov helped me to resolve my problem. When I removed initialization of environment variables before invoking configure script, I was able to build llvm compiler (using Canadian cross build) right off the box. Thanks! Regards, Ekaterina. On Mon, Nov 29, 2010 at 8:18 PM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:> Hello, Ekaterina. > > FYI, my configure has '--host=i686-pc-mingw32' w/o any additional > variables. > and then the build host (ppc fedora 12) has toolchain 'i686-pc-mingw32-*'. > > It could build everything successfully, but I have not built it for a > few months :p > > 2010/11/30 Ekaterina Sanina <ekaterina.sanina at gmail.com>: > > cross-compile-build-tools: > > $(Verb) if [ ! -f BuildTools/Makefile ]; then \ > > $(MKDIR) BuildTools; \ > > cd BuildTools ; \ > > unset CFLAGS ; \ > > unset CXXFLAGS ; \ > > + AR=$(BUILD_AR) ;\ > > + AS=$(BUILD_AS) ;\ > > + LD=$(BUILD_LD) ;\ > > + CC=$(BUILD_CC) ;\ > > + CXX=$(BUILD_CXX) ;\ > > $(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \ > > --host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE); \ > > cd .. ; \ > > +1. > It would be useful when buildhost's cc is not 'gcc'. > eg. BUILD_CXX='ccache g++' > > ...Takumi >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101203/f2e40cbb/attachment.html>
Seemingly Similar Threads
- [LLVMdev] Does someone has experience with Canadian cross build of LLVM compiler?
- [LLVMdev] Build process ignores BUILD_CC?
- [LLVMdev] Problems building host tools when cross compiling LLVM
- [LLVMdev] Problems building host tools when cross compiling LLVM
- [LLVMdev] Configure problem of llvm2.5 in Mac OS X 10.4.11