| 6 | |
| 7 | == A port fails to build when using Xcode 4 == #compiler |
| 8 | |
| 9 | gcc has been the compiler collection MacPorts has used by default up until Xcode 4, in which Apple has switched to the llvm/clang compiler collection. These are new compilers and many programs have not yet been tested with them, and some ports will fail as a result. Using a different compiler may work better for a particular port. If the below workarounds enable you to install a port that failed with its default compiler, file a ticket and let us know so we can fix it. Portfile authors, see wiki:PortfileRecipes#compiler. |
| 10 | |
| 11 | === Xcode 4.2 and later === #xcode42 |
| 12 | |
| 13 | If a port ''foo'' fails to build and you're using Xcode 4.2 or later, the default compiler is clang; try compiling with llvm-gcc-4.2 instead: |
| 14 | |
| 15 | {{{ |
| 16 | sudo port clean foo |
| 17 | sudo port install foo configure.compiler=llvm-gcc-4.2 |
| 18 | }}} |
| 19 | |
| 20 | If that fails, try installing the apple-gcc42 port and compiling with that: |
| 21 | |
| 22 | {{{ |
| 23 | sudo port clean foo |
| 24 | sudo port install apple-gcc42 |
| 25 | sudo port install foo configure.compiler=apple-gcc-4.2 configure.cxx=/opt/local/bin/gcc-apple-4.2 |
| 26 | }}} |
| 27 | |
| 28 | === Xcode 4.0 and 4.1 === #xcode40 |
| 29 | |
| 30 | If a port ''foo'' fails to build and you're using Xcode 4.0 or 4.1, the default compiler is llvm-gcc-4.2; try compiling with clang instead: |
| 31 | |
| 32 | {{{ |
| 33 | sudo port clean foo |
| 34 | sudo port install foo configure.compiler=clang |
| 35 | }}} |
| 36 | |
| 37 | If that fails, try using gcc-4.2: |
| 38 | |
| 39 | {{{ |
| 40 | sudo port clean foo |
| 41 | sudo port install foo configure.compiler=gcc-4.2 |
| 42 | }}} |