我正在尝试在 Solaris 10 SPARC 64 上编译一些生成的 proto.cc 文件。
我收到这些错误:
"/apps/pkgs/studio-11.0.13/prod/include/CC/stlport4/stl/_alloc.h", line 134: Error: The function "__stl_new" must have a prototype.
"/apps/pkgs/studio-11.0.13/prod/include/CC/stlport4/stl/_alloc.h", line 135: Error: The function "__stl_delete" must have a prototype.
"/apps/pkgs/studio-11.0.13/prod/include/CC/stlport4/./stdexcept", line 52: Error: _STLP_EXCEPTION_BASE is not defined.
编译器标志是:
/apps/pkgs/studio-11.0.13/prod/bin/CC -xarch=v9 -library=stlport4 -library=Crun -features=no%conststrings -library=no%rwtools7 -erroff=nonewline
protobuf 编译器标志:
CXXFLAGS = -xmemalign=8s -g0 -xO3 -xlibmil -xdepend -xbuiltin -mt -compat=5 -library=stlport4 -library=Crun -template=no%extdef -DNDEBUG -m64 -xarch=v9
protobuf 编译成功(所有测试均通过)
好吧,看来我们的代码是使用原生 stl 构建的,这意味着我们无法将其与使用 stlport4 构建的 protobuf 链接起来。所以我必须用原生 stl 构建 protobuf。
步骤如下:
您必须应用这些补丁:https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/protobuf/trunk/files/
使用这些参数运行./configure:
./configure LDFLAGS=-L$PWD/src/solaris --disable-64bit-solaris --prefix=/bogdan/protobuf-2.4.1
如果您想在 SPARC 64 上构建它,请删除
--disable-64bit-solaris and edit protobuf-2.4.1/src/solaris/libstdc++.la
文件以将正确的依赖项添加到链接器。
运行:make、make check 和 make install