building openSFM on Apple M1 MacStudio fails: missing symbols for arm64
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 899
- PR merge metrics
- No merged PRs in 30d
Description
I am attempting to build openSFM on a Apple M1 CPU. Others have tried this and submitted an addition to CMakeLists.txt
in opensfm/src directory.
For compiling VLFeat
add_definitions(-DVL_DISABLE_AVX)
if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64" )
add_definitions( -DVL_DISABLE_SSE2 )
endif()
This correction permitted the build to continue to the linking stage that failed.
Here is the screen output with the error:
Consolidate compiler generated dependencies of target map_test
[ 83%] Building CXX object robust/CMakeFiles/pyrobust.dir/python/pybind.cc.o
[ 84%] Building CXX object sfm/CMakeFiles/sfm.dir/src/retriangulation.cc.o
[ 84%] Building CXX object map/CMakeFiles/pymap.dir/python/pybind.cc.o
[ 85%] Building CXX object sfm/CMakeFiles/sfm.dir/src/ba_helpers.cc.o
[ 86%] Building CXX object sfm/CMakeFiles/sfm.dir/src/tracks_helpers.cc.o
[ 89%] Built target map_test
Undefined symbols for architecture arm64:
"__ZN6google4base21CheckOpMessageBuilder9NewStringB5cxx11Ev", referenced from:
__ZN6google17MakeCheckOpStringImiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc in libgeometry.a(triangulation.cc.o)
__ZN6google17MakeCheckOpStringIiN5ceres29TinySolverCostFunctionAdapterILin1ELi3EE17ComponentSizeTypeEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc in libgeometry.a(triangulation.cc.o)
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make[2]: *** [geometry/geometry_test] Error 1
make[1]: *** [geometry/CMakeFiles/geometry_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
What is the solution here?
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with opensfm/src/CMakeLists.txt and the arm64 build output, including the VLFeat definitions and the geometry_test linker failure. Reproduce the build on an Apple M1 system, then trace the missing symbol through the Ceres and geometry_test linkage. Done means the arm64 build links successfully and geometry_test completes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, macos
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100