google / binexport

Export disassemblies into Protocol Buffers
Apache License 2.0
1.05k stars 206 forks source link

build fails for latest xcode on macos #117

Open psifertex opened 1 year ago

psifertex commented 1 year ago
/Users/jwiens/Downloads/binexport/third_party/boost_parts/boost/container_hash/hash.hpp:130: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> {};
                           ~~~~~^~~~~~~~~~~~~~
                                __unary_function
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.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.

I assume there's a newer boost that fixes it or just running the update boost script would, but in the meantime, simply following the suggestion works.

diff --git a/third_party/boost_parts/boost/container_hash/hash.hpp b/third_party/boost_parts/boost/container_hash/hash.hpp
index 76de793..32f0559 100644
--- a/third_party/boost_parts/boost/container_hash/hash.hpp
+++ b/third_party/boost_parts/boost/container_hash/hash.hpp
@@ -127,7 +127,7 @@ namespace boost
         };
 #else
         template <typename T>
-        struct hash_base : std::unary_function<T, std::size_t> {};
+        struct hash_base : std::__unary_function<T, std::size_t> {};
 #endif

         struct enable_hash_value { typedef std::size_t type; };
psifertex commented 1 year ago

@withzombies points out you can also just build with:

-DCMAKE_CXX_FLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"
cblichmann commented 10 months ago

Is this still a problem? I upgraded Boost to 1.83 in 840ddeec017a4ca85985a9b7919079d2f79f5d38