[LLVMdev] Technote llvm-gcc4.2-2.4-001: How to build llvm-gcc4.2-2.4 for Mac OS X 10.5.

Elvis Dowson elvis.dowson at mac.com
Sun Dec 28 15:20:02 PST 2008


Hi,
        Here are the steps that I followed to create a successful  
build on Mac OS X 10.5.6.

Best regards,

Elvis Dowson


Technote llvm-gcc4.2-2.4-001: How to build llvm-gcc4.2-2.4 for Mac OS  
X 10.5.6

Procedure

Step 01: Configure, build and install llvm-2.4.

Directory structure:

llvm-2.4
	/	build
	/	src

The following commands will build a debug version of llvm.

$ cd build
$ ../src/configure
$ make -j 2 ENABLE_OPTIMIZED=0

To build a release version of llvm, type the following command

$ make ENABLE_OPTIMIZED=1

Step 02: Configure, build and install llvm-gcc4.2-2.4.

When building the llvm-gcc front end with a debug version of llvm,  
ensure that the --enable-checking configure option is set.

If building for Darwin/X86 (32-bit support):
     TARGETOPTIONS='--with-arch=nocona --with-tune=generic'

In addition, you *must* specify the following options to configure:
   --with-gxx-include-dir=/usr/include/c++/4.0.0

With these options, llvm-gcc will build the same way as Apple's system  
GCC.

Directory structure:

llvm-gcc4.2-2.4
	/	build
	/	install
	/	src

Type the following commands to build a debug version of llvm-gcc

$ cd build
$ export TARGETOPTIONS='--with-arch=nocona --with-tune=generic'
$ export TRIPLE=i386-apple-darwin9.6.0
$ export BUILDOPTIONS=LLVM_VERSION_INFO=2.4
$ ../src/configure --enable-checking --with-gxx-include-dir=/usr/ 
include/c++/4.0.0 --prefix=`pwd`/../install --program-prefix=llvm- -- 
enable-llvm=$LLVM_HOME/build --enable-languages=c,c++$EXTRALANGS  
$TARGETOPTIONS --disable-bootstrap --disable-multilib
$ make $BUILDOPTIONS -j 2 ENABLE_OPTIMIZED=0
$ make install

Step 03: Update PATH environment variable

export LLVM_HOME=$HOME/Tool/llvm-2.4
export LLVM_GCC_HOME=$HOME/Tool/llvm-gcc4.2-2.4
export PATH=$PATH:$LLVM_HOME/build/Debug/bin:$LLVM_GCC_HOME/install/bin

Step 04: Verify the installation

$ llvm-gcc -v
$ gcc version 4.2.1 (Based on Apple Inc. build 5623) (LLVM build 2.4)

If the -v line above doesn't include "LLVM", you probably mistyped the  
--enable-llvm=xxx line and have a normal gcc, not an llvm-gcc.

Related Topics

01. Nabble - LLVM - Dev - llvm-gcc compilation error:  
BUILT_IN_ADJUST_TRAMPOLINE undeclared

Related Links

01. http://www.llvm.org/
02. Building the LLVM GCC Front-End

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081229/1f14648b/attachment.html>


More information about the llvm-dev mailing list