2015-12-02 128 views
1

當試圖編譯的Protobuf-2.6.1在Solaris 10 SPARC 64,我得到:的Protobuf-2.6.1編譯在Solaris 10上的錯誤SPARC 64

./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做強制指針轉換?

回答

1

我根據GitHub的問題#789

的主要原因是在這個問題上的第4點methioned解決了這個問題。預定義的SOLARIS_64BIT_ENABLED宏完全不起作用。

該問題可以簡單地通過將-m64 -DSOLARIS_64BIT_ENABLED添加到CXXFLAGS和CFLAGS來解決。但是最好能夠根據問題提出整個修改。

相關問題