curv3d / curv

a language for making art using mathematics
Apache License 2.0
1.14k stars 73 forks source link

Curv can't find boost include file during build (M1 Mac with macOS 11.4) #128

Closed ornamentist closed 3 years ago

ornamentist commented 3 years ago

When building curv on macOS 11.4 on an M1 Mac, the prerequisites installed fine. However the make invocation gives this error:

[ 19%] Building CXX object CMakeFiles/libcurv_geom.dir/libcurv/geom/builtin.cc.o
In file included from /Users/stu/curv/libcurv/geom/builtin.cc:5:
In file included from /Users/stu/curv/./libcurv/geom/builtin.h:8:
In file included from /Users/stu/curv/./libcurv/system.h:11:
/Users/stu/curv/./libcurv/filesystem.h:8:10: fatal error: 'boost/filesystem.hpp' file not found
#include <boost/filesystem.hpp>

That file looks to be installed:

$ find /opt -name 'filesystem.hpp'
/opt/homebrew/Cellar/boost/1.76.0/include/boost/nowide/filesystem.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/filesystem.hpp

This may just be a matter of adding a -I option to a CMake parameter somewhere for macOS 11.x builds?

doug-moen commented 3 years ago

Thanks for testing on Apple Silicon. I don't have access to this hardware myself, but try with my latest change and see if it works.

ornamentist commented 3 years ago

Thanks for fixing that. With the latest version the build got a lot further before seeing this error:

[ 78%] Building CXX object extern/openvdb/openvdb/openvdb/CMakeFiles/openvdb_static.dir/Grid.cc.o
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/Grid.cc:4:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/./Grid.h:12:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/./tree/Tree.h:13:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/tools/Count.h:15:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/tree/NodeManager.h:18:
In file included from /opt/homebrew/include/tbb/parallel_reduce.h:17:
/opt/homebrew/include/tbb/../oneapi/tbb/parallel_reduce.h:353:57: error: reference to 'split' is ambiguous
    lambda_reduce_body( lambda_reduce_body& other, tbb::split )
                                                        ^
/Users/stu/curv/extern/openvdb/openvdb/openvdb/math/Coord.h:16:23: note: candidate found by name lookup is 'tbb::split'
namespace tbb { class split; } // forward declaration
                      ^
/opt/homebrew/include/tbb/../oneapi/tbb/parallel_for.h:410:15: note: candidate found by name lookup is 'tbb::v1::split'
using detail::split;
              ^
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/Grid.cc:4:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/./Grid.h:12:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/./tree/Tree.h:13:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/tools/Count.h:15:
In file included from /Users/stu/curv/extern/openvdb/openvdb/openvdb/tree/NodeManager.h:18:
In file included from /opt/homebrew/include/tbb/parallel_reduce.h:17:
/opt/homebrew/include/tbb/../oneapi/tbb/parallel_reduce.h:353:63: error: variable has incomplete type 'tbb::split'
    lambda_reduce_body( lambda_reduce_body& other, tbb::split )
                                                              ^
/Users/stu/curv/extern/openvdb/openvdb/openvdb/math/Coord.h:16:23: note: forward declaration of 'tbb::split'
namespace tbb { class split; } // forward declaration
...

I'm not sure what those interactions with tbb mean though.

doug-moen commented 3 years ago

The problem is that openvdb is incompatible with the 2021 version of tbb. This has not yet been fixed upstream. So it is necessary to downgrade to the 2020 version of tbb. Plus I had to change the build script. Try:

brew uninstall tbb
brew install tbb@2020
make upgrade
make
ornamentist commented 3 years ago

Okay, that's now building. On starting the curv executable I get:

$ release/curv --version
Curv: 0.4-1057-g9a509192
Compiler: clang 12.0.5 (clang-1205.0.22.9)
Kernel: Darwin 20.5.0 arm64
GPU: Cocoa: Failed to find service port for display
GPU: Apple, Apple M1
OpenGL: 2.1 Metal - 71.6.4
ornamentist commented 3 years ago

This is also a good opportunity to say curv is an impressive project. Thanks for creating and supporting it!

doug-moen commented 3 years ago

Thanks, hope you enjoy playing with it. I committed a macOS 11 fix. Try:

make upgrade
make
doug-moen commented 3 years ago

No further comments, so I assume this is fixed.