cpichard / usdtweak

Universal Scene Description standalone editor
Apache License 2.0
232 stars 23 forks source link

Failed compilation on MacOS #14

Closed 3d4m-volodymyr closed 6 months ago

3d4m-volodymyr commented 7 months ago

Macbook Apple M1 Pro macOS Sonoma 14.3 (23D56) Xcode 15.2

USD v23.11 - (0b18ad3f840c24eb25e16b795a5b0821cf05126e) usdtweak - develop barnch (e01216de08fdc64721c7fa14c56fced9276186d6)

[ 25%] Linking C static library libglfw3.a
[ 25%] Built target glfw
[ 26%] Building CXX object CMakeFiles/usdtweak.dir/src/Blueprints.cpp.o
In file included from /Users/b/Developer/usdtweak/src/Blueprints.cpp:5:
In file included from /Users/b/Developer/USD_build/include/pxr/usd/sdf/fileFormat.h:32:
In file included from /Users/b/Developer/USD_build/include/pxr/usd/sdf/declareHandles.h:33:
In file included from /Users/b/Developer/USD_build/include/pxr/base/tf/diagnostic.h:46:
In file included from /Users/b/Developer/USD_build/include/pxr/base/tf/diagnosticHelper.h:35:
In file included from /Users/b/Developer/USD_build/include/boost/any.hpp:20:
In file included from /Users/b/Developer/USD_build/include/boost/type_index.hpp:29:
In file included from /Users/b/Developer/USD_build/include/boost/type_index/stl_type_index.hpp:47:
/Users/b/Developer/USD_build/include/boost/container_hash/hash.hpp:132:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
        struct hash_base : std::unary_function<T, std::size_t> {};
                           ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^
1 error generated.
make[2]: *** [CMakeFiles/usdtweak.dir/src/Blueprints.cpp.o] Error 1
make[1]: *** [CMakeFiles/usdtweak.dir/all] Error 2
make: *** [all] Error 2
3d4m-volodymyr commented 7 months ago

I fixed it by executing this line before cmake command. export CXXFLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1"

3d4m-volodymyr commented 7 months ago

Another option that is also worked is cmake -G Xcode -Dpxr_DIR=/Users/b/Developer/USD_build -DMaterialX_DIR=/Users/b/Developer/USD_build/lib/cmake/MaterialX ..

cpichard commented 6 months ago

Thanks for reporting this issue @3d4m-volodymyr, I have updated the cmake file to prevent this compilation error. C