gpt4 book ai didi

c++ - Solaris 10 SPARC 64 上的 Protobuf-2.6.1 编译错误

转载 作者:行者123 更新时间:2023-11-30 05:34:56 25 4
gpt4 key购买 nike

尝试在 Solaris 10 SPARC 64 上编译 Protobuf-2.6.1 时,我得到:

./google/protobuf/stubs/once.h: In function `void google::protobuf::GoogleOnceInit(google::protobuf::ProtobufOnceType*, void (*)())':
./google/protobuf/stubs/once.h:125: error: cannot convert `google::protobuf::ProtobufOnceType*' to `const volatile google::protobuf::internal::Atomic32*' for argument `1' to `google::protobuf::internal::Atomic32 google::protobuf::internal::Acquire_Load(const volatile google::protobuf::internal::Atomic32*)'
./google/protobuf/stubs/once.h: In function `void google::protobuf::GoogleOnceInit(google::protobuf::ProtobufOnceType*, void (*)(Arg*), Arg*)':
./google/protobuf/stubs/once.h:134: error: cannot convert `google::protobuf::ProtobufOnceType*' to `const volatile google::protobuf::internal::Atomic32*' for argument `1' to `google::protobuf::internal::Atomic32 google::protobuf::internal::Acquire_Load(const volatile google::protobuf::internal::Atomic32*)'

我遵循了官方 README,./configuremake

编译器版本(GCC):

$ gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with: /sfw10/builds/build/sfw10-patch/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/ccs/bin/as --without-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

我还阅读了问题 protobuf generated files does not compile on Solaris SPARC 64并尝试过,但没有用。该文章适用于 Protobuf-2.4.1,但 Protobuf-2.6.1 发生了变化:

2014-10-20 version 2.6.1:

C++
* Added atomicops support for Solaris.

有什么办法可以让GCC做强制指针转换吗?

最佳答案

我根据github issue #789解决了问题

主要原因在本期第4点methioned。预定义的 SOLARIS_64BIT_ENABLED 宏根本不起作用。

只需在 CXXFLAGS 和 CFLAGS 中添加 -m64 -DSOLARIS_64BIT_ENABLED 即可解决该问题。但最好按照问题建议进行整体修改。

关于c++ - Solaris 10 SPARC 64 上的 Protobuf-2.6.1 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34037295/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com