簡體   English   中英

Solaris 10 SPARC 64上的Protobuf-2.6.1編譯錯誤

[英]Protobuf-2.6.1 compile error on Solaris 10 SPARC 64

嘗試在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*)'

我遵循官方自述文件./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生成的文件不能在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問題#789解決了問題

主要原因是在本期第四點中提到的。 預定義的SOLARIS_64BIT_ENABLED宏根本不起作用。

只需在CXXFLAGS和CFLAGS中添加-m64 -DSOLARIS_64BIT_ENABLED即可解決該問題。 但是最好按照問題建議進行整體修改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM