iguana
iguana copied to clipboard
tool(proto_to_struct),在mac编译失败
- Mac 环境
-
gcc --version
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: arm64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
- macOS版本
15.1.1 (24B91)
- 第一步
cmake ..,输出
CMake Warning (dev) at CMakeLists.txt:1 (project):
cmake_minimum_required() should be called prior to this top-level project()
call. Please see the cmake-commands(7) manual for usage documentation of
both commands.
This warning is for project developers. Use -Wno-dev to suppress it.
-- The C compiler identification is AppleClang 16.0.0.16000026
-- The CXX compiler identification is AppleClang 16.0.0.16000026
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at /opt/homebrew/Cellar/cmake/3.30.2/share/cmake/Modules/FindProtobuf.cmake:626 (message):
Protobuf compiler version 25.3 doesn't match library version 5.28.2
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
-- Found Protobuf: /opt/homebrew/lib/libprotobuf.dylib (found version "5.28.2")
-- Configuring done (0.6s)
-- Generating done (0.0s)
- 第二步
make,输出
[ 50%] Building CXX object CMakeFiles/proto_to_struct.dir/proto_to_struct.cpp.o
[100%] Linking CXX executable proto_to_struct
Undefined symbols for architecture arm64:
"absl::lts_20240722::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, std::__1::basic_string_view<char, std::__1::char_traits<char>>)", referenced from:
google::protobuf::FileDescriptor::message_type(int) const in proto_to_struct.cpp.o
google::protobuf::FileDescriptor::message_type(int) const in proto_to_struct.cpp.o
google::protobuf::Descriptor::enum_type(int) const in proto_to_struct.cpp.o
google::protobuf::Descriptor::enum_type(int) const in proto_to_struct.cpp.o
google::protobuf::EnumDescriptor::value(int) const in proto_to_struct.cpp.o
google::protobuf::EnumDescriptor::value(int) const in proto_to_struct.cpp.o
google::protobuf::Descriptor::field(int) const in proto_to_struct.cpp.o
google::protobuf::Descriptor::field(int) const in proto_to_struct.cpp.o
...
"absl::lts_20240722::log_internal::LogMessageFatal::~LogMessageFatal()", referenced from:
google::protobuf::FileDescriptor::message_type(int) const in proto_to_struct.cpp.o
google::protobuf::FileDescriptor::message_type(int) const in proto_to_struct.cpp.o
google::protobuf::FileDescriptor::message_type(int) const in proto_to_struct.cpp.o
google::protobuf::FileDescriptor::message_type(int) const in proto_to_struct.cpp.o
google::protobuf::Descriptor::enum_type(int) const in proto_to_struct.cpp.o
google::protobuf::Descriptor::enum_type(int) const in proto_to_struct.cpp.o
google::protobuf::EnumDescriptor::value(int) const in proto_to_struct.cpp.o
google::protobuf::EnumDescriptor::value(int) const in proto_to_struct.cpp.o
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>* absl::lts_20240722::log_internal::MakeCheckOpString<long long, long long>(long long, long long, char const*)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>* absl::lts_20240722::log_internal::Check_LEImpl<int, int>(int const&, int const&, char const*) in proto_to_struct.cpp.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>* absl::lts_20240722::log_internal::Check_LTImpl<int, int>(int const&, int const&, char const*) in proto_to_struct.cpp.o
ld: symbol(s) not found for architecture arm64
c++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [proto_to_struct] Error 1
make[1]: *** [CMakeFiles/proto_to_struct.dir/all] Error 2
make: *** [all] Error 2
下个月才有mac的主机,晚点弄。