Filed a bug with Apple 10073924 but I'm wondering if anyone else knows what to fix here: Summary: Building a Darwin cross compiler so I can use distcc with my Mac. Host: x86_64-gnu-linux with GCC 4.5.3. Steps to Reproduce: Download tar ball tar xvf llvmgcc42-2335.15.tar.gz mkdir gcc-build cd gcc-build CFLAGS="-w -m32" CXXFLAGS="$CFLAGS" CPPFLAGS="$CFLAGS" LDFLAGS="-m32" ../llvmgcc42-2335.15/configure --target=x86_64-apple-darwin11 --with-sysroot=/home/tatsh/usr/x86_64-apple-darwin11 --prefix=/home/tatsh/usr/x86_64-apple-darwin11 --enable-languages=objc,c++,obj-c++ make Note: Had to comment out an incompatible declaration of mempcpy to get this far. c-typeck.o: In function `store_init_value': c-typeck.c:(.text+0x950d): undefined reference to `TheTreeToLLVM' c-typeck.c:(.text+0x951c): undefined reference to `reset_type_and_initializer_llvm' collect2: ld returned 1 exit status make[2]: *** [cc1-dummy] Error 1 make[2]: Leaving directory `/home/tatsh/dev/apple-darwin/llvm-build/gcc' make[1]: *** [all-gcc] Error 2 make[1]: Leaving directory `/home/tatsh/dev/apple-darwin/llvm-build' make: *** [all] Error 2 http://opensource.apple.com/source/llvmgcc42/llvmgcc42-2335.15/gcc/c-typeck.c In the file, there's also this line and comment: extern void * TheTreeToLLVM; /* llvm-internal.h is not available here. Ugh. */ I had a little bit of trouble getting cctools to work on Linux (and it's still patchy/hacky but works). After that, I have distcc working on my Mac to ask my more modern system to compile working fine with everything except Objective-C/C++ (I'm not entirely sure why yet, it's not error 110 and there is no error number). I'd like to continue by adding llvm-gcc which is actually what I build with in Xcode (GCC is what I use in Gentoo prefix; Macports also uses GCC). Thanks
On Mon, Sep 5, 2011 at 8:42 PM, Andrew Udvare <audvare at gmail.com> wrote:> Filed a bug with Apple 10073924 but I'm wondering if anyone else > knows what to fix here: > > Summary: > Building a Darwin cross compiler so I can use distcc with my Mac. > Host: x86_64-gnu-linux with GCC 4.5.3. > Steps to Reproduce: > Download tar ball > tar xvf llvmgcc42-2335.15.tar.gz > mkdir gcc-build > cd gcc-build > CFLAGS="-w -m32" CXXFLAGS="$CFLAGS" CPPFLAGS="$CFLAGS" LDFLAGS="-m32" > ../llvmgcc42-2335.15/configure --target=x86_64-apple-darwin11 > --with-sysroot=/home/tatsh/usr/x86_64-apple-darwin11 > --prefix=/home/tatsh/usr/x86_64-apple-darwin11 > --enable-languages=objc,c++,obj-c++ > makeYou can't build llvm-gcc like that. There's a build_gcc script (in the root of the llvm-gcc source) that does a proper build the way that Apple does it. No idea if it will work as-is on Linux, but you should start there. See also README.LLVM (in the same place), although there are some extra complications in the build_gcc script because of the driver-driver. -Eli
Hi Andrew,> CFLAGS="-w -m32" CXXFLAGS="$CFLAGS" CPPFLAGS="$CFLAGS" LDFLAGS="-m32" > ../llvmgcc42-2335.15/configure --target=x86_64-apple-darwin11 > --with-sysroot=/home/tatsh/usr/x86_64-apple-darwin11 > --prefix=/home/tatsh/usr/x86_64-apple-darwin11 > --enable-languages=objc,c++,obj-c++you forgot to specify the path to the llvm build directory. This is done by passing --enable-llvm=path on the configure line. Ciao, Duncan.> make > > Note: Had to comment out an incompatible declaration of mempcpy to get this far. > > c-typeck.o: In function `store_init_value': > c-typeck.c:(.text+0x950d): undefined reference to `TheTreeToLLVM' > c-typeck.c:(.text+0x951c): undefined reference to > `reset_type_and_initializer_llvm' > collect2: ld returned 1 exit status > make[2]: *** [cc1-dummy] Error 1 > make[2]: Leaving directory `/home/tatsh/dev/apple-darwin/llvm-build/gcc' > make[1]: *** [all-gcc] Error 2 > make[1]: Leaving directory `/home/tatsh/dev/apple-darwin/llvm-build' > make: *** [all] Error 2 > > http://opensource.apple.com/source/llvmgcc42/llvmgcc42-2335.15/gcc/c-typeck.c > In the file, there's also this line and comment: > extern void * TheTreeToLLVM; /* llvm-internal.h is not > available here. Ugh. */ > > I had a little bit of trouble getting cctools to work on Linux (and > it's still patchy/hacky but works). After that, I have distcc working > on my Mac to ask my more modern system to compile working fine with > everything except Objective-C/C++ (I'm not entirely sure why yet, it's > not error 110 and there is no error number). I'd like to continue by > adding llvm-gcc which is actually what I build with in Xcode (GCC is > what I use in Gentoo prefix; Macports also uses GCC). > > Thanks > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev