Fixing macOS linking bug#1520
Conversation
|
Interesting. Can you try building with pip (or conda's) cmake, @mosra is there any reason to not add a link like this? It scares me but I'm not sure if that's rational or not :) |
|
The root cause is somewhere else and fixing it this way feels like a hack, sorry :) I'm not sure which dependency uses
This however makes me wonder -- it basically means that habitat implicitly depends on system-installed I'll investigate which library is responsible for this and how it can be fixed directly there. |
|
Yep, it's Assimp 🙄 The following patch should tell it to not look for diff --git a/src/cmake/dependencies.cmake b/src/cmake/dependencies.cmake
index 8e5bad96..ff97b3e0 100644
--- a/src/cmake/dependencies.cmake
+++ b/src/cmake/dependencies.cmake
@@ -69,6 +69,11 @@ if(BUILD_ASSIMP_SUPPORT)
# prefixed with ASSIMP_, so better set both variants to future-proof this.
set(INJECT_DEBUG_POSTFIX OFF CACHE BOOL "" FORCE)
set(ASSIMP_INJECT_DEBUG_POSTFIX OFF CACHE BOOL "" FORCE)
+ # Otherwise Assimp may attempt to find minizip on the filesystem using
+ # pkgconfig, but in a poor way that expects just yelling -lminizip at the
+ # linker without any link directories would work. It won't. (The variable
+ # is not an option() so no need to CACHE it.)
+ set(ASSIMP_BUILD_MINIZIP ON)
add_subdirectory("${DEPS_DIR}/assimp")
# Help FindAssimp locate everything
Funnily enough it doesn't seem to actually use it for anything (or at least that's what GitHub search tells me). I don't have any easy way to reproduce the original problem, can you check if this fixes it and the |
…into fixing-macOS-linking-bug
|
It looks like it is only used in Hunter Builds, otherwise it's not needed or used anywhere. |
|
@dhruvbatra can you try with these changes? |
|
Yes, confirming that this works. Thanks @erikwijmans and @mosra. |
Have assimp build minizip instead of just yelling -lminizip at the linker Co-authored-by: Dhruv Batra <dbatra@fb.com> Co-authored-by: Erik Wijmans <etw@gatech.edu>
Motivation and Context
Build from source on macOS fails at the linking step:
"ld: library not found for -lminizip"
Searching online the problem seems to be homebrew's cmake since Mojave:
https://stackoverflow.com/questions/54068035/linking-not-working-in-homebrews-cmake-since-mojave
How Has This Been Tested
By localing building on my mac.
Types of changes
Checklist