From 0d422d500766d954e207009477ffa43ce98c454b Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Sat, 15 Feb 2020 19:26:35 -0500 Subject: gambit: set CC to full path, fixes #78921 Use -Os rather than -O2 as our compilation flag, document why. Document why we always use gcc over clang. Fix openssl path in gambit. Stop trying to make static openssl. --- pkgs/development/compilers/gambit/bootstrap.nix | 6 +- pkgs/development/compilers/gambit/build.nix | 85 ++++++++++++++++--------- 2 files changed, 60 insertions(+), 31 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/gambit/bootstrap.nix b/pkgs/development/compilers/gambit/bootstrap.nix index f00a8b6efc91..2fb9e3ce2fc4 100644 --- a/pkgs/development/compilers/gambit/bootstrap.nix +++ b/pkgs/development/compilers/gambit/bootstrap.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, autoconf, ... }: +{ stdenv, fetchurl, autoconf, gcc, coreutils, ... }: stdenv.mkDerivation { pname = "gambit-bootstrap"; @@ -12,6 +12,10 @@ stdenv.mkDerivation { buildInputs = [ autoconf ]; configurePhase = '' + export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ + CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ + XMKMF=${coreutils}/bin/false + unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS ./configure --prefix=$out ''; diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix index 7a3324d75602..e17241b6d98d 100644 --- a/pkgs/development/compilers/gambit/build.nix +++ b/pkgs/development/compilers/gambit/build.nix @@ -1,4 +1,19 @@ -{ stdenv, git, openssl, autoconf, pkgs, makeStaticLibraries, version, src }: +{ stdenv, git, openssl, autoconf, pkgs, makeStaticLibraries, version, gcc, src, coreutils }: + +# Note that according to a benchmark run by Marc Feeley on May 2018, +# clang is 10x (with default settings) to 15% (with -O2) slower than GCC at compiling +# Gambit output, producing code that is 3x slower. IIRC the benchmarks from Gambit@30, +# the numbers were still heavily in favor of GCC in October 2019. +# Thus we use GCC over clang, even on macOS. + +# Also note that I (fare) just ran benchmarks from https://github.com/ecraven/r7rs-benchmarks +# with Gambit 4.9.3 with -O1 vs -O2 vs -Os on Feb 2020. Which wins depends on the benchmark. +# The fight is unclear between -O1 and -O2, where -O1 wins more often, by up to 17%, +# but sometimes -O2 wins, once by up to 43%, so that overall -O2 is 5% faster. +# However, -Os seems more consistent in winning slightly against both -O1 and -O2, +# and is overall 15% faster than -O2. As for compile times, -O1 is fastest, +# -Os is about 29%-33% slower than -O1, while -O2 is about 40%-50% slower than -O1. +# Overall, -Os seems like the best choice, and that's what we now use. stdenv.mkDerivation rec { pname = "gambit"; @@ -7,38 +22,48 @@ stdenv.mkDerivation rec { bootstrap = import ./bootstrap.nix ( pkgs ); - # Use makeStaticLibraries to enable creation of statically linked binaries - buildInputs = [ git autoconf bootstrap openssl (makeStaticLibraries openssl)]; + # TODO: if/when we can get all the library packages we depend on to have static versions, + # we could use something like (makeStaticLibraries openssl) to enable creation + # of statically linked binaries by gsc. + buildInputs = [ git autoconf bootstrap openssl ]; + + configureFlags = [ + "--enable-single-host" + "--enable-c-opt=-Os" + "--enable-gcc-opts" + "--enable-shared" + "--enable-absolute-shared-libs" # Yes, NixOS will want an absolute path, and fix it. + "--enable-poll" + "--enable-openssl" + "--enable-default-runtime-options=f8,-8,t8" # Default to UTF-8 for source and all I/O + # "--enable-debug" # Nope: enables plenty of good stuff, but also the costly console.log + # "--enable-multiple-versions" # Nope, NixOS already does version multiplexing + # "--enable-guide" + # "--enable-track-scheme" + # "--enable-high-res-timing" + # "--enable-max-processors=4" + # "--enable-multiple-vms" + # "--enable-dynamic-tls" + # "--enable-multiple-threaded-vms" # when SMP branch is merged in + # "--enable-thread-system=posix" # default when --enable-multiple-vms is on. + # "--enable-profile" + # "--enable-coverage" + # "--enable-inline-jumps" + # "--enable-char-size=1" # default is 4 + ]; configurePhase = '' - options=( - --prefix=$out - --enable-single-host - --enable-c-opt=-O2 - --enable-gcc-opts - --enable-shared - --enable-absolute-shared-libs # Yes, NixOS will want an absolute path, and fix it. - --enable-poll - --enable-openssl - --enable-default-runtime-options="f8,-8,t8" # Default to UTF-8 for source and all I/O - #--enable-debug # Nope: enables plenty of good stuff, but also the costly console.log + export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ + CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ + XMKMF=${coreutils}/bin/false + unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS + ./configure --prefix=$out ${builtins.concatStringsSep " " configureFlags} - #--enable-multiple-versions # Nope, NixOS already does version multiplexing - #--enable-guide - #--enable-track-scheme - #--enable-high-res-timing - #--enable-max-processors=4 - #--enable-multiple-vms - #--enable-dynamic-tls - #--enable-multiple-vms - #--enable-multiple-threaded-vms ## when SMP branch is merged in - #--enable-thread-system=posix ## default when --enable-multiple-vms is on. - #--enable-profile - #--enable-coverage - #--enable-inline-jumps - #--enable-char-size=1" ; default is 4 - ) - ./configure ''${options[@]} + # OS-specific paths are hardcoded in ./configure + substituteInPlace config.status \ + --replace /usr/local/opt/openssl/lib "${openssl.out}/lib" \ + --replace /usr/local/opt/openssl@1.1/lib "${openssl.out}/lib" + ./config.status ''; buildPhase = '' -- cgit 1.4.1 From 32b3758b3d9fcb39094b44dc3114d86f712b0fb0 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Mon, 23 Dec 2019 17:34:38 -0500 Subject: gambit-unstable: 2019-07-21 -> 2020-02-24 --- pkgs/development/compilers/gambit/unstable.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/gambit/unstable.nix b/pkgs/development/compilers/gambit/unstable.nix index d855b83f0afc..4c33c83c67b1 100644 --- a/pkgs/development/compilers/gambit/unstable.nix +++ b/pkgs/development/compilers/gambit/unstable.nix @@ -1,13 +1,13 @@ { stdenv, callPackage, fetchFromGitHub }: callPackage ./build.nix { - version = "unstable-2019-07-21"; -# git-version = "4.9.3-109-g3b5f74fa"; + version = "unstable-2020-02-24"; +# git-version = "4.9.3-979-gc69e9f70"; src = fetchFromGitHub { owner = "feeley"; repo = "gambit"; - rev = "3b5f74fae74b2159e3bf6923f29a18b31cc15dcc"; - sha256 = "07cb0d8754dqhxawkp5dp4y0bsa9kfald4dkj60j5yfnsp81y5mi"; + rev = "c69e9f70dfdc6545353b135a5d5e2f9234f1e1cc"; + sha256 = "1f69n7yzzdv3wpnjlrbck38xpa8115vbady43mc544l39ckklr0k"; }; inherit stdenv; } -- cgit 1.4.1 From 4ee219ef8ebf8f3b60106156d2f6a81a156b25fe Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Mon, 23 Dec 2019 17:35:10 -0500 Subject: gerbil-unstable: 2019-11-15 -> 2020-02-27 Let Gerbil Scheme find its GERBIL_HOME where Nix put it when the environment variable is left unspecified. Comment out work in progress for static linking. Notes about working on macOS. --- pkgs/development/compilers/gerbil/build.nix | 39 ++++++++++++++++---------- pkgs/development/compilers/gerbil/unstable.nix | 8 +++--- 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/gerbil/build.nix b/pkgs/development/compilers/gerbil/build.nix index e2ab09764827..21c2936fa0f8 100644 --- a/pkgs/development/compilers/gerbil/build.nix +++ b/pkgs/development/compilers/gerbil/build.nix @@ -3,9 +3,6 @@ openssl, zlib, sqlite, libxml2, libyaml, libmysqlclient, lmdb, leveldb, postgresql, version, git-version, gambit, src }: -# TODO: distinct packages for gerbil-release and gerbil-devel -# TODO: make static compilation work - stdenv.mkDerivation rec { pname = "gerbil"; inherit version; @@ -32,19 +29,23 @@ stdenv.mkDerivation rec { substituteInPlace "$f" --replace '"gsc"' '"${gambit}/bin/gsc"' done substituteInPlace "etc/gerbil.el" --replace '"gxc"' "\"$out/bin/gxc\"" - - cat > etc/gerbil_static_libraries.sh < etc/gerbil_static_libraries.sh <