summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2022-06-26 22:28:11 +0100
committerSergei Trofimovich <slyich@gmail.com>2022-06-26 22:29:26 +0100
commitce6f0bee59f91f174e51dc92bfeb5698ca7da84a (patch)
tree0fc1d31f6c03ab3aa9ac5c8db20a8735303e18c8
parentf9f61cdd8976bc46ec64b1f3cb843d60d26f46ea (diff)
downloadnixpkgs-ce6f0bee59f91f174e51dc92bfeb5698ca7da84a.tar
nixpkgs-ce6f0bee59f91f174e51dc92bfeb5698ca7da84a.tar.gz
nixpkgs-ce6f0bee59f91f174e51dc92bfeb5698ca7da84a.tar.bz2
nixpkgs-ce6f0bee59f91f174e51dc92bfeb5698ca7da84a.tar.lz
nixpkgs-ce6f0bee59f91f174e51dc92bfeb5698ca7da84a.tar.xz
nixpkgs-ce6f0bee59f91f174e51dc92bfeb5698ca7da84a.tar.zst
nixpkgs-ce6f0bee59f91f174e51dc92bfeb5698ca7da84a.zip
bs-platform: workaround -fno-common build failure on aarch64
Without the change -fno-common toolchain like llvm-11 fails as:

    ld: libcamlrun.a(minor_gc.o):/build/ocaml/byterun/caml/major_gc.h:67: multiple definition of
      `caml_major_ring'; libcamlrun.a(stacks.o):/build/ocaml/byterun/caml/major_gc.h:67: first defined here
-rw-r--r--pkgs/development/compilers/bs-platform/ocaml.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/development/compilers/bs-platform/ocaml.nix b/pkgs/development/compilers/bs-platform/ocaml.nix
index 05fb8b6b17e..3fe0e0b2eed 100644
--- a/pkgs/development/compilers/bs-platform/ocaml.nix
+++ b/pkgs/development/compilers/bs-platform/ocaml.nix
@@ -5,6 +5,13 @@ stdenv.mkDerivation rec {
   configurePhase = ''
     ./configure -prefix $out
   '';
+
+  # Workaround ocaml-4.06 limitation of duplicate definitions.
+  #   ld: libcamlrun.a(minor_gc.o):/build/ocaml/byterun/caml/major_gc.h:67: multiple definition of
+  #     `caml_major_ring'; libcamlrun.a(stacks.o):/build/ocaml/byterun/caml/major_gc.h:67: first defined here
+  # Match -fcommon workaround in ocaml-4.06 itself.
+  NIX_CFLAGS_COMPILE = "-fcommon";
+
   buildPhase = ''
     make -j9 world.opt
   '';