在LionOS上安装gcc

其实苹果的gcc编译器叫做LLVM。

安装llvm 步骤如下:



  1. Get the required tools.
  2. Checkout LLVM:
    • Change directory to where you want the llvm directory placed.
    • svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
  3. Checkout Clang:
    • cd llvm/tools
    • svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
  4. Checkout Compiler-RT:
    • cd ../.. (back to where you started)
    • cd llvm/projects
    • svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
  5. Build LLVM and Clang:
    • cd ../.. (back to where you started)
    • mkdir build (for building without polluting the source dir)
    • cd build
    • ../llvm/configure
    • make
    • This builds both LLVM and Clang for debug mode.
    • Note: For subsequent Clang development, you can just do make at the clang directory level.
    • It is also possible to use CMake instead of the makefiles. With CMake it is also possible to generate project files for several IDEs: Eclipse CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.
  6. If you intend to work on Clang C++ support, you may need to tell it how to find your C++ standard library headers. In general, Clang will detect the best version of libstdc++ headers available and use them - it will look both for system installations of libstdc++ as well as installations adjacent to Clang itself. If your configuration fits neither of these scenarios, you can use the --with-gcc-toolchain configure option to tell Clang where the gcc containing the desired libstdc++ is installed.
  7. Try it out (assuming you add llvm/Debug+Asserts/bin to your path):
    • clang --help
    • clang file.c -fsyntax-only (check for correctness)
    • clang file.c -S -emit-llvm -o - (print out unoptimized llvm code)
    • clang file.c -S -emit-llvm -o - -O3
    • clang file.c -S -O3 -o - (output native machine code)

Note that the C front-end uses LLVM, but does not depend on llvm-gcc. If you encounter problems with building Clang, make sure you have the latest SVN version of LLVM. LLVM contains support libraries for Clang that will be updated as well as development on Clang progresses.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值