Fixing ifcopenshell, libxml2 not found by linker at runtime

I’m currently trying to fix ifcopenshell on nixpkgs.

I’ve made good progress and now with the change I made in the MR linked above, the library compiles just fine.

However, I have an error at runtime:

❯ ./result/bin/IfcConvert  --version
./result/bin/IfcConvert: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

And sure enough, ldd says libxml2.so.2 => not found

It’s odd, because libxml2 is in my buildInputs and I had the same trouble with opencascade, and adding it to buildInputs fixed it.

Is there anything special with libxml2? What is going on here?

One intuition I have is that maybe I should separate the c++ package from the python part, but I’m not even sure it is relevant to this issue.

Thanks!

I found a partial solution: this package was using buildPythonPackage, but it needed to use stdenv.mkDerivation. Using the latter fixes things. I think it is because it patches the elf, contrary to the former.

But now, I need to figure out how to create the python package from the build result (the build process creates a .so and a python folder containing the python bindings that uses this .so).