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
podofo: fix library linkage on Darwin #47214
Conversation
Because the library is not yet installed when the tools are build, it does not contain its final store path as its install name. Linking the tools picks up this incorrect install name and needs to be fixed after installing.
This is really strange, the dylib does have a correct install_name. The fact that the binaries built before the libraries are installed is not a problem and exactly what the install_name is for. It's used by the linker to allow linking against absolute paths while the library isn't installed in it's final location yet. |
The dylib only receives its correct install_name when it is installed. The binaries are built before that, where the install_name of the library was still containing only the filename without any path information. At least that’s what happens when I observed the build. I am not a cmake expert, though. I guess it works fine when you only build a library and then another project links against that library. But doing both in the same cmake build appears not to work properly. |
Fact is that the current
|
Hmm, that's unfortunate. Guess they must be using some nonstandard build scripts because I've not seen this before with cmake builds. |
@@ -30,6 +31,12 @@ stdenv.mkDerivation rec { | |||
|
|||
cmakeFlags = "-DPODOFO_BUILD_SHARED=ON -DPODOFO_BUILD_STATIC=OFF"; | |||
|
|||
postFixup = if stdenv.isDarwin then '' |
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.
nitpick, use stdenv.lib.optionalString
instead of an if statement.
use stdenv.lib.optionalString instead of an if statement
Thanks a lot for this tip. I am rather new to Nix, so I did not know about |
No big deal 😄. It does about the same thing, but it's slightly nicer to use IMHO. |
I agree. Thanks for making contributing to Nix such a nice experience. |
* podofo: fix library linkage on Darwin Because the library is not yet installed when the tools are build, it does not contain its final store path as its install name. Linking the tools picks up this incorrect install name and needs to be fixed after installing. (cherry picked from commit 4b1ffa0)
That's great to hear! Feel free to ping the NixOS/darwin-maintainers group or me if you make other darwin contributions that don't get the attention of the correct people. The repository is very active and sometimes changes can get a bit lost if people with relevant knowledge miss it. backported to 18.09 in 0253b1e |
The podofo package is currently broken on Darwin: the podofo tools do not find libpodofo.0.9.6.dylib at runtime, because the library path the binary is linked against is incomplete.
The reason is that podofo builds both the library and the tools using this library in the same
cmake
run. And since the library is not yet installed when the tools are build, it does not contain the final store path as its install name. Linking the tools therefore picks up this incorrect install name.I fixed this with a fixupPost script. I am not sure this is the correct way, since I am rather new to Nix, but the package works on Darwin now and this should have no effect for Linux.
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)