Building GCC on OS X 10.11

后端 未结 3 1321
执笔经年
执笔经年 2021-01-07 03:43

Building GCC (latest revision) on OS X 10.11.1 here, using the command line:

../gccx/configure --with-gmp=\"/opt/local\" --with-mpfr=\"/opt/local\" \\
    --         


        
3条回答
  •  感情败类
    2021-01-07 04:17

    For what it's worth, MacPorts has ports for all recent versions that should be sufficiently easy for everyone (who knows how to code!) to read who doesn't want to install MacPorts but prefers to install the various dependencies mentioned here some other way.

    A slightly tweaked personal version of the port for gcc 6.3.0: https://github.com/RJVB/macstrop/blob/master/lang/gcc6/Portfile

    The reason I mention that one (and post this answer) is that this tweaked version shows how to get G++ to use libc++ instead of libstdc++. That's a prerogative for being able to use G++ as a real replacement for clang++ that can be used without worrying about C++ runtime incompatibilities. This patch has allowed me to use g++ to build KDE (KF5) code and run it against Qt5 and the KF5 frameworks built with various clang compiler versions. (The patch files are in .../gcc6/files .)

    Some explanation that might help interpreting the Tcl code of the linked file:

    Ignore anything that's specific to $subport == "libgcc".

    As you can see, you need gmp, mpc, mpfr and isl (the other dependencies should be of no interest if you're installing on your own).

    The configure.args expressions construct the argument list to the configure script, configure.env and build.env add environmental variables for the configure and build (make) commands. Many of the configure options here are to ensure that the build uses dependencies from MacPorts but they'd probably be required too if you want or have to use a location not controlled by SIP and that isn't included in standard PATH definitions (the compiler still ought to work when invoked through a process that resets the path).

    The configure and build are done in a build directory that sits next to the source directory, which makes it very easy to start over or just clean up without throwing away the sources. After the configure step the build is done with "make bootstrap-lean" - which still creates about 1.7Gb of data in that build directory.

提交回复
热议问题