Redhat 시스템에 Protobuf 설치

6151 단어 Linux
이 문서에는 원격 서버 Tesla K80 Redhat 시스템에 Protobuf를 설치하는 과정이 기록되어 있습니다.
저는 여기서 프로토퍼-3.2.0을 내렸어요.tar.gz.
# tar zxvf protobuf-3.2.0.tar.tgz
# cd protobuf-3.2.0/
# ./configure
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-unknown-linux-gnu
......................
configure: creating ./config.status
config.status: creating Makefile
config.status: creating scripts/gtest-config
config.status: creating build-aux/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
# make
make all-recursive
......................
make[2]: ***[google/protobuf/any.pb.lo] Error 1
make[2]: Leaving directory '/root/K80/protobuf-3.2.0/src'
make[1]: ***[all-recursive] Error 1
make[1]: Leaving directory '/root/K80/protobuf-3.2.0'
make: *** [all] Error 2

인터넷에 접속해서 찾아봤는데 어떤 사람이 오토벤을 사용한다고 했어요.sh 먼저 뛰기:
# ./autogen.sh
./autogen.sh: line 48: autoreconf: command not found

autoreconf가 설치되어 있지 않은 것을 발견했습니다. autoreconf, automake,libtool 세 개의 패키지를 설치합니다.
Step 1 autoreconf 설치
# tar zxvf autoconf-2.69.tar.gz
# cd autoconf-2.69/
# ./configure
# make
# make install

autoconf가 성공적으로 설치되었는지 확인하려면:
# autoconf --version
autoconf (GNU Autoconf) 2.69
...
...
...

Step 2 automake 설치, 여기서 다운로드
# tar zxvf automake-1.14.tar.gz
# cd automake-1.14/
# ./configure
# make
# make install

automake 경로와 버전을 보려면 다음과 같이 하십시오.
# which auautomake
/usr/local/bin/automake
# automake --version
automake (GNU automake) 1.14

Step 3 libtool 설치, 여기서 다운로드
# tar -xzf libtool-2.4.2.tar.gz
# cd libtool-2.4.2
# ./configure
# make
# make install
# make check

autogen을 다시 실행합니다.sh:
# ./autogen.sh
# ./configure --prefix=/usr/local/protobuf
# make
'google::protobuf::internal::InternalMetadataWithArena::InternalMetadataWithArena(google::protobuf::Arena*)':
./google/protobuf/metadata.h:175: error: class 'google::protobuf::internal::InternalMetadataWithArena' does not have any field named 'InternalMetadataWithArenaBase'
./google/protobuf/metadata.h: In constructor 'google::protobuf::internal::InternalMetadataWithArenaLite::InternalMetadataWithArenaLite(google::protobuf::Arena*)':
./google/protobuf/metadata.h:204: error: class 'google::protobuf::internal::InternalMetadataWithArenaLite' does not have any field named 'InternalMetadataWithArenaBase'
make[2]: *** [google/protobuf/any.pb.lo] Error 1
make[2]: Leaving directory /home/protobuf/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/home/protobuf'
make: *** [all] Error 2

위의 오류는 구글의 버그입니다. #2559에서 수정되었지만,release에서 변경되지 않았을 수도 있습니다. 수동으로 변경하십시오.
# cd /src/google/protobuf/
# vim metadata.h

메타데이터에.h에서 다음과 같이 변경합니다.
 public:
    InternalMetadataWithArena() {}
    explicit InternalMetadataWithArena(Arena* arena)
 -      : InternalMetadataWithArenaBase(arena) {}
 +      : InternalMetadataWithArenaBase(arena) {}

    void DoSwap(UnknownFieldSet* other) {
      mutable_unknown_fields()->Swap(other);
 @@ -201,7 +202,8 @@ class InternalMetadataWithArenaLite
    InternalMetadataWithArenaLite() {}

    explicit InternalMetadataWithArenaLite(Arena* arena)
 -      : InternalMetadataWithArenaBase(arena) {}
 +      : InternalMetadataWithArenaBase(arena) {}

    void DoSwap(string* other) {
      mutable_unknown_fields()->swap(*other);

다시 make:
# make
# make install

좋은 웹페이지 즐겨찾기