Changes between Initial Version and Version 1 of Ticket #50953


Ignore:
Timestamp:
Mar 24, 2016, 8:18:15 AM (8 years ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

The compiler value macports-gcc means "the version of FSF gcc selected by the user by running sudo port select gcc". No port should specify this compiler value, because it would result in the port building differently depending on which compiler the user has selected (see ReproducibleBuilds), and causing the port to fail to build on the buildbot and for any users who have not selected any gcc. In my opinion, MacPorts should not offer macports-gcc as a possible value for configure.compiler.

Ports that need to use FSF gcc should offer variants so the user can choose which version of FSF gcc to use, with one (usually the most recent stable version, which at the present time is gcc5) being the default. The compilers 1.0 portgroup should be used to offer these variants.

Using FSF gcc is problematic on OS X because software built with it will use FSF gcc's libgcc_s. On non OS X systems this is not a problem because the OS and everything else is already using that libgcc_s. On OS X, the OS and software compiled using clang, llvm-gcc or Apple gcc use Apple's copy of libgcc_s, a.k.a. libSystem, which might not be 100% compatible with FSF gcc's. I don't know what effect these issues might have on gambit-c or other software that might be built using gambit-c but it is the usual reason why we do not use FSF gcc, even if upstream developers state that it is preferred, because upstream developers often do not understand this nuanced situation as it applies to OS X.

Additional complications arise if any C++ code is used; see wiki:FAQ#libcpp. (I don't know if gambit-c uses any C++.)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #50953

    • Property Keywords haspatch added
    • Property Cc macports@… removed
  • Ticket #50953 – Description

    initial v1  
    11
    22
    3 =Executive Summary:=
     3= Executive Summary: =
    44
    55The Gambit-C package should be compiled using recent versions of the “macports-gcc” compiler package.  Note that I am deliberately distinguishing between the Apple version of GCC (“gcc-4.0”, “apple-gcc-4.0”, etc.) and the purer MacPorts version.  Additionally, the “--enable-single-host” option should be specified to the “./configure” script when gambit is built.
    66
    77
    8 =Justification:=
     8= Justification: =
    99
    1010The Gambit-C package is a high-performance interpreter and compiler for the Scheme (LISP-family) programming language.  The gambit compiler works by first translating Scheme source code into C code, which is then compiled using the system’s C compiler.  Because Scheme programs can have a very nonlinear flow of control, including advanced features such as first class continuations, the C code produced by the gambit compiler is complicated and not intended for human consumption - it is an intermediate form generated by one compiler for another compiler, principally consisting of a single, exceedingly large, C function (a “trampoline” function).
     
    1212Note that the gambit compiler itself is mostly written in Scheme, so the choice of C compiler affects the building of the gambit package by the Macports buildbot, not just the usage of the gambit package by the end user.
    1313
    14 The complex nature of the intermediate C code generated by gambit tests the limits of even modern C compilers.  My recommendation that the purest version of GCC (“macports-gcc”) be used to compile gambit is not based on compiler favouritism;  past versions of all of the common compilers, GCC, LLVM, clang, and the Apple versions of these compilers, have had troubles compiling gambit C code in the past.  But the original author of gambit “highly recommends” using GCC [see 1].  And currently it seems that recent versions [4] of the GCC compiler perform the best, and the difference between GCC and the other compilers is significant (30 times faster to compiler the gambit scheme compiler than even the Apple GCC compiler!) [3].
     14The complex nature of the intermediate C code generated by gambit tests the limits of even modern C compilers.  My recommendation that the purest version of GCC (“macports-gcc”) be used to compile gambit is not based on compiler favouritism;  past versions of all of the common compilers, GCC, LLVM, clang, and the Apple versions of these compilers, have had troubles compiling gambit C code in the past.  But the original author of gambit “highly recommends” using GCC [see 1].  And currently it seems that recent versions ![4] of the GCC compiler perform the best, and the difference between GCC and the other compilers is significant (30 times faster to compiler the gambit scheme compiler than even the Apple GCC compiler!) ![3].
    1515
    16 Lastly, I would argue that the “--enable-single-host” option should be specified to “./configure” when gambit is built because this option dramatically improves the efficiency of the compiled code, and because this option is highly recommended by the original author of the gambit package [2].  Note that adding “--enable-single-host” increases the time needed to compile gambit, and this has caused problems for the macports buildbot in the past, when the pure macports gcc compiler was not used [for example, see https://trac.macports.org/ticket/46013].  The improvement in compile-time when using the macports-gcc package should more than offset the increased build time incurred by highly desirable “--enable-single-host” option.
     16Lastly, I would argue that the “--enable-single-host” option should be specified to “./configure” when gambit is built because this option dramatically improves the efficiency of the compiled code, and because this option is highly recommended by the original author of the gambit package ![2].  Note that adding “--enable-single-host” increases the time needed to compile gambit, and this has caused problems for the macports buildbot in the past, when the pure macports gcc compiler was not used [for example, see #46013].  The improvement in compile-time when using the macports-gcc package should more than offset the increased build time incurred by highly desirable “--enable-single-host” option.
    1717
    18 - William
     18{{{-}}} William
    1919
    2020
     
    2424From:  http://gambitscheme.org/wiki/index.php/Configure_script_options
    2525
    26 [1] “It is also highly recommended to use the GCC compiler to build the system as the source code can take advantage of some GCC extensions. Notably the use of GCC's computed gotos reduces the execution time by roughly 35%.”
     26![1] “It is also highly recommended to use the GCC compiler to build the system as the source code can take advantage of some GCC extensions. Notably the use of GCC's computed gotos reduces the execution time by roughly 35%.”
    2727
    28 [2] “It is highly recommended to use the --enable-single-host option to improve the execution speed and compactness of the executables   …   [for example] the speed of the Gambit-C interpreter improves by a factor of 2 as a result.”
     28![2] “It is highly recommended to use the --enable-single-host option to improve the execution speed and compactness of the executables   …   [for example] the speed of the Gambit-C interpreter improves by a factor of 2 as a result.”
    2929
    3030
    3131
    32 [3]  From:  https://webmail.iro.umontreal.ca/pipermail/gambit-list/2015-January/007698.html
     32![3]  From:  https://webmail.iro.umontreal.ca/pipermail/gambit-list/2015-January/007698.html
    3333
    3434“As can be seen, the Apple C compilers build Gambit in roughly 30 minutes, which is about 30x slower than when using GNU gcc 4.9.2 .  The execution time is also better for GNU gcc, about 2.3x faster.  So on OS X it is clearly advantageous to install GNU gcc when using Gambit.”
     
    3636
    3737
    38 [4]  From:  https://github.com/Homebrew/homebrew/commit/beb68f8a63243587ea736fd61e7cea2af4fdf9ab#Library/Formula/gambit-scheme.rb
     38![4]  From:  https://github.com/Homebrew/homebrew/commit/beb68f8a63243587ea736fd61e7cea2af4fdf9ab#Library/Formula/gambit-scheme.rb
    3939
    4040“don't try to build with GCC 4.2 or 4.3 … requires absurd amounts of RAM”