I'm trying to make a snap for a Qt application called Cockatrice. To compile, it requires the protobuf library. My snapcraft file is as follows:
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
What happens is, protobuf compiles correctly, and then cockatrice's cmake starts running, and finds the protobuf .so
file correctly:
-- 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")
However when it goes to link the application, it seems that it can't find any headers for protobuf (there are thousands of these errors with all different protobuf types):
../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()'
Is this something to do with the snap
field of protobuf, not exposing its .h
files correctly? If I look in the include directory, it seems that the header files do exist, however:
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
How can I get cockatrice to link correctly?