[Nix-dev] Correct way to solve `libgcc_s.so.1` problem
Daniel Hlynskyi
abcz2.uprola at gmail.com
Wed Oct 16 01:09:52 CEST 2013
I'm using GHCi (inside load-env-haskell). It happend that I Ctrl-C'anceled
a threaded program and GHCi was killed with "libgcc_s.so.1 must be
installed for pthread_cancel to work"
So now I have to instruct GHCi to find this library. But what is the proper
way to do so in NixOS? I've found existing solutions
([1],[2],[3],[4],[5],[6],[7],[8]) but cannot figure what to choose and
where to write those magic lines.
[1] guile:
# Explicitly link against libgcc_s, to work around the infamous
# "libgcc_s.so.1 must be installed for pthread_cancel to work".
# don't have "libgcc_s.so.1" on darwin
LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
[2] glibc
# When building glibc from bootstrap-tools, we need libgcc_s at RPATH
for
# any program we run, because the gcc will have been placed at a new
# store path than that determined when built (as a source for the
# bootstrap-tools tarball)
# Building from a proper gcc staying in the path where it was installed,
# libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found
without
# any special hack.
preInstall = ''
if [ -f ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 ]; then
mkdir -p $out/lib
ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
fi
'';
[3] guile-lib
preCheck =
# Make `libgcc_s.so' visible for `pthread_cancel'.
'' export LD_LIBRARY_PATH="$(dirname $(echo
${stdenv.gcc.gcc}/lib*/libgcc_s.so)):$LD_LIBRARY_PATH"
'';
[4] androidenv/build-tools
# These binaries need to find libstdc++ and libgcc_s
for i in aidl libLLVM.so
do
patchelf --set-rpath ${stdenv_32bit.gcc.gcc}/lib $i
done
[5] castle-combat
fixLoaderPath =
let dollar = "\$"; in
'' sed -i "$out/bin/castle-combat" \
-e "/^exec/ iexport LD_LIBRARY_PATH=\"$(cat
${stdenv.gcc}/nix-support/orig-gcc)/lib\:"'${dollar}'"LD_LIBRARY_PATH\"\\
export LD_LIBRARY_PATH=\"$(cat
${stdenv.gcc}/nix-support/orig-gcc)/lib64\:"'${dollar}'"LD_LIBRARY_PATH\""
'';
# ^
# `--- The run-time says: "libgcc_s.so.1 must be installed for
# pthread_cancel to work", which means it needs help to find it.
[6] uqm
/* uses pthread_cancel(), which requires libgcc_s.so.1 to be
loadable at run-time. Adding the flag below ensures that the
library can be found. Obviously, though, this is a hack. */
NIX_LDFLAGS="-lgcc_s";
[7] ufoai
NIX_CFLAGS_LINK = "-lgcc_s"; # to avoid occasional runtime error in
finding libgcc_s.so.1
[8] pjsip
# We need the libgcc_s.so.1 loadable (for pthread_cancel to work)
dontPatchELF = true;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20131016/da9adfbe/attachment.html
More information about the nix-dev
mailing list