在 snapcraft 部分中公开头文件

在 snapcraft 部分中公开头文件

我正在尝试为名为 Cockatrice 的 Qt 应用程序制作一个 snap。要进行编译,它需要 protobuf 库。我的 snapcraft 文件如下:

name: cockatrice
version: '2016-10-30'
summary: 'A cross-platform virtual tabletop for multiplayer card games'
description: |
    Cockatrice is an open-source multiplatform supported program for playing tabletop card games over a network.
    The program's server design prevents any kind of client modifications to gain an unfair advantage in a game.
    The client also has a built in single-player mode where you can brew without being connected to a server.
    This project is written in C++ and is using the Qt5 libraries.

grade: stable
confinement: strict

parts:
  protobuf:
      source: https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
      plugin: autotools
      snap:
        - -bin
        - -lib
        - -include
        - -share
  cockatrice:
      source: .
      plugin: cmake
      stage-packages:
        - qt5-default
        - qttools5-dev
        - qttools5-dev-tools
        - qtmultimedia5-dev
        - libqt5multimedia5-plugins
        - libqt5svg5-dev
        - libqt5sql5-mysql
      after:
       - protobuf
         # - qt5conf
       - desktop/qt5
apps:
  cockatrice:
    command: bin/cockatrice
    plugs:
      - network
      - unity7

发生的情况是,protobuf 正确编译,然后 cockatrice 的 cmake 开始运行,并.so正确找到 protobuf 文件:

-- Found Protobuf: /home/michael/Programming/Cockatrice/stage/lib/libprotobuf.so  
-- Found ZLIB: /home/michael/Programming/Cockatrice/parts/cockatrice/install/usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")  

然而,当它链接应用程序时,似乎找不到任何 protobuf 标头(所有不同类型的 protobuf 都有数千个此类错误):

../common/pb/libcockatrice_protocol.a(admin_commands.pb.cc.o): In function `Command_ShutdownServer::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)':
admin_commands.pb.cc:(.text+0xe02): undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int*)'
admin_commands.pb.cc:(.text+0xe84): undefined reference to `google::protobuf::io::CodedInputStream::ReadTagFallback()'
admin_commands.pb.cc:(.text+0xec0): undefined reference to `google::protobuf::internal::kEmptyString[abi:cxx11]'
admin_commands.pb.cc:(.text+0xece): undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
admin_commands.pb.cc:(.text+0xee4): undefined reference to `google::protobuf::internal::WireFormat::VerifyUTF8StringFallback(char const*, int, google::protobuf::internal::WireFormat::Operation)'
../common/pb/libcockatrice_protocol.a(admin_commands.pb.cc.o): In function `AdminCommand::AdminCommand()':
admin_commands.pb.cc:(.text+0x139f): undefined reference to `google::protobuf::UnknownFieldSet::UnknownFieldSet()'
admin_commands.pb.cc:(.text+0x13bd): undefined reference to `google::protobuf::Message::~Message()'
admin_commands.pb.cc:(.text+0x13d3): undefined reference to `google::protobuf::UnknownFieldSet::~UnknownFieldSet()'

这是否与 protobuf 字段有关snap,无法正确公开其.h文件?如果我查看包含目录,似乎头文件确实存在,但是:

ls /home/michael/Programming/Cockatrice/stage/include/google/protobuf/
compiler/              descriptor.pb.h    extension_set.h                 generated_message_util.h  message_lite.h    service.h      unknown_field_set.h  wire_format_lite_inl.h
descriptor_database.h  descriptor.proto   generated_enum_reflection.h     io/                       reflection_ops.h  stubs/         wire_format.h
descriptor.h           dynamic_message.h  generated_message_reflection.h  message.h                 repeated_field.h  text_format.h  wire_format_lite.h

我怎样才能让 cockatrice 正确链接?

相关内容