Skip to content

macOS build fails "ld: library not found for -lminizip" even though CMake has found it #3933

Closed as not planned

Description

@MarkCallow

Describe the bug
After CMake configure and generate the build fails with the error ld: library not found for -lminizip. As can be seen in the screen shot below CMake has found libminizip.dylib. And as can be seen in the link command given in Additional Context there is no option to add /opt/local/lib as a place to search for libaries. So it is not surprising the link fails.

To Reproduce
Steps to reproduce the behavior:

  1. Install minizip via macports - sudo port install minizip
  2. Run CMake GUI. Configure - selecting default build tools (Xcode), and selecting only importers (no tools, no exporters).
  3. Generate project
  4. cd <directory with generated project>; cmake --build . --config Release
  5. See error

Expected behavior
I expect the build to succeed.

Screenshots
Screenshot of CMake GUI showing it found libminizip.dylib in /opt/local/lib:

Screen Shot 2021-05-30 at 9 59 23 PM

Platform (please complete the following information):

  • OS: macOS
  • Browser: n/a
  • Version 11.4 (Big Sur)

Additional context
Here is the link command and output:

Ld /Users/mark/Projects/github/assimp/macOS/bin/Release/libassimp.5.0.1.dylib normal (in target 'assimp' from project 'Assimp')
    cd /Users/mark/Projects/github/assimp/assimp
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos11.3 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -L/Users/mark/Projects/github/assimp/macOS/bin/Release -F/Users/mark/Projects/github/assimp/macOS/bin/Release -filelist /Users/mark/Projects/github/assimp/macOS/code/Assimp.build/Release/assimp.build/Objects-normal/x86_64/assimp.5.0.1.LinkFileList -install_name /libassimp.5.0.1.dylib -Xlinker -rpath -Xlinker /Users/mark/Projects/github/assimp/macOS/bin/Release -dynamiclib -Wl,-headerpad_max_install_names -install_name @rpath/libassimp.5.dylib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/libz.tbd /Users/mark/Projects/github/assimp/macOS/bin/Release/libdraco.1.dylib -lminizip -Xlinker -no_adhoc_codesign -compatibility_version 5.0.0 -current_version 5.0.1 -Xlinker -dependency_info -Xlinker /Users/mark/Projects/github/assimp/macOS/code/Assimp.build/Release/assimp.build/Objects-normal/x86_64/assimp.5.0.1_dependency_info.dat -o /Users/mark/Projects/github/assimp/macOS/bin/Release/libassimp.5.0.1.dylib
ld: library not found for -lminizip
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Activity

  1. added
    Bug
    on May 30, 2021
  2. MarkCallow commented on Jun 9, 2021

    @MarkCallow
    Author

    Can I get some help here. I am completely stalled.

    I started trying to update my libassimp build because the latest clang versions give lots of warnings about deprecated copy constructors with the assimp headers of the version I was using. Unfortunately, but not surprisingly, if I compile my app with the latest headers but link it to the older version of the library, it crashes when run.

  3. MarkCallow commented on Jul 2, 2021

    @MarkCallow
    Author

    Can anyone build this library for macOS? I'm still failing. Don't the authors care?

  4. ryandesign commented on Feb 21, 2022

    @ryandesign

    Yeah if assimp wants to link with MacPorts minizip, it's going to have to use either -L/opt/local/lib -lminizip, or use -lminizip and have /opt/local/lib in LIBRARY_PATH, or use the full path /opt/local/lib/libminizip.dylib. I don't know how assimp is deciding what flags to use, but it would have gotten a working set of flags if it had used, say, pkg-config:

    $ pkg-config --libs minizip
    -L/opt/local/lib -lminizip
    

    If you want something that just works, you can install assimp with MacPorts.

  5. tellypresence commented on Apr 15, 2025

    @tellypresence
    Collaborator

    @MarkCallow Is this still a problem?

  6. MarkCallow commented on Apr 16, 2025

    @MarkCallow
    Author

    @MarkCallow Is this still a problem?

    I don't use MacPorts any more so I can't say. I'm using vcpkg now for my dependencies, so I get libraries that can be bundled with my app, and vcpkg is building assimp without a problem.

    I'll close this as "not planned."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions