Tatu Vaajalahti
2008-Oct-21 13:07 UTC
[LLVMdev] Replacing llvm-gcc in Xcode 3.1.1 with svn version
Hello all, I have replaced the llvm-gcc shipped with the Xcode by the latest version and I was wondering if I have missed something... (everything *seems* to work). Here's what I did: 0. Checkout LLVM (and clang) + llvm-gcc 1. Build LLVM (with clang) and install into /Developer/usr/local : # mkdir llvmobj # cd llvmobj # CC=gcc-4.2 CXX=g++-4.2 ../llvm/configure --prefix=/Developer/ usr/local --enable-optimized # make -j2 # make install # cp -p ../llvm/tools/clang/utils/* /Developer/usr/local/bin/ 2. Build llvm-gcc # cd llvm-gcc # make clean # rm -rf build # mkdir -p build/obj build/dst build/sym # (NOTE: I don't want PowerPC code) # gnumake install RC_OS=macos RC_ARCHS="i386" TARGETS="i386 x86_64" SRCROOT=`pwd` OBJROOT=`pwd`/build/obj DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym 3. Replace old llvm-gcc with new one # rm -rf /Developer/usr/llvm-gcc-4.2 # ditto build/dst / ------ rest only once ------- 4. Fix libLTOs # rm /Developer/usr/lib/libLTO.dylib # ln -sf /Developer/usr/local/lib/libLTO.dylib /Developer/usr/lib/ libLTO.dylib # rm /usr/lib/libLTO.dylib # ln -sf /Developer/usr/local/lib/libLTO.dylib /usr/lib/ libLTO.dylib 5. Fix /Developer/SDKs/MacOSX10.5.sdk/Developer/usr # cd /Developer/SDKs/MacOSX10.5.sdk/Developer/usr # mv llvm-gcc-4.2 llvm-gcc-4.2.old # ln -sf /Developer/usr/llvm-gcc-4.2 llvm-gcc-4.2 TIA! --- Tatu Vaajalahti Tampere, Finland
Dan Villiom Podlaski Christiansen
2008-Oct-21 15:30 UTC
[LLVMdev] Replacing llvm-gcc in Xcode 3.1.1 with svn version
Hi, The procedure you describe is quite complicated and invasive, in my opinion. It might be useful someday to be able to use the compiler binaries supplied by Apple; you never know... I'm not at my Mac right now, but you should be able to achieve the same results through two small steps: first, create a small shell script that adds the directory containing libLTO to DYLD_LIBRARY_PATH. Then, edit the project rules in Xcode to invoke this script instead of the default LLVM GCC. The first step works quite well for me, but as I don't use Xcode that often, I'm not sure I tried the second. As an alternative, you should be able to edit your Xcode configuration to default to the new path. If you're interested, I can post the shell script I use. On 10/21/08, Tatu Vaajalahti <tatuvaaj at mac.com> wrote:> Hello all, > > I have replaced the llvm-gcc shipped with the Xcode by the latest > version and I was wondering if I have missed something... (everything > *seems* to work). > Here's what I did: > > 0. Checkout LLVM (and clang) + llvm-gcc > > 1. Build LLVM (with clang) and install into /Developer/usr/local : > # mkdir llvmobj > # cd llvmobj > # CC=gcc-4.2 CXX=g++-4.2 ../llvm/configure --prefix=/Developer/ > usr/local --enable-optimized > # make -j2 > # make install > # cp -p ../llvm/tools/clang/utils/* /Developer/usr/local/bin/ > > 2. Build llvm-gcc > # cd llvm-gcc > # make clean > # rm -rf build > # mkdir -p build/obj build/dst build/sym > # (NOTE: I don't want PowerPC code) > # gnumake install RC_OS=macos RC_ARCHS="i386" TARGETS="i386 > x86_64" SRCROOT=`pwd` OBJROOT=`pwd`/build/obj DSTROOT=`pwd`/build/dst > SYMROOT=`pwd`/build/sym > > 3. Replace old llvm-gcc with new one > # rm -rf /Developer/usr/llvm-gcc-4.2 > # ditto build/dst / > > ------ rest only once ------- > > 4. Fix libLTOs > # rm /Developer/usr/lib/libLTO.dylib > # ln -sf /Developer/usr/local/lib/libLTO.dylib /Developer/usr/lib/ > libLTO.dylib > # rm /usr/lib/libLTO.dylib > # ln -sf /Developer/usr/local/lib/libLTO.dylib /usr/lib/ > libLTO.dylib > > 5. Fix /Developer/SDKs/MacOSX10.5.sdk/Developer/usr > # cd /Developer/SDKs/MacOSX10.5.sdk/Developer/usr > # mv llvm-gcc-4.2 llvm-gcc-4.2.old > # ln -sf /Developer/usr/llvm-gcc-4.2 llvm-gcc-4.2 > > > TIA! > > --- > Tatu Vaajalahti > Tampere, Finland > > > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Dan Villiom Podlaski Christiansen, stud.scient. danchr at daimi.au.dk, danchr at gmail.com
Devang Patel
2008-Oct-21 16:57 UTC
[LLVMdev] Replacing llvm-gcc in Xcode 3.1.1 with svn version
Hi Tatu, On Oct 21, 2008, at 6:07 AM, Tatu Vaajalahti wrote:> Hello all, > > I have replaced the llvm-gcc shipped with the Xcode by the latest > version and I was wondering if I have missed something... (everything > *seems* to work).> > Here's what I did: > > 0. Checkout LLVM (and clang) + llvm-gcc > > 1. Build LLVM (with clang) and install into /Developer/usr/local : > # mkdir llvmobj > # cd llvmobj > # CC=gcc-4.2 CXX=g++-4.2 ../llvm/configure --prefix=/Developer/ > usr/local --enable-optimized > # make -j2 > # make install > # cp -p ../llvm/tools/clang/utils/* /Developer/usr/local/bin/llvm tools shipped with Xcode does not include clang bits. And everything from /Developer/usr/local is stripped, except libLTO. However what you're doing is just fine, if you do not care about universal builds. FWIW, we use GNUmakefile and build_llvm script from llvm/utils/buildit to build llvm tools that are shipped with Xcode.> > > 2. Build llvm-gcc > # cd llvm-gcc > # make clean > # rm -rf build > # mkdir -p build/obj build/dst build/sym > # (NOTE: I don't want PowerPC code) > # gnumake install RC_OS=macos RC_ARCHS="i386" TARGETS="i386 > x86_64" SRCROOT=`pwd` OBJROOT=`pwd`/build/obj DSTROOT=`pwd`/build/dst > SYMROOT=`pwd`/build/symAha.. clever! - Devang> > > 3. Replace old llvm-gcc with new one > # rm -rf /Developer/usr/llvm-gcc-4.2 > # ditto build/dst / > > ------ rest only once ------- > > 4. Fix libLTOs > # rm /Developer/usr/lib/libLTO.dylib > # ln -sf /Developer/usr/local/lib/libLTO.dylib /Developer/usr/lib/ > libLTO.dylib > # rm /usr/lib/libLTO.dylib > # ln -sf /Developer/usr/local/lib/libLTO.dylib /usr/lib/ > libLTO.dylib > > > 5. Fix /Developer/SDKs/MacOSX10.5.sdk/Developer/usr > # cd /Developer/SDKs/MacOSX10.5.sdk/Developer/usr > # mv llvm-gcc-4.2 llvm-gcc-4.2.old > # ln -sf /Developer/usr/llvm-gcc-4.2 llvm-gcc-4.2 > > > TIA! > > --- > Tatu Vaajalahti > Tampere, Finland > > > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev- Devang
Chris Lattner
2008-Oct-21 17:06 UTC
[LLVMdev] Replacing llvm-gcc in Xcode 3.1.1 with svn version
On Oct 21, 2008, at 6:07 AM, Tatu Vaajalahti wrote:> Hello all, > > I have replaced the llvm-gcc shipped with the Xcode by the latest > version and I was wondering if I have missed something... (everything > *seems* to work). > Here's what I did:Very cool! Can you please add this to the LLVM FAQ? -Chris
Tatu Vaajalahti
2008-Oct-21 18:07 UTC
[LLVMdev] Replacing llvm-gcc in Xcode 3.1.1 with svn version
On 21.10.2008, at 20.06, Chris Lattner wrote:> > On Oct 21, 2008, at 6:07 AM, Tatu Vaajalahti wrote: > >> Hello all, >> >> I have replaced the llvm-gcc shipped with the Xcode by the latest >> version and I was wondering if I have missed something... (everything >> *seems* to work). >> Here's what I did:A couple of minor points I noticed: You'll also want to edit /Developer/Library/Xcode/Plug-ins/llvm-gcc 4.2.xcplugin/Contents/Resources/llvmgcc42.xcspec and comment out the OptionsForSDKPackages = { sdk_package_flags = "-isysroot $(SDKROOT)"; }; because if you have llvm-gcc selected as a compiler in Xcode and you do scan-build for your project clang won't accept more than one - isysroot option and will fail the scan-build. Naturally you'll also want to add /Developer/usr/bin and /Developer/ usr/local/bin to your path :) --- Tatu Vaajalahti Tampere, Finland