Opened 8 years ago

Last modified 21 months ago

#50953 new enhancement

gambit-c @4.7.6 Change compiler and add desirable ./configure option — at Initial Version

Reported by: somebody-237654 Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: haspatch Cc: macports@…
Port: gambit-c

Description

=Executive Summary:=

The 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.

=Justification:=

The 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).

Note 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.

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].

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.

  • William

Notes:

From: http://gambitscheme.org/wiki/index.php/Configure_script_options

[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%.”

[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.”

[3] From: https://webmail.iro.umontreal.ca/pipermail/gambit-list/2015-January/007698.html

“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.”

[4] From: https://github.com/Homebrew/homebrew/commit/beb68f8a63243587ea736fd61e7cea2af4fdf9ab#Library/Formula/gambit-scheme.rb

“don't try to build with GCC 4.2 or 4.3 … requires absurd amounts of RAM”

Change History (0)

Note: See TracTickets for help on using tickets.