The use of --add-flags in this derivation assumed quotes to be expanded, which the binary
wrapper (which wrapGAppsHook uses since #164163) will not do.
Without the change -fno-common toolchains like upstream gcc-10
fail to build as:
ld: stats.o:/build/cataract-675e647/src/stats.h:24: multiple definition of
`stats_images'; cgg.o:/build/cataract-675e647/src/stats.h:24: first defined here
Without the update build fails on -fno-common toolchains as:
$ nix build --impure --expr 'with import ./. {}; bicon.override { stdenv = clang13Stdenv; }'
...
ld: bicon_bin-bicon_read.o:/build/source/bicon/bicon_read.c:37:
multiple definition of `bicon_options'; bicon_bin-bicon.o:/build/source/bicon/./bicon_read.h:4: first defined here
While at it pulled in pending fix for clang compatibility.
The sweethome3d program ships pre-compiled shared libraries for graphics that
need to be `patchelf`ed to work properly. Once the libraries are compressed into
the final .jar, Nix can no longer see the path references so they are not
declared a runtime dependency and the program won't run on a system that didn't
build it and doesn't happen to have the right paths already present on it by
chance.
This patch switches to autoPatchelfHook to ensure the libraries get patched
correctly, then scans the libraries to make a plain-text file with the same
paths so that Nix can see the references and account for them. I suspect this
problem might be lurking in other Java programs in nixpkgs.
Fixes#66471.