Skip to content
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

MacOs linker problem #3

Open
Czaki opened this issue May 28, 2021 · 0 comments
Open

MacOs linker problem #3

Czaki opened this issue May 28, 2021 · 0 comments

Comments

@Czaki
Copy link
Owner

Czaki commented May 28, 2021

During building the macOS extension I found that libtiff and libblosc are "linked" (not sure if proper name) system site libraries libzstd and liblz4, which are built earlier and properly find by cmake.

-- Found LZ4 library: /Users/runner/work/1/s/build_utils/libs_build/lib/liblz4.dylib
-- Found Zstd library: /Users/runner/work/1/s/build_utils/libs_build/lib/libzstd.dylib

Here log:
https://dev.azure.com/bokota/imagecodecs/_build/results?buildId=638&view=logs&j=567a25c9-267d-5ec8-0386-2960989da2e4&t=f2935ac5-f96c-5e27-6bc4-6f14b3e80853&l=3463

It could be fixed using

install_name_tool -change /usr/local/lib/libzstd.1.dylib @rpath/libzstd.1.5.0.dylib "${lib_dir}/libtiff.5.7.0.dylib"
install_name_tool -change /usr/local/lib/libzstd.1.dylib @rpath/libzstd.1.5.0.dylib "${lib_dir}/libblosc.1.21.0.dylib"
install_name_tool -change /usr/local/lib/liblz4.1.dylib @rpath/liblz4.1.9.3.dylib "${lib_dir}/libblosc.1.21.0.dylib"

but I would like to understand why after compilation I got (oas part of otool -l build_utils/libs_build/lib/libtiff.5.7.0.dylib)

          cmd LC_LOAD_DYLIB
      cmdsize 40
         name liblerc.dylib (offset 24)
   time stamp 2 Thu Jan  1 00:00:02 1970
      current version 0.0.0
compatibility version 0.0.0
Load command 14
          cmd LC_LOAD_DYLIB
      cmdsize 56
         name /usr/local/lib/libzstd.1.dylib (offset 24)
   time stamp 2 Thu Jan  1 00:00:02 1970
      current version 1.5.0
compatibility version 1.0.0
Load command 15

even if build_utils/libs_build/lib/ contains both libzstd.1.dylib and liblerc.dylib

Environment variables are set inside azure-pipelines.yaml

LD_LIBRARY_PATH: $(Build.Repository.LocalPath)/build_utils/libs_build/lib

LIBRARY_PATH: $(LD_LIBRARY_PATH)
DYLD_LIBRARY_PATH: $(LD_LIBRARY_PATH)
LD_RUNPATH_SEARCH_PATH: $(LD_LIBRARY_PATH)
DYLD_FALLBACK_LIBRARY_PATH: $(LD_LIBRARY_PATH)
MACOSX_DEPLOYMENT_TARGET: "10.9"

Build command is here:

echo "Build libtiff"
cd "${download_dir}/libtiff" || exit 1
mkdir -p _build
cd _build || exit 1
CMAKE_PREFIX_PATH=${build_dir} cmake -DCMAKE_INSTALL_PREFIX="${build_dir}" ..
make
make install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant