Closed l-4-l closed 1 month ago
It's probably because the inclusion of the SSE2/SSE3 intrinsics headers is unguarded. Can you try the following?
diff --git a/libs/sfm/nearest_neighbor.cc b/libs/sfm/nearest_neighbor.cc
index 14825f6bc4e0..0924175beae4 100644
--- a/libs/sfm/nearest_neighbor.cc
+++ b/libs/sfm/nearest_neighbor.cc
@@ -39,8 +39,12 @@
#include <algorithm>
#include <iostream>
-#include <emmintrin.h> // SSE2
-#include <pmmintrin.h> // SSE3
+#if defined(__SSE2__)
+# include <emmintrin.h> // SSE2
+#endif
+#if defined(__SSE3__)
+# include <pmmintrin.h> // SSE3
+#endif
#include "sfm/nearest_neighbor.h"
@andre-schulz thank you, it works. Now it fails on linking stage:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C apps
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C bundle2pset
c++ bundle2pset.o ../../libs/mve/libmve.a ../../libs/util/libmve_util.a -lpng -ltiff -ljpeg -L/opt/homebrew/lib -o bundle2pset
Undefined symbols for architecture arm64:
"mve::geom::save_ply_mesh(std::__1::shared_ptr<mve::TriangleMesh const>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, mve::geom::SavePLYOptions const&)", referenced from:
_main in bundle2pset.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bundle2pset] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2
Hm that's weird. Can you post the command-line how bundle2pset.o
was compiled and the output of objdump -a bundle2pset.o
?
@andre-schulz
The original full output (make -j8
):
% make -j8
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C libs
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C math
#ar rcs libmve_math.a
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C util
make[2]: `libmve_util.a' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C mve
make[2]: `libmve.a' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C sfm
make[2]: `libmve_sfm.a' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C dmrecon
make[2]: `libmve_dmrecon.a' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C fssr
make[2]: `libmve_fssr.a' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ogl
make[2]: `libmve_ogl.a' is up to date.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C apps
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C bundle2pset
c++ bundle2pset.o ../../libs/mve/libmve.a ../../libs/util/libmve_util.a -lpng -ltiff -ljpeg -L/opt/homebrew/lib -o bundle2pset
Undefined symbols for architecture arm64:
"mve::geom::save_ply_mesh(std::__1::shared_ptr<mve::TriangleMesh const>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, mve::geom::SavePLYOptions const&)", referenced from:
_main in bundle2pset.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bundle2pset] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2
Then I repeated the problematic command with -v
in the problematic folder:
% c++ -v bundle2pset.o ../../libs/mve/libmve.a ../../libs/util/libmve_util.a -lpng -ltiff -ljpeg -L/opt/homebrew/lib -o bundle2pset
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch arm64 -platform_version macos 14.0.0 14.4 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o bundle2pset -L/opt/homebrew/lib -L/usr/local/lib bundle2pset.o ../../libs/mve/libmve.a ../../libs/util/libmve_util.a -lpng -ltiff -ljpeg -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture arm64:
"mve::geom::save_ply_mesh(std::__1::shared_ptr<mve::TriangleMesh const>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, mve::geom::SavePLYOptions const&)", referenced from:
_main in bundle2pset.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ObjDump shows that bundle2pset.o
is arm64:
% objdump -a bundle2pset.o
bundle2pset.o: file format mach-o arm64
it looks like make cleanup
magically helped the situation, it is built successfully on MacOS M1, all problems are solved by adding -I/opt/homebrew/include
and -L/opt/homebrew/lib
to each Makefile which mentions -lpng
.
@andre-schulz Thank you for your support!
That's great to hear! Have fun with MVE! :slightly_smiling_face: :+1:
another small problem with compiling of UMVE (QT): in new QT5.6+ (https://www.qtcentre.org/threads/65744-include-quot-QDialog-quot-etc-not-found-after-upgrade-from-5-4-to-5-6) a module "widgets" must be added to the umve.pro
, if it's not there, the make
cannot find QApplication
header. Diff:
diff --git a/apps/umve/umve.pro b/apps/umve/umve.pro
index a6c4227..f1cddf4 100644
--- a/apps/umve/umve.pro
+++ b/apps/umve/umve.pro
@@ -1,7 +1,7 @@
MVE_ROOT = ../..
CONFIG += qt release c++11
-QT += concurrent opengl
+QT += concurrent opengl widgets
I am trying to compile the MVE in MacOS (Sonoma 14.4.1), with CPU M1 Max.
I installed libraries with brew command:
Because it was still complaining about missing headers, I modified
libs/mve/Makefile
as following:I executed
make -j8
. Now I have at least 20 compilation errors "This header is only meant to be used on x86 and x64 architecture", first lines with error:I tried to compile with Docker, command line
docker buildx -t mve build .
, result is that it cannot findemmintrin.h
. I suppose it is also because of Apple Silicon architecture but this time in Docker image. Start of the docker build log:End of the docker build log (first error message):
Did anybody tried to compile for MacOS Silicon?