cbqn: always compile using clang

Investigating the build failures of CBQN on i686 and aarch64, turns up
that CBQN is broken on these platforms only with gcc. In the case of
i686 due to a codegen bug, on aarch64 gcc doesn't like some CPP macros
CBQN uses.

The deeper reason for this is that CBQN primarily is developed for and
tested with clang, so it probably saves us trouble just using clang, as
it is no real problem for us to do so (clangStdenv is quite
unproblematic for pure C builds). This should also yield faster
binaries, since CBQN apparently uses some clang-specific tricks to get
quicker code generation.
This commit is contained in:
sternenseemann 2022-10-10 10:59:40 +02:00
parent ad0537ab1f
commit 0e5f7501b6

View file

@ -15148,22 +15148,35 @@ with pkgs;
# Below, the classic self-bootstrapping process
cbqn-bootstrap = lib.dontRecurseIntoAttrs {
# Use clang to compile CBQN if we aren't already.
# CBQN's upstream primarily targets and tests clang which means using gcc
# will result in slower binaries and on some platforms failing/broken builds.
# See https://github.com/dzaima/CBQN/issues/12.
#
# Known issues:
#
# * CBQN using gcc is broken at runtime on i686 due to
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416,
# * CBQN uses some CPP macros gcc doesn't like for aarch64.
stdenv = if !stdenv.cc.isClang then clangStdenv else stdenv;
mbqn-source = buildPackages.mbqn.src;
phase0 = callPackage ../development/interpreters/bqn/cbqn {
inherit (cbqn-bootstrap) stdenv;
genBytecode = false;
bqn-path = null;
mbqn-source = null;
};
phase1 = callPackage ../development/interpreters/bqn/cbqn {
inherit (cbqn-bootstrap) mbqn-source;
inherit (cbqn-bootstrap) mbqn-source stdenv;
genBytecode = true;
bqn-path = "${buildPackages.cbqn-bootstrap.phase0}/bin/cbqn";
};
phase2 = callPackage ../development/interpreters/bqn/cbqn {
inherit (cbqn-bootstrap) mbqn-source;
inherit (cbqn-bootstrap) mbqn-source stdenv;
genBytecode = true;
bqn-path = "${buildPackages.cbqn-bootstrap.phase1}/bin/cbqn";
};