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

Linking to minizip failure #2553

Closed
mario-deluna opened this issue Jul 19, 2019 · 3 comments
Closed

Linking to minizip failure #2553

mario-deluna opened this issue Jul 19, 2019 · 3 comments

Comments

@mario-deluna
Copy link

Just like in the issue #1801 im suddenly running into the following linker error:

ld: library not found for -lminizip

I have tried many things but have had no success so far. Right now I'm desperately trying to debug this and reinstall things to get it to compile again.

Things I've tried for example:

  • reinstall zlib
  • reinstall minizip
  • link zlib library directly
  • link zlib using hunter
  • assimp upgrade / downgrade (including RC5)
  • xcode-select --install
  • full brew upgrade
  • checking out a old version of my codebase that did work. (doesn't work now)
  • trying to only build assimp (works), assimp_cmd same issue.

To be honest I don't understand the issue enough which is why im at this point pretty much trying random stuff.

My make output:

-- Using Cocoa for window creation
-- Version: 5.2.1
-- Build type: Release
-- CXX_STANDARD: 17
-- Shared libraries disabled
-- Could NOT find rt (missing: RT_LIBRARY)
INFO RT-extension not found. glTF import/export will be built without Open3DGC-compression.
-- Enabled formats: AMF 3DS AC ASE ASSBIN ASSXML B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD STEP
-- Disabled formats:
CMake Warning at vendor/assimp/tools/assimp_qt_viewer/CMakeLists.txt:26 (MESSAGE):
  Build of assimp_qt_viewer is disabled.  Unsatisfied dendencies: Qt5


-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mariodoring/Developer/Games/SpaceDriftAndromeda

Thanks in advance for any help with this one.

@mario-deluna
Copy link
Author

So I finally found the issue and it is NOT directly related to assimp. I leave my findings here in case someone else bumps into the same problem.

After trying to analyze the issue better I have found the following discussion on the homebrew forums: https://discourse.brew.sh/t/cmake-linking-not-working-since-mojave/3790/11

And later this stack overflow entry:
https://stackoverflow.com/questions/54068035/linking-not-working-in-homebrews-cmake-since-mojave

High Sierra (<=10.13) and below did NOT use the -isysroot command.
Mojave (>=10.14) DOES use the -isysroot command.

-isysroot

This option is like the --sysroot option, but applies only to header files (except for >> Darwin targets, where it applies to both header files and libraries). See the --sysroot option for more information.

So this flag specifically clobbers the lib search path only on Apple. This results in the compilation never looking in the standard ld locations, which can be seen by typing ld -v dummy.

So explicitly telling cmake to add /usr/local/lib to its link directories fixes the issue.

# Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035
LINK_DIRECTORIES(/usr/local/lib)

@kimkulling
Copy link
Member

Thanks a lot for sharing this information!

@MarkCallow
Copy link

MarkCallow commented Sep 23, 2019

Thank you for indeed for the information. It would be even better if the fix had been incorporated in assimp's CMakeLists.txt. How do you add LINK_DIRECTORIES without breaking builds on other systems? I'm building for iOS as well and don't want to break that build. I'm not very familiar with CMake commands and syntax.

If somebody does add it, it needs to be a CMake option as not everyone uses Brew. I use MacPorts so I need /opt/local/lib.

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

3 participants