repulsive-curves icon indicating copy to clipboard operation
repulsive-curves copied to clipboard

Compiling on an M1 Mac

Open beaugunderson opened this issue 2 years ago • 3 comments

In case others want to build on where I got to:

  • brew install llvm (because Apple clang does not support -fopenmp)
  • cmake -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang ..
  • recursively replace all -march=native with -mcpu=apple-m1 (apparently clang 15.0 will support -march=native for M1, so if that has been released this step may be redundant)

Where I'm currently stuck is here:

[  2%] Built target stb
[ 15%] Built target glfw
[ 21%] Built target imgui
Consolidate compiler generated dependencies of target polyscope
[ 22%] Building CXX object deps/polyscope/src/CMakeFiles/polyscope.dir/gl/gl_utils.cpp.o
/Users/beau/p/repulsive-curves/deps/polyscope/src/gl/gl_utils.cpp:1357:12: error: variable 'targetType' set but not used [-Werror,-Wunused-but-set-variable]
    GLenum targetType;
           ^
/Users/beau/p/repulsive-curves/deps/polyscope/src/gl/gl_utils.cpp:1467:24: error: parameter 'fatal' set but not used [-Werror,-Wunused-but-set-parameter]
void checkGLError(bool fatal) {
                       ^
2 errors generated.
make[2]: *** [deps/polyscope/src/CMakeFiles/polyscope.dir/gl/gl_utils.cpp.o] Error 1
make[1]: *** [deps/polyscope/src/CMakeFiles/polyscope.dir/all] Error 2
make: *** [all] Error 2

I removed -Wunused-but-set-parameter from all of the places it appeared in all files in the tree but I still get that error.

beaugunderson avatar Apr 27 '22 21:04 beaugunderson

I get the same error on Linux, FC36 with Clang-14.0.0, I haven't confirmed yet, but im thinking some flag in one of the included CMake files is the issue.

makeclean avatar May 25 '22 22:05 makeclean

If you remove Wextra and Wall from

 SET(BASE_CXX_FLAGS "-std=c++11 -Werror -g3 -fPIC -fopenmp")

In the CMakeLists.txt file, you should be able to progress compilation.

I also change the definitions of size_t to std::size_t in /home/adavis/opt/repulsive-curves/include/export/mvproduct.h and /home/adavis/opt/repulsive-curves/src/export/mvproduct.cpp then it compiled fine, haven't tested it yet though.

makeclean avatar May 26 '22 08:05 makeclean

Thanks for the fix @makeclean, that plus specifying the library path for libomp got me going!

image

beaugunderson avatar May 28 '22 18:05 beaugunderson