Setting GCC 4.2 as the default compiler on Mac OS X Leopard

前端 未结 6 1692
小蘑菇
小蘑菇 2020-11-29 18:53

I\'m sure there must be a way to do this. As you are probably aware the latest versions of Xcode (and in fact I think all versions of Xcode) on Leopard come with GCC 4.0.1 a

6条回答
  •  离开以前
    2020-11-29 19:59

    Since neither Apple nor Darwin Ports have the gcc_select program to change the default version of the System compiler (as exists on GNU/Linux), I would like to be on the safe side with XCode (and the rest of the system) and would recommend to leave the symbolic links as they are and instead setup environment variables that overrides which version of GCC to use.

    In my .profile file I have the following

    export CC=/usr/bin/gcc-4.2
    export CPP=/usr/bin/cpp-4.2
    export CXX=/usr/bin/g++-4.2 
    

    And I successfully compiled the following libraries with GCC 4.2 from source.

    • OpenSSL
    • libjpeg
    • libpng
    • zlib
    • gst

    However... I could not get Boost 1.39 to acknowledge the environment variables, so to compile Boost with GCC 4.2 I needed to change the symbolic links in /usr/bin/ so they pointed to gcc v4.2

    After the long while the Boost libraries were finished compiling with GCC 4.2 I restored the symbolic links back to the original System version gcc-4.0.

提交回复
热议问题