New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mathematica: fix library paths #27440
Conversation
@@ -93,6 +94,12 @@ stdenv.mkDerivation rec { | |||
|
|||
echo "=== Running MathInstaller ===" | |||
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent | |||
|
|||
# Fix library paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the preFixup the rpath is already being fixed. Adding zlib
to buildInputs
should be sufficient. Please test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested but adding zlib
to buildInputs
is not sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use ldd
on all executables and check which ones don't have a correct reference for zlib
.
The rpath is fixed for executables in libexec
, it may be that the executables you modify here need zlib
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
% pwd
/nix/store/zldjril1j51qy4zjz9442cgrhh3wvg4v-mathematica-11.1.1-ja/libexec/Mathematica/SystemFiles
% for dir in (find . -type d)
cd $dir
for file in (find . -type f -perm -0100)
ldd $file | rg "`ZLIB_1.2.9' not found"
end
prevd
end
cd: The directory “./Formats” does not exist
cd: The directory “./Formats/PHPIni” does not exist
./libpangocairo-1.0.so.0: ./libz.so.1: version `ZLIB_1.2.9' not found (required by /nix/store/3ah3k65zwlfz1gjf0fxsv0ygz90b7g8i-libpng-apng-1.6.29/lib/libpng16.so.16)
./libpangoft2-1.0.so: ./libz.so.1: version `ZLIB_1.2.9' not found (required by /nix/store/3ah3k65zwlfz1gjf0fxsv0ygz90b7g8i-libpng-apng-1.6.29/lib/libpng16.so.16)
./libpangocairo-1.0.so: ./libz.so.1: version `ZLIB_1.2.9' not found (required by /nix/store/3ah3k65zwlfz1gjf0fxsv0ygz90b7g8i-libpng-apng-1.6.29/lib/libpng16.so.16)
./libpangoxft-1.0.so.0: ./libz.so.1: version `ZLIB_1.2.9' not found (required by /nix/store/3ah3k65zwlfz1gjf0fxsv0ygz90b7g8i-libpng-apng-1.6.29/lib/libpng16.so.16)
./libpangoxft-1.0.so: ./libz.so.1: version `ZLIB_1.2.9' not found (required by /nix/store/3ah3k65zwlfz1gjf0fxsv0ygz90b7g8i-libpng-apng-1.6.29/lib/libpng16.so.16)
./libpangoft2-1.0.so.0: ./libz.so.1: version `ZLIB_1.2.9' not found (required by /nix/store/3ah3k65zwlfz1gjf0fxsv0ygz90b7g8i-libpng-apng-1.6.29/lib/libpng16.so.16)
The above library files are located in $out/libexec/Mathematica/SystemFiles/Libraries/Linux-x86-64/
, which also haslibz.so.1
shipped with Mathematica.
I have confirmed that just deleting this libz.so.1
works fine. Instead of lines 98-102:
# Delete shipped libz
case `uname -m` in
i?86)
zlib_dirs="Linux" ;;
x86_64)
zlib_dirs="Linux-x86-64 Linux" ;;
armv?l)
zlib_dirs="Linux-ARM" ;;
esac
if [ -n "''${zlib_dirs}" ]; then
for dir in ''${zlib_dirs}; do
rm $out/libexec/Mathematica/SystemFiles/Libraries/''${dir}/libz.so.1
done
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we have zlib 1.2.11 currently and not 1.2.9. I could imagine issues with using our version instead of the vendored one. From your list it seems pango is vendored already as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet this might just work for now:
https://abi-laboratory.pro/tracker/timeline/zlib/index.html
The ABI change in 1.2.10 for deflate_copyright is probably just that 1.2.10 is one character longer than 1.2.9:
const char deflate_copyright[] =
" deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I don't understand is how nixpkgs's libpng gets into the picture...
ce26e62
to
488db3d
Compare
# Fix library paths | ||
cd $out/libexec/Mathematica/Executables | ||
for path in mathematica MathKernel Mathematica WolframKernel wolfram; do | ||
sed -i -e 's/export LD_LIBRARY_PATH/export LD_LIBRARY_PATH=${builtins.replaceStrings ["/"] ["\\/"] "${zlib}/lib"}:\''${LD_LIBRARY_PATH}/' $path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps
sed -i -e 's#export LD_LIBRARY_PATH#export LD_LIBRARY_PATH=${zlib}/lib:\''${LD_LIBRARY_PATH}#' $path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. That's better. I modified the line.
What should be changed/added in order for this pull request to be accepted? (Mathematica derivation is also one version behind) |
This PR may fix #27401.
I applied this patch to my local nix expression of Mathematica 11.1.1 Japanese version and the problem has been solved. As I have only this version, I am not sure about whether this patch can fix the problem in the other versions. Sorry.