-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I am building an application (QGIS) that depends on python packages that, in turn, rely on external c/c++ libraries. It uses a custom triplet that builds shared libraries for most dependencies. I have successfully built the application on MacOS, but when I try to build on linux, the import test for these packages fails because python/the package can't find the external libraries on which it depends. If I instead build using static linking of dependencies, the tests work fine.
To give a specific example where I am encountering this issue, the py-numpy package depends on OpenBlas. Building an application that depends on py-numpy successfully builds all the dependencies (python, openblas, lapack, etc) and successfully builds the numpy package, but vcpkg it attempts to run vcpkg_python_test_import, the import fails with the message
ImportError: libopenblas.so.0: cannot open shared object file: No such file or directoryThe problem appears to be that libopenblas.so.* are installed to the CURRENT_INSTALLED_DIR/lib directory, but that directory is not on the LD_LIBRARY_PATH when the test runs. vcpkg_python_test_import adds the CURRENT_PACKAGES_DIR to LD_LIBRARY_PATH, but that directory only includes files built by the package being tested, not its dependencies from other packages. If I run the import_test.py for numpy from the command line after setting LD_LIBRARY_PATH to the directory corresponding to CURRENT_INSTALLED_DIR, the import works. And if I make a local copy of the vcpkg-python-scripts port in my overlay-ports folder and add CURRENT_INSTALLED_DIR/lib to the LD_LIBRARY_PATH in vcpkg_python_test_import, the import works.
For reference, the triplet for dynamic linking of dependencies I'm using has the following contents:
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_FIXUP_ELF_RPATH ON)I don't know if this should be considered a bug in vcpkg_python_test_import or if there is some way I can work around this issue with my cmake or vcpkg setup.