google/cld3

Unable to install gcld3 on Apple MacOS M2

Opened this issue · 1 comments

OS version: 13.2.1 (22D68)
Python version: 3.9.6
Protobuf version: 24.4

pip install:
CPLUS_INCLUDE_PATH=/opt/homebrew/opt/protobuf/include LIBRARY_PATH=/opt/homebrew/Cellar/protobuf/24.4/lib pip in stall --use-pep517 gcld3

The problem is that -std=c++11 is hardcoded at the moment, so CC='clang -std=c++14' is useless,
and the error message suggests using c++14 or higher:

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/private/var/folders/p0/g9fv9z053_n_yf_ztr2yqglh0000gn/T/pip-build-env-43hoedwf/normal/lib/python3.9/site-packages/pybind11/include -I/Users/barnabas/Programming/PyCharmProjects/_venvs/rhymedict-crawlers/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c gcld3/pybind_ext.cc -o build/temp.macosx-10.9-universal2-cpython-39/gcld3/pybind_ext.o -std=c++11 -stdlib=libc++
      In file included from gcld3/pybind_ext.cc:5:
      In file included from gcld3/../src/nnet_language_identifier.h:22:
      In file included from gcld3/../src/embedding_feature_extractor.h:23:
      In file included from gcld3/../src/feature_extractor.h:45:
      In file included from gcld3/../src/cld_3/protos/feature_extractor.pb.h:11:
      /opt/homebrew/opt/protobuf/include/google/protobuf/port_def.inc:210:1: error: static_assert failed due to requirement '201103L >= 201402L' "Protobuf only supports C++14 and newer."
      static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");

If you know how I can override -std=c++11, can you please let me know?

Thanks a lot!
Barney

Hey @BarnabasSzabolcs, did you try running with protobuf@21?

$ brew install protobuf@21
$ brew link protobuf@21