project-gemmi / gemmi

macromolecular crystallography library and utilities
https://project-gemmi.github.io/
Mozilla Public License 2.0
205 stars 42 forks source link

Apparent sudden extra dependency for gemmi (zlib) #301

Closed helenginn closed 4 months ago

helenginn commented 4 months ago

Running on Mac OS 13.4, M2 computer.

Firstly, thanks for all the hard work of further development on this project :)

I'm not sure if this was intended, but in a recent version (currently on 0.6.6), now I need to link my own project to zlib in order to prevent linking errors with the gemmi library. This does not seem to be an issue on Linux, but this requires extra steps on a Mac to rectify. I'm not sure if this was intended, but suddenly acquiring an extra dependency that I have no option of declining is a little nerve-wracking!

Can confirm that after adding zlib as a separate dependency, the executable links.

wojdyr commented 4 months ago

How do you build gemmi? With cmake? static or shared library?

helenginn commented 4 months ago

With cmake, and I'm linking the static library lib_gemmi.cpp.a (I think it's called!)

wojdyr commented 4 months ago

Do you use cmake later to build your project? (I'm wondering why it's different on Mac than on Linux)

wojdyr commented 4 months ago

I think I know why. Gemmi is built with zlib from the system when the zlib library is found. If not found, a subset of zlib distributed with gemmi is used instead. I suppose the zlib library was found on Mac and not on Linux.

You could build gemmi with -D INTERNAL_ZLIB=ON – then it won't use zlib from the system. Otherwise, zlib needs to be linked when using static library. But when using cmake, it should get linked automatically.

helenginn commented 4 months ago

Thank you!