multi-build / multibuild

Machinery for building and testing Python Wheels for Linux, OSX and (less flexibly) Windows.
Other
241 stars 88 forks source link

Ensure cmake-compiled libraries aren't installed with an rpath #531

Closed freakboy3742 closed 1 month ago

freakboy3742 commented 1 month ago

The default behavior of cmake is to build and install a library with the library's install_name set to @rpath/libname.dylib. While this is a good default when the library is being used in an executable, it's a problem on macOS when the library is being used as a dependency in a wheel, because the @rpath can't be resolved as part of the delocate process.

Libraries build with autotools/configure (or manually constructed makefiles) aren't affected by this; their default install name is the full install path unless specifically configured with an installation name.

The libblosc build instruction already included a workaround to explicitly set the library identifiers; it's possible to replace that workaround with an explicit cmake configuration.

In addition, the CMAKE_INSTALL_LIBDIR value used for libjpeg-turbo is redundant, as the /lib suffix will be implied from the CMAKE_INSTALL_PREFIX value.

freakboy3742 commented 1 month ago

The CI failure appears to be a transient issue caused by network availability; I've force-pushed to re-trigger CI.

mattip commented 1 month ago

Thanks @freakboy3742

radarhere commented 1 month ago

In addition, the CMAKE_INSTALL_LIBDIR value used for libjpeg-turbo is redundant, as the /lib suffix will be implied from the CMAKE_INSTALL_PREFIX value.

Could you link to something showing this theory? In practice, I find that this change does actually make a difference. See #537 for a demonstration and my suggestion to revert this.

freakboy3742 commented 1 month ago

@radarhere I'll take the conversation to #537 so the context of any revert isn't lost.