提问人:pnklein 提问时间:11/14/2023 更新时间:11/14/2023 访问量:22
在 Mac OS 14 (Sonoma) 下编译库 osmpbf
Compiling library osmpbf under Mac OS 14 (Sonoma)
问:
我正在尝试从 https://github.com/openstreetmap/OSM-binary 构建库osmpbf自述文件中给出的说明曾经工作正常。可能与我将 Mac OS 更新到 Sonoma 有关,我现在收到的错误似乎表明 c++ 版本低于 c++14,尽管我正在尽最大努力告诉 CMAKE 使用 c++20 或 c++17。这是我尝试犯错误时遇到的错误流的开始:
% make
[ 8%] Running cpp protocol buffer compiler on osmformat.proto
[ 16%] Running cpp protocol buffer compiler on fileformat.proto
[ 25%] Building CXX object osmpbf/CMakeFiles/osmpbf.dir/fileformat.pb.cc.o
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.cc:4:
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.h:13:
In file included from /opt/homebrew/include/google/protobuf/port_def.inc:33:
In file included from /opt/homebrew/include/absl/base/attributes.h:37:
In file included from /opt/homebrew/include/absl/base/config.h:86:
/opt/homebrew/include/absl/base/policy_checks.h:79:2: error: "C++ versions less than C++14 are not supported."
#error "C++ versions less than C++14 are not supported."
^
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.cc:4:
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.h:13:
/opt/homebrew/include/google/protobuf/port_def.inc:159:1: error: static assertion 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.");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.cc:4:
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.h:26:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:107:
In file included from /opt/homebrew/include/google/protobuf/stubs/common.h:22:
In file included from /opt/homebrew/include/google/protobuf/stubs/port.h:22:
/opt/homebrew/include/google/protobuf/port_def.inc:159:1: error: static assertion 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.");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.cc:4:
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.h:26:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:107:
In file included from /opt/homebrew/include/google/protobuf/stubs/common.h:34:
/opt/homebrew/include/google/protobuf/port_def.inc:159:1: error: static assertion 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.");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.cc:4:
In file included from /Users/pklein/programming/OSM-binary/build/osmpbf/fileformat.pb.h:26:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:109:
In file included from /opt/homebrew/include/absl/log/absl_check.h:38:
In file included from /opt/homebrew/include/absl/log/internal/check_impl.h:19:
In file included from /opt/homebrew/include/absl/log/internal/check_op.h:37:
In file included from /opt/homebrew/include/absl/log/internal/strip.h:24:
In file included from /opt/homebrew/include/absl/log/internal/log_message.h:41:
In file included from /opt/homebrew/include/absl/log/log_entry.h:35:
/opt/homebrew/include/absl/time/time.h:284:11: error: cannot assign to non-static data member within const member function 'operator='
hi_ = static_cast<uint32_t>(unsigned_value >> 32);
~~~ ^
/opt/homebrew/include/absl/time/time.h:278:22: note: member function 'absl::Duration::HiRep::operator=' is declared const here
constexpr HiRep& operator=(const int64_t value) {
我编辑了CMakeLists.txt以包含以下行:
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
我也尝试使用命令
cmake -DCMAKE_CXX_STANDARD=20 ..
但我仍然收到上面给出的错误消息。关于如何成功构建的任何建议?
答: 暂无答案
评论
osmpbf
CXX_STANDARD
CMAKE_CXX_STANDARD