Qt 5.6 Cross Compile for Raspberry Pi with EGLFS - c++

I'm following the tutorial here https://wiki.qt.io/RaspberryPi2EGLFS
I'm on Ubuntu 15.04. On the make step I am hit with a bunch of undefined reference errors, referring mostly to QT methods.
.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function operator<<(QDebug, QAccessibleInterface const*): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qaccessible.o:qaccessible.cpp:function operator<<(QDebug, QAccessibleInterface const*): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qgenericpluginfactory.o:qgenericpluginfactory.cpp:function QGenericPluginFactory::create(QString const&, QString const&): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qwindowsysteminterface.o:qwindowsysteminterface.cpp:function qt_handleShortcutEvent(QObject*, unsigned long, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qplatforminputcontextfactory.o:qplatforminputcontextfactory.cpp:function QPlatformInputContextFactory::create(QString const&): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QPlatformTheme::defaultThemeHint(QPlatformTheme::ThemeHint): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QPlatformTheme::defaultThemeHint(QPlatformTheme::ThemeHint): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QPlatformTheme::defaultThemeHint(QPlatformTheme::ThemeHint): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>::qt_metatype_id(): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QMetaTypeId<QList<int> >::qt_metatype_id(): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformthemefactory.o:qplatformthemefactory.cpp:function QPlatformThemeFactory::create(QString const&, QString const&): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qplatformwindow.o:qplatformwindow.cpp:function QPlatformWindow::requestUpdate(): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qsurfaceformat.o:qsurfaceformat.cpp:function operator<<(QDebug, QSurfaceFormat const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent*): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::createPlatformIntegration(): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qguiapplication.o:qguiapplication.cpp:function updateBlockedStatusRecursion(QWindow*, bool): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::showModalWindow(QWindow*): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'qt_QMetaEnum_flagDebugOperator(QDebug&, unsigned long long, QMetaObject const*, char const*)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qwindow.o:qwindow.cpp:function QWindowPrivate::create(bool): error: undefined reference to 'qt_QMetaEnum_flagDebugOperator(QDebug&, unsigned long long, QMetaObject const*, char const*)'
.obj/qclipboard.o:qclipboard.cpp:function QClipboard::text(QString&, QClipboard::Mode) const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qcursor.o:qcursor.cpp:function operator<<(QDebug, QCursor const&): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qdnd.o:qdnd.cpp:function imageReadMimeFormats(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qdnd.o:qdnd.cpp:function imageWriteMimeFormats(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qdnd.o:qdnd.cpp:function QInternalMimeData::renderDataHelper(QString const&, QMimeData const*): error: undefined reference to 'QByteArray::toUpper_helper(QByteArray&)'
.obj/qevent.o:qevent.cpp:function operator<<(QDebug, QEvent const*): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qevent.o:qevent.cpp:function operator<<(QDebug, QEvent const*): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qevent.o:qevent.cpp:function operator<<(QDebug, QEvent const*): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qkeysequence.o:qkeysequence.cpp:function QKeySequencePrivate::decodeString(QString const&, QKeySequence::SequenceFormat): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qkeysequence.o:qkeysequence.cpp:function QKeySequencePrivate::decodeString(QString const&, QKeySequence::SequenceFormat): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qscreen.o:qscreen.cpp:function operator<<(QDebug, QScreen const*): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qhighdpiscaling.o:qhighdpiscaling.cpp:function QHighDpiScaling::initHighDpiScaling(): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qhighdpiscaling.o:qhighdpiscaling.cpp:function QHighDpiScaling::initHighDpiScaling(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qimage.o:qimage.cpp:function operator<<(QDebug, QImage const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qimage.o:qimage.cpp:function QImage::text(QString const&) const: error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qimagereader.o:qimagereader.cpp:function createReadHandlerHelper(QIODevice*, QByteArray const&, bool, bool): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qimagereader.o:qimagereader.cpp:function QImageReaderPrivate::getText() [clone .part.30]: error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qimagereader.o:qimagereader.cpp:function QImageReaderPrivate::getText() [clone .part.30]: error: undefined reference to 'QString::simplified_helper(QString&)'
.obj/qimagereader.o:qimagereader.cpp:function QImageReaderPrivate::initHandler(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qimagewriter.o:qimagewriter.cpp:function QImageWriter::setText(QString const&, QString const&): error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qimagewriter.o:qimagewriter.cpp:function QImageWriter::setText(QString const&, QString const&): error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qpixmap.o:qpixmap.cpp:function operator<<(QDebug, QPixmap const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qicon.o:qicon.cpp:function operator<<(QDebug, QIcon const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qiconloader.o:qiconloader.cpp:function QIconLoader::findIconHelper(QString const&, QString const&, QStringList&) const: error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qppmhandler.o:qppmhandler.cpp:function QPpmHandler::setOption(QImageIOHandler::ImageOption, QVariant const&): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qxbmhandler.o:qxbmhandler.cpp:function read_xbm_header(QIODevice*, int&, int&): error: undefined reference to 'QByteArray::trimmed_helper(QByteArray&)'
.obj/qxbmhandler.o:qxbmhandler.cpp:function read_xbm_header(QIODevice*, int&, int&): error: undefined reference to 'QByteArray::trimmed_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function read_xpm_body(QIODevice*, char const* const*, int&, QByteArray&, int, int, int, int, QImage&): error: undefined reference to 'QByteArray::simplified_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function read_xpm_body(QIODevice*, char const* const*, int&, QByteArray&, int, int, int, int, QImage&): error: undefined reference to 'QByteArray::trimmed_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function read_xpm_body(QIODevice*, char const* const*, int&, QByteArray&, int, int, int, int, QImage&): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function QXpmHandler::write(QImage const&): error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function QXpmHandler::write(QImage const&): error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qpnghandler.o:qpnghandler.cpp:function QPNGImageWriter::writeImage(QImage const&, int, QString const&, int, int): error: undefined reference to 'QString::simplified_helper(QString&)'
.obj/qfont.o:qfont.cpp:function QFont::substitute(QString const&): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qfontsubset.o:qfontsubset.cpp:function QFontSubset::toTruetype() const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qfontsubset.o:qfontsubset.cpp:function QFontSubset::toTruetype() const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qfontsubset.o:qfontsubset.cpp:function QFontSubset::toTruetype() const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qfontdatabase.o:qfontdatabase.cpp:function QFontDatabase::load(QFontPrivate const*, int): error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qtextdocument.o:qtextdocument.cpp:function findInBlock(QTextBlock const&, QRegularExpression const&, int, QFlags<QTextDocument::FindFlag>, QTextCursor*): error: undefined reference to 'QString::lastIndexOf(QRegularExpression const&, int, QRegularExpressionMatch*) const'
.obj/qtextdocument.o:qtextdocument.cpp:function findInBlock(QTextBlock const&, QRegularExpression const&, int, QFlags<QTextDocument::FindFlag>, QTextCursor*): error: undefined reference to 'QString::indexOf(QRegularExpression const&, int, QRegularExpressionMatch*) const'
.obj/qtexthtmlparser.o:qtexthtmlparser.cpp:function setWidthAttribute(QTextLength*, QString): error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qtexthtmlparser.o:qtexthtmlparser.cpp:function QTextHtmlParser::parseCloseTag(): error: undefined reference to 'QString::trimmed_helper(QString&)'
.obj/qcssparser.o:qcssparser.cpp:function parseColorValue(QCss::Value): error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qtextodfwriter.o:qtextodfwriter.cpp:function QTextOdfWriter::writeBlockFormat(QXmlStreamWriter&, QTextBlockFormat, int) const: error: undefined reference to 'qt_QMetaEnum_flagDebugOperator(QDebug&, unsigned long long, QMetaObject const*, char const*)'
.obj/qcolor.o:qcolor.cpp:function QColor::name(QColor::NameFormat) const: error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qcolor.o:qcolor.cpp:function QColor::name(QColor::NameFormat) const: error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qvalidator.o:qvalidator.cpp:function QDoubleValidator::validate(QString&, int&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qvalidator.o:qvalidator.cpp:function QIntValidator::validate(QString&, int&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qvalidator.o:qvalidator.cpp:function QIntValidator::fixup(QString&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qvalidator.o:qvalidator.cpp:function QDoubleValidatorPrivate::validateWithLocale(QString&, QLocaleData::NumberMode, QLocale const&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::fromJson(QJsonValue const&): error: undefined reference to 'QVersionNumber::fromString(QString const&, int*)'
.obj/qopengl.o:qopengl.cpp:function operator<<(QDebug, QOpenGLConfig::Gpu const&): error: undefined reference to 'operator<<(QDebug, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QJsonDocument const&): error: undefined reference to 'QSysInfo::kernelVersion()'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QJsonDocument const&): error: undefined reference to 'QVersionNumber::fromString(QString const&, int*)'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QString const&): error: undefined reference to 'QSysInfo::kernelVersion()'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QString const&): error: undefined reference to 'QVersionNumber::fromString(QString const&, int*)'
collect2: error: ld returned 1 exit status
Makefile:1205: recipe for target '../../lib/libQt5Gui.so.5.6.0' failed
make[2]: *** [../../lib/libQt5Gui.so.5.6.0] Error 1
make[2]: Leaving directory '/home/james/raspi/qtbase/src/gui'
Makefile:497: recipe for target 'sub-gui-make_first' failed
make[1]: *** [sub-gui-make_first] Error 2
make[1]: Leaving directory '/home/james/raspi/qtbase/src'
Makefile:45: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2
I've tried adding a -no-warnings-are-errors flag during ./configure, as well as cross compiling from the 5.5 (release) QT branch. The 5.5 branch breaks on the configure step.
Is there somewhere I can link/specify sources/add headers?

Seems like a qt5-default package on my raspbian image was causing the problem. Coming from a clean slate or doing sudo apt-get remove qt5-default solved the problem.

Seems like a qt5-default package on my raspbian image was causing the
problem.
Just in case it helps someone else, removing qt5-default on the PI and re-running the rsync commands isn't sufficient. I had to remove the sysroot directory and re-run the rsync commands to get Qt to compile.
I don't know if it was necessary but I also purged all of the qt5 packages from the Pi.

Just removing qt5-default was not enough.
I had to remove any references to pre-installed qt5 libraries to make the build succeed.
From a previous attempt to cross-compile, following someone else's recipe, I had a libqt5core5 installed which depended on a bunch of additional qt5 libs.
Once libqt5core5 was removed the linking process succeeded.
Of course, this also required to recreate the sysroot folder as the libraries on the Pi had changed.

Related

Linkage errors when using SWIG, protobuf

I'm trying to use SWIG so that I can call C++ code from Go.
I want to use SWIG so that it can generate me wrapper code. The C++ code in question is generated by the protobuf compiler.
I have two hello.i files hello.i and protobuf.i:
protbuf.i
#define GOOGLE_PROTOBUF_VERSION 3021008
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3021000
hello.i
%module example
%include "protobuf.i"
%{
#include "hello.pb.h"
#include "hello.gen.h"
%}
#include "hello.pb.h"
#include "hello.gen.h"
namespace example {
void handle_Person(example::Person& m, unsigned char* friends);
}
I am able to compile this with the SWIG command swig -go -cgo -c++ hello.i and it generates Go and _wrap.cc file.
Then I create a shared library with the following sequence of commands:
g++ -fPIC -c hello_wrap.cxx hello.pb.cc hello.gen.cc -ldl -lprotobuf -lprotoc -L${MY_PROJECT}/protobuf -L${MY_PROJECT}/protobuf/third_party/abseil-cpp/absl -L${MY_PROJECT}/protobuf/third_party/utf8_range
g++ -shared -o libhellowrap.so hello_wrap.o hello.gen.o hello.pb.o -ldl -lprotobuf -lprotoc -L${MY_PROJECT}/protobuf -L${MY_PROJECT}/protobuf/third_party/abseil-cpp/absl -L${MY_PROJECT}/protobuf/third_party/utf8_range
Now I want to use this in Go so I create a main.go file:
package main
/*
#cgo CFLAGS: -I/my_project/example
#cgo LDFLAGS: -L/my_project/example -lhellowrap -ldl -lstdc++
#include <stdlib.h>
*/
import (
"C"
"fmt"
"my_project/example"
)
func main() {
var p example.SwigcptrExample_Person
p = example.SwigcptrExample_Person(uintptr(int32(2000)))
friends := make([]byte, 5)
example.Handle_Person(p, &friends[0])
fmt.Println("New Friends: ", friends)
}
Then I run this main.go file and the following linkage errors occur:
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/usr/local/include/google/protobuf/metadata_lite.h:183: undefined reference to `void google::protobuf::internal::InternalMetadata::DoMergeFrom<google::protobuf::UnknownFieldSet>(google::protobuf::UnknownFieldSet const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/usr/local/include/google/protobuf/io/coded_stream.h:674: undefined reference to `google::protobuf::io::EpsCopyOutputStream::EnsureSpaceFallback(unsigned char*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/parse_context.h:567: undefined reference to `google::protobuf::internal::VarintParseSlow32(char const*, unsigned int)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/usr/local/include/google/protobuf/parse_context.h:239: undefined reference to `google::protobuf::internal::EpsCopyInputStream::DoneFallback(int, int)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/my_project/example/hello.pb.cc:198: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/parse_context.h:658: undefined reference to `google::protobuf::internal::ReadTagFallback(char const*, unsigned int)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/metadata_lite.h:159: undefined reference to `google::protobuf::UnknownFieldSet* google::protobuf::internal::InternalMetadata::mutable_unknown_fields_slow<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/usr/local/include/google/protobuf/message.h:245: undefined reference to `vtable for google::protobuf::Message'
/usr/local/include/google/protobuf/message.h:245: undefined reference to `google::protobuf::MessageLite::~MessageLite()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/usr/local/include/google/protobuf/metadata_lite.h:113: undefined reference to `google::protobuf::Arena* google::protobuf::internal::InternalMetadata::DeleteOutOfLineHelper<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool)':
/usr/local/include/google/protobuf/message_lite.h:432: undefined reference to `vtable for google::protobuf::MessageLite'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool)':
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(example::Person const&)':
/usr/local/include/google/protobuf/metadata_lite.h:183: undefined reference to `void google::protobuf::internal::InternalMetadata::DoMergeFrom<google::protobuf::UnknownFieldSet>(google::protobuf::UnknownFieldSet const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person* google::protobuf::Arena::CreateMaybeMessage<example::Person>(google::protobuf::Arena*)':
/usr/local/include/google/protobuf/arena.h:309: undefined reference to `google::protobuf::Arena::Allocate(unsigned long)'
/tmp/go-link-96276495/000017.o: In function `example::Person::Clear()':
/usr/local/include/google/protobuf/metadata_lite.h:190: undefined reference to `void google::protobuf::internal::InternalMetadata::DoClear<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/my_project/example/hello.pb.cc:228: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::ByteSizeLong() const':
/my_project/example/hello.pb.cc:250: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
/tmp/go-link-96276495/000017.o: In function `example::Person::GetMetadata() const':
/my_project/example/hello.pb.cc:297: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20220623::once_flag*, google::protobuf::Metadata const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*) [clone .cold.25]':
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person() [clone .cold.26]':
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool) [clone .cold.27]':
/my_project/example/hello.pb.cc:143: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(example::Person const&) [clone .cold.28]':
/usr/local/include/google/protobuf/message.h:245: undefined reference to `vtable for google::protobuf::Message'
/usr/local/include/google/protobuf/message.h:245: undefined reference to `google::protobuf::MessageLite::~MessageLite()'
/tmp/go-link-96276495/000017.o: In function `_GLOBAL__sub_I.00102_hello.pb.cc':
/my_project/example/hello.pb.cc:105: undefined reference to `google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTIN7example6PersonE[_ZTIN7example6PersonE]+0x10): undefined reference to `typeinfo for google::protobuf::Message'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x20): undefined reference to `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x40): undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x48): undefined reference to `google::protobuf::Message::CheckTypeAndMergeFrom(google::protobuf::MessageLite const&)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x78): undefined reference to `google::protobuf::Message::MergeFrom(google::protobuf::Message const&)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x80): undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro+0x0): undefined reference to `google::protobuf::Message::CopyWithSourceCheck(google::protobuf::Message&, google::protobuf::Message const&)'
/tmp/go-link-96276495/000018.o: In function `example::handle_Person(example::Person&, unsigned char*)':
/my_project/example/hello.gen.cc:14: undefined reference to `dlopen'
/my_project/example/hello.gen.cc:25: undefined reference to `dlsym'
/my_project/example/hello.gen.cc:26: undefined reference to `dlerror'
/my_project/example/hello.gen.cc:29: undefined reference to `dlclose'
/my_project/example/hello.gen.cc:16: undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
I have various things when trying to solve this problem but it feels like I'm missing a crucial step.

Xalan link failure using libraries built from source

I am upgrading one of our libraries to the latest version. The xalan from GitHub at https://github.com/apache/xalan-c. I was able to compile this library successfully using gcc 12. And when I ran make test command, it was all OK. But when used it in my code and it will fail when try to link, I got errors like this (I did check the library search path, both libxalan-c.so and libxalanMsg.so can be found by the ld):
g++ -g -O0 -Werror -Wunused -Wall -D__USE_XOPEN2K8 -D_REENTRANT -D__STL_PTHREADS -std=c++17 -pthread -Wno-parentheses -Wno-nonnull -pipe -lxerces-c -L/rapid/rapid_workspaces/chuhuan/GitHub/xalan-c/build/lib64/ -lxalan-c -lxalanMsg -Lxxxxxxxxx/TargetRTS/ -ldhf
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: linux/TargetRTS/ParamConfig.o: in function `dhf::DataHandlerFactory::initializeXMLLibs()':
xxxxxxxxx/DataHandlerFactory.hh:58: undefined reference to `xalanc_1_12::XalanTransformer::initialize(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DataHandlerFactory.hh:59: undefined reference to `xalanc_1_12::XPathEvaluator::initialize(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o): in function `dhf::DOMImpl::transform(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
xxxxxxxxx/DOMImpl.cc:173: undefined reference to `xalanc_1_12::XercesParserLiaison::XercesParserLiaison(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:183: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(char16_t const*, xercesc_4_0::MemoryManager&, unsigned long)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:184: undefined reference to `xalanc_1_12::XercesDOMWrapperParsedSource::XercesDOMWrapperParsedSource(xercesc_4_0::DOMDocument const*, xalanc_1_12::XercesParserLiaison&, xalanc_1_12::XercesDOMSupport&, xalanc_1_12::XalanDOMString const&, xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:190: undefined reference to `xalanc_1_12::FormatterToXercesDOM::FormatterToXercesDOM(xercesc_4_0::DOMDocument*, xercesc_4_0::DOMElement*, xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:191: undefined reference to `xalanc_1_12::XalanTransformer::XalanTransformer(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:192: undefined reference to `xalanc_1_12::XSLTResultTarget::XSLTResultTarget(xalanc_1_12::FormatterListener&, xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:192: undefined reference to `xalanc_1_12::XSLTInputSource::XSLTInputSource(char const*, xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o): in function `dhf::DOMImpl::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double*)':
xxxxxxxxx/DOMImpl.cc:237: undefined reference to `xalanc_1_12::XercesParserLiaison::XercesParserLiaison(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:244: undefined reference to `xalanc_1_12::XercesParserLiaison::createDocument(xercesc_4_0::DOMDocument const*, bool, bool, bool)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:246: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(char const*, xercesc_4_0::MemoryManager&, unsigned long)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:248: undefined reference to `xalanc_1_12::XPathEvaluator::XPathEvaluator(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:250: undefined reference to `xalanc_1_12::XPathEvaluator::evaluate(xalanc_1_12::DOMSupport&, xalanc_1_12::XalanNode*, char16_t const*, xalanc_1_12::XalanElement const*)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o): in function `dhf::DOMImpl::getSize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int*)':
xxxxxxxxx/DOMImpl.cc:298: undefined reference to `xalanc_1_12::XercesParserLiaison::XercesParserLiaison(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:305: undefined reference to `xalanc_1_12::XercesParserLiaison::createDocument(xercesc_4_0::DOMDocument const*, bool, bool, bool)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:307: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(char const*, xercesc_4_0::MemoryManager&, unsigned long)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:309: undefined reference to `xalanc_1_12::XPathEvaluator::XPathEvaluator(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:313: undefined reference to `xalanc_1_12::XPathEvaluator::selectSingleNode(xalanc_1_12::DOMSupport&, xalanc_1_12::XalanNode*, char16_t const*, xalanc_1_12::XalanElement const*)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o): in function `dhf::DOMImpl::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
xxxxxxxxx/DOMImpl.cc:364: undefined reference to `xalanc_1_12::XercesParserLiaison::XercesParserLiaison(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:371: undefined reference to `xalanc_1_12::XercesParserLiaison::createDocument(xercesc_4_0::DOMDocument const*, bool, bool, bool)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:373: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(char const*, xercesc_4_0::MemoryManager&, unsigned long)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:375: undefined reference to `xalanc_1_12::XPathEvaluator::XPathEvaluator(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:377: undefined reference to `xalanc_1_12::XPathEvaluator::evaluate(xalanc_1_12::DOMSupport&, xalanc_1_12::XalanNode*, char16_t const*, xalanc_1_12::XalanElement const*)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o): in function `dhf::DOMImpl::serialize(std::ostream&)':
xxxxxxxxx/DOMImpl.cc:486: undefined reference to `xalanc_1_12::XalanStdOutputStream::XalanStdOutputStream(std::ostream&, xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:490: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:490: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:490: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:490: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:490: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o):xxxxxxxxx/DOMImpl.cc:490: more undefined references to `xalanc_1_12::XalanDOMString::XalanDOMString(xercesc_4_0::MemoryManager&)' follow
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o): in function `dhf::DOMImpl::serialize(std::ostream&)':
xxxxxxxxx/DOMImpl.cc:490: undefined reference to `xalanc_1_12::FormatterToXML::FormatterToXML(xalanc_1_12::Writer&, xalanc_1_12::XalanDOMString const&, bool, int, xalanc_1_12::XalanDOMString const&, xalanc_1_12::XalanDOMString const&, xalanc_1_12::XalanDOMString const&, xalanc_1_12::XalanDOMString const&, bool, xalanc_1_12::XalanDOMString const&, xalanc_1_12::FormatterListener::eFormat, bool, xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:501: undefined reference to `xalanc_1_12::XercesDOMWalker::traverse(xercesc_4_0::DOMNode*)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/TargetRTS//libdhf.a(DOMImpl.o): in function `dhf::DOMImpl::selectNode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
xxxxxxxxx/DOMImpl.cc:510: undefined reference to `xalanc_1_12::XercesParserLiaison::XercesParserLiaison(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:517: undefined reference to `xalanc_1_12::XercesParserLiaison::createDocument(xercesc_4_0::DOMDocument const*, bool, bool, bool)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:522: undefined reference to `xalanc_1_12::XalanDOMString::XalanDOMString(char const*, xercesc_4_0::MemoryManager&, unsigned long)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:527: undefined reference to `xalanc_1_12::XPathEvaluator::XPathEvaluator(xercesc_4_0::MemoryManager&)'
xxxxxxxxxgcc-12.2.0/../binutils-2.36.1/bin/ld: xxxxxxxxx/DOMImpl.cc:528: undefined reference to `xalanc_1_12::XPathEvaluator::selectSingleNode(xalanc_1_12::DOMSupport&, xalanc_1_12::XalanNode*, char16_t const*, xalanc_1_12::XalanElement const*)'
collect2: error: ld returned 1 exit status
my cmake options:
CC=gcc-12.2.0/bin/gcc CXX=gcc-12.2.0/bin/g++ CFLAGS=-O3 CXXFLAGS=-O3 cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=xalan-c/build -DCMAKE_BUILD_TYPE=Release -Dmessage-loader=inmemory -Dtranscoder=default xalan-c
It seems something may be inconsistent with my build options, any idea to fix this?
Thanks very much!
Chunde
Eventually figured out the issue, this was because Xalan need to link to Xercesc, without specifying the path to the version 4.0.0 of Xercesc, it will link to the default version at system path. So I used
-DCMAKE_PREFIX_PATH
variable to set that, the new cmake command looks like this:
CC=gcc-12.2.0/bin/gcc CXX=gcc-12.2.0/bin/g++ CFLAGS=-O3 CXXFLAGS=-O3 cmake -DCMAKE_PREFIX_PATH=xxx/xerces-c_4.0.0/ -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=xalan-c/build -DCMAKE_BUILD_TYPE=Release -Dmessage-loader=inmemory -Dtranscoder=default xalan-c

/usr/bin/ld: cannot find -lprotobuf

I am new to linux and c++. I am trying to run veins gym on Ubuntu-18.04. When I run snakemake -jall (see the link) I receive an error:
make: Entering directory '/home/rost/serpentine-env/src'
Creating executable: out/gcc-debug//experiment_dbg
/usr/bin/ld: cannot find -lprotobuf
collect2: error: ld returned 1 exit status
Makefile:96: recipe for target 'out/gcc-debug//experiment_dbg' failed
make: *** [out/gcc-debug//experiment_dbg] Error 1
make: Leaving directory '/home/rost/serpentine-env/src'
[Thu Dec 30 12:34:46 2021]
Error in rule build:
jobid: 1
output: src/experiment_dbg
shell:
make -j8 -C src MODE=debug
(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/rost/serpentine-env/.snakemake/log/2021-12-30T123446.742985.snakemake.log
To obtain a little more information, I run (source)
ld -lprotobuf --verbose
and I get
attempt to open //usr/local/lib/x86_64-linux-gnu/libprotobuf.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libprotobuf.a failed
attempt to open //lib/x86_64-linux-gnu/libprotobuf.so failed
attempt to open //lib/x86_64-linux-gnu/libprotobuf.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libprotobuf.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libprotobuf.a failed
attempt to open //usr/lib/x86_64-linux-gnu64/libprotobuf.so failed
attempt to open //usr/lib/x86_64-linux-gnu64/libprotobuf.a failed
attempt to open //usr/local/lib64/libprotobuf.so failed
attempt to open //usr/local/lib64/libprotobuf.a failed
attempt to open //lib64/libprotobuf.so failed
attempt to open //lib64/libprotobuf.a failed
attempt to open //usr/lib64/libprotobuf.so failed
attempt to open //usr/lib64/libprotobuf.a failed
attempt to open //usr/local/lib/libprotobuf.so failed
attempt to open //usr/local/lib/libprotobuf.a failed
attempt to open //lib/libprotobuf.so failed
attempt to open //lib/libprotobuf.a failed
attempt to open //usr/lib/libprotobuf.so failed
attempt to open //usr/lib/libprotobuf.a failed
attempt to open //usr/x86_64-linux-gnu/lib64/libprotobuf.so failed
attempt to open //usr/x86_64-linux-gnu/lib64/libprotobuf.a failed
attempt to open //usr/x86_64-linux-gnu/lib/libprotobuf.so failed
attempt to open //usr/x86_64-linux-gnu/lib/libprotobuf.a failed
ld: cannot find -lprotobuf
I guess, I would have to make symlink manually, but I do not find any .so files in the archives from protobuf. Or maybe my interpretation is wrong. If some information is missing - I will provide.
Thank you!
UPDATE:
after runningsudo apt install libprotobuf-dev, command snakemake -jall produces
make: Entering directory '/home/rost/serpentine-env/src'
Creating executable: out/gcc-debug//experiment_dbg
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Request::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:563: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:571: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:579: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:593: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Request::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:644: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Request::ByteSizeLong() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:690: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Request::GetMetadata() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:757: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), std::once_flag*, google::protobuf::Metadata const&)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Reply::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:946: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:954: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:962: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:976: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Reply::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1027: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Reply::ByteSizeLong() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1073: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Reply::GetMetadata() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1140: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), std::once_flag*, google::protobuf::Metadata const&)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Init::Init(veinsgym::proto::Init const&)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1166: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1174: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1182: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Init::Clear()':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1233: undefined reference to `google::protobuf::internal::ArenaStringPtr::ClearToEmpty()'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1234: undefined reference to `google::protobuf::internal::ArenaStringPtr::ClearToEmpty()'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1235: undefined reference to `google::protobuf::internal::ArenaStringPtr::ClearToEmpty()'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Init::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1249: undefined reference to `google::protobuf::internal::InlineGreedyStringParser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1259: undefined reference to `google::protobuf::internal::InlineGreedyStringParser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1269: undefined reference to `google::protobuf::internal::InlineGreedyStringParser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1284: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Init::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1335: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Init::ByteSizeLong() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1371: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Init::MergeFrom(veinsgym::proto::Init const&)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.h:2983: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.h:3034: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.h:3085: undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Arena*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Init::GetMetadata() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1441: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), std::once_flag*, google::protobuf::Metadata const&)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Shutdown::Shutdown(veinsgym::proto::Shutdown const&)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1456: undefined reference to `google::protobuf::internal::ZeroFieldsBase::~ZeroFieldsBase()'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Shutdown::GetMetadata() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1480: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), std::once_flag*, google::protobuf::Metadata const&)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Step::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1580: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1588: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1602: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Step::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1639: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Step::ByteSizeLong() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1668: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Step::GetMetadata() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1724: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), std::once_flag*, google::protobuf::Metadata const&)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Space::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:1992: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2000: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2008: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2016: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2024: undefined reference to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)'
out/gcc-debug//protobuf/veinsgym.pb.o:/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2032: more undefined references to `google::protobuf::internal::ParseContext::ParseMessage(google::protobuf::MessageLite*, char const*)' follow
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Space::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2046: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Space::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2115: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Space::ByteSizeLong() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2177: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Space::GetMetadata() const':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2252: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), std::once_flag*, google::protobuf::Metadata const&)'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Box::Box(google::protobuf::Arena*, bool)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2264: undefined reference to `google::protobuf::RepeatedField<double>::RepeatedField(google::protobuf::Arena*)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2264: undefined reference to `google::protobuf::RepeatedField<double>::~RepeatedField()'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Box::Box(veinsgym::proto::Box const&)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2273: undefined reference to `google::protobuf::RepeatedField<double>::RepeatedField(google::protobuf::RepeatedField<double> const&)'
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2273: undefined reference to `google::protobuf::RepeatedField<double>::~RepeatedField()'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Box::~Box()':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2281: undefined reference to `google::protobuf::RepeatedField<double>::~RepeatedField()'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Box::Clear()':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2308: undefined reference to `google::protobuf::RepeatedField<double>::Clear()'
out/gcc-debug//protobuf/veinsgym.pb.o: In function `veinsgym::proto::Box::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/home/rost/serpentine-env/src/protobuf/veinsgym.pb.cc:2321: undefined reference to `google::protobuf::internal::PackedDoubleParser(void*, char const*, google::protobuf::internal::ParseContext*)'
...
/home/rost/serpentine-env/src/./protobuf/veinsgym.pb.h:780: undefined reference to `google::protobuf::internal::ZeroFieldsBase::InternalSwap(google::protobuf::internal::ZeroFieldsBase*)'
out/gcc-debug//serpentine/GymSplitter.o: In function `veinsgym::proto::Shutdown::CopyFrom(veinsgym::proto::Shutdown const&)':
/home/rost/serpentine-env/src/./protobuf/veinsgym.pb.h:835: undefined reference to `google::protobuf::internal::ZeroFieldsBase::CopyImpl(google::protobuf::Message*, google::protobuf::Message const&)'
out/gcc-debug//serpentine/GymSplitter.o: In function `veinsgym::proto::Box::set_values(int, double)':
/home/rost/serpentine-env/src/./protobuf/veinsgym.pb.h:3778: undefined reference to `google::protobuf::RepeatedField<double>::Set(int, double const&)'
out/gcc-debug//serpentine/GymSplitter.o: In function `void google::protobuf::RepeatedField<double>::Add<double const*>(double const*, double const*)':
/usr/local/include/google/protobuf/repeated_field.h:705: undefined reference to `google::protobuf::RepeatedField<double>::size() const'
/usr/local/include/google/protobuf/repeated_field.h:712: undefined reference to `google::protobuf::RepeatedField<double>::elements() const'
/usr/local/include/google/protobuf/repeated_field.h:712: undefined reference to `google::protobuf::RepeatedField<double>::size() const'
/usr/local/include/google/protobuf/repeated_field.h:713: undefined reference to `google::protobuf::RepeatedField<double>::size() const'
out/gcc-debug//serpentine/GymSplitter.o: In function `google::protobuf::RepeatedField<double>::FastAdderImpl<0, true>::FastAdderImpl(google::protobuf::RepeatedField<double>*)':
/usr/local/include/google/protobuf/repeated_field.h:448: undefined reference to `google::protobuf::RepeatedField<double>::unsafe_elements() const'
out/gcc-debug//serpentine/GymSplitter.o: In function `google::protobuf::RepeatedField<double>::FastAdderImpl<0, true>::Add(double)':
/usr/local/include/google/protobuf/repeated_field.h:457: undefined reference to `google::protobuf::RepeatedField<double>::unsafe_elements() const'
collect2: error: ld returned 1 exit status
Makefile:96: recipe for target 'out/gcc-debug//experiment_dbg' failed
make: *** [out/gcc-debug//experiment_dbg] Error 1
make: Leaving directory '/home/rost/serpentine-env/src'

Using Crypto++ in Clion IDE

I have some problem with compile correct application in fresh-installed Clion IDE. Earlier I used Code::Blocks and all compiling successfully. Project use pthread and Crypto++ library. I'm already have them installed on my Ubuntu 15.04. And compile Clion project with -pthread flag. But it can't find crypto++ library. How to fix this?
My CMake file:
cmake_minimum_required(VERSION 3.3)
project(Chat)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
set(SOURCE_FILES
include/Chat.h
include/Checker.h
include/Client.h
include/DataTransferingInterface.h
include/EncryptorDES.h
include/EncryptorRSA.h
include/Logger.h
include/OwnerClientInterface.h
include/OwnerServerInterface.h
include/Parser.h
include/SecureChat.h
include/Server.h
src/Chat.cpp
src/Checker.cpp
src/Client.cpp
src/DataTransferingInterface.cpp
src/EncryptorDES.cpp
src/EncryptorRSA.cpp
src/Logger.cpp
src/OwnerClientInterface.cpp
src/OwnerServerInterface.cpp
src/Parser.cpp
src/SecureChat.cpp
src/Server.cpp
main.cpp)
add_executable(Chat ${SOURCE_FILES})
Compile errors:
/usr/include/cryptopp/integer.h:26: undefined reference to `vtable for CryptoPP::Integer'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::AbstractRing<CryptoPP::Integer>::MultiplicativeGroupT::~MultiplicativeGroupT()':
/usr/include/cryptopp/algebra.h:70: undefined reference to `vtable for CryptoPP::AbstractRing<CryptoPP::Integer>::MultiplicativeGroupT'
/usr/include/cryptopp/algebra.h:70: undefined reference to `CryptoPP::AbstractGroup<CryptoPP::Integer>::~AbstractGroup()'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::FileStore::~FileStore()':
/usr/include/cryptopp/files.h:14: undefined reference to `vtable for CryptoPP::FileStore'
/usr/include/cryptopp/files.h:14: undefined reference to `vtable for CryptoPP::FileStore'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::FileSink::~FileSink()':
/usr/include/cryptopp/files.h:77: undefined reference to `vtable for CryptoPP::FileSink'
/usr/include/cryptopp/files.h:77: undefined reference to `vtable for CryptoPP::FileSink'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::HMAC_Base::~HMAC_Base()':
/usr/include/cryptopp/hmac.h:12: undefined reference to `vtable for CryptoPP::HMAC_Base'
/usr/include/cryptopp/hmac.h:12: undefined reference to `vtable for CryptoPP::HMAC_Base'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::AlgorithmParametersTemplate<char const*>::AssignValue(char const*, std::type_info const&, void*) const':
/usr/include/cryptopp/algparam.h:313: undefined reference to `CryptoPP::g_pAssignIntToInteger'
/usr/include/cryptopp/algparam.h:313: undefined reference to `CryptoPP::g_pAssignIntToInteger'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::DL_EncryptorBase<CryptoPP::ECPPoint>::Encrypt(CryptoPP::RandomNumberGenerator&, unsigned char const*, unsigned long, unsigned char*, CryptoPP::NameValuePairs const&) const':
/usr/include/cryptopp/integer.h:118: undefined reference to `CryptoPP::Integer::One()'
/usr/include/cryptopp/integer.h:118: undefined reference to `CryptoPP::Integer::Zero()'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::DL_EncryptorBase<CryptoPP::ECPPoint>::Encrypt(CryptoPP::RandomNumberGenerator&, unsigned char const*, unsigned long, unsigned char*, CryptoPP::NameValuePairs const&) const':
/usr/include/cryptopp/pubkey.h:1228: undefined reference to `CryptoPP::Integer::One()'
/usr/include/cryptopp/pubkey.h:1228: undefined reference to `CryptoPP::Integer::Integer(CryptoPP::RandomNumberGenerator&, CryptoPP::Integer const&, CryptoPP::Integer const&, CryptoPP::Integer::RandomNumberType, CryptoPP::Integer const&, CryptoPP::Integer const&)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::SourceTemplate<CryptoPP::FileStore>::Pump2(unsigned long long&, bool)':
/usr/include/cryptopp/filters.h:763: undefined reference to `CryptoPP::DEFAULT_CHANNEL'
/usr/include/cryptopp/filters.h:763: undefined reference to `CryptoPP::FileStore::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long long&, std::string const&, bool)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::SourceTemplate<CryptoPP::FileStore>::PumpMessages2(unsigned int&, bool)':
/usr/include/cryptopp/filters.h:765: undefined reference to `CryptoPP::DEFAULT_CHANNEL'
/usr/include/cryptopp/filters.h:765: undefined reference to `CryptoPP::BufferedTransformation::TransferMessagesTo2(CryptoPP::BufferedTransformation&, unsigned int&, std::string const&, bool)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::SourceTemplate<CryptoPP::FileStore>::PumpAll2(bool)':
/usr/include/cryptopp/filters.h:767: undefined reference to `CryptoPP::DEFAULT_CHANNEL'
/usr/include/cryptopp/filters.h:767: undefined reference to `CryptoPP::BufferedTransformation::TransferAllTo2(CryptoPP::BufferedTransformation&, std::string const&, bool)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::SourceTemplate<CryptoPP::FileStore>::SourceExhausted() const':
/usr/include/cryptopp/filters.h:769: undefined reference to `CryptoPP::BufferedTransformation::AnyRetrievable() const'
/usr/include/cryptopp/filters.h:769: undefined reference to `CryptoPP::BufferedTransformation::AnyMessages() const'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::DL_EncryptionAlgorithm_Xor<CryptoPP::HMAC<CryptoPP::SHA1>, false>::SymmetricEncrypt(CryptoPP::RandomNumberGenerator&, unsigned char const*, unsigned char const*, unsigned long, unsigned char*, CryptoPP::NameValuePairs const&) const':
/usr/include/cryptopp/gfpcrypt.h:439: undefined reference to `CryptoPP::xorbuf(unsigned char*, unsigned char const*, unsigned char const*, unsigned long)'
/usr/include/cryptopp/gfpcrypt.h:441: undefined reference to `CryptoPP::HMAC_Base::Update(unsigned char const*, unsigned long)'
/usr/include/cryptopp/gfpcrypt.h:442: undefined reference to `CryptoPP::HMAC_Base::Update(unsigned char const*, unsigned long)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::DL_EncryptionAlgorithm_Xor<CryptoPP::HMAC<CryptoPP::SHA1>, false>::SymmetricDecrypt(unsigned char const*, unsigned char const*, unsigned long, unsigned char*, CryptoPP::NameValuePairs const&) const':
/usr/include/cryptopp/gfpcrypt.h:470: undefined reference to `CryptoPP::HMAC_Base::Update(unsigned char const*, unsigned long)'
/usr/include/cryptopp/gfpcrypt.h:471: undefined reference to `CryptoPP::HMAC_Base::Update(unsigned char const*, unsigned long)'
/usr/include/cryptopp/gfpcrypt.h:481: undefined reference to `CryptoPP::xorbuf(unsigned char*, unsigned char const*, unsigned char const*, unsigned long)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::DL_KeyAgreementAlgorithm_DH<CryptoPP::ECPPoint, CryptoPP::EnumToType<CryptoPP::CofactorMultiplicationOption, 0> >::AgreeWithEphemeralPrivateKey(CryptoPP::DL_GroupParameters<CryptoPP::ECPPoint> const&, CryptoPP::DL_FixedBasePrecomputation<CryptoPP::ECPPoint> const&, CryptoPP::Integer const&) const':
/usr/include/cryptopp/pubkey.h:1445: undefined reference to `CryptoPP::Integer::Integer(CryptoPP::Integer const&)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::DL_KeyAgreementAlgorithm_DH<CryptoPP::ECPPoint, CryptoPP::EnumToType<CryptoPP::CofactorMultiplicationOption, 0> >::AgreeWithStaticPrivateKey(CryptoPP::DL_GroupParameters<CryptoPP::ECPPoint> const&, CryptoPP::ECPPoint const&, bool, CryptoPP::Integer const&) const':
/usr/include/cryptopp/pubkey.h:1473: undefined reference to `CryptoPP::Integer::Integer(CryptoPP::Integer const&)'
/usr/include/cryptopp/pubkey.h:1473: undefined reference to `CryptoPP::Integer::Integer(CryptoPP::Integer const&)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::HMAC<CryptoPP::SHA1>::HMAC(unsigned char const*, unsigned long)':
/usr/include/cryptopp/hmac.h:48: undefined reference to `CryptoPP::g_nullNameValuePairs'
/usr/include/cryptopp/hmac.h:48: undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned long, CryptoPP::NameValuePairs const&)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::P1363_KDF2<CryptoPP::SHA1>::DeriveKey(unsigned char*, unsigned long, unsigned char const*, unsigned long, unsigned char const*, unsigned long)':
/usr/include/cryptopp/pubkey.h:506: undefined reference to `CryptoPP::P1363_MGF1KDF2_Common(CryptoPP::HashTransformation&, unsigned char*, unsigned long, unsigned char const*, unsigned long, unsigned char const*, unsigned long, bool, unsigned int)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::IteratedHashWithStaticTransform<unsigned int, CryptoPP::EnumToType<CryptoPP::ByteOrder, 1>, 64u, 20u, CryptoPP::SHA1, 0u, false>::Init()':
/usr/include/cryptopp/iterhash.h:90: undefined reference to `CryptoPP::SHA1::InitState(unsigned int*)'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o:(.rodata._ZTIN8CryptoPP16IteratedHashBaseIjNS_18HashTransformationEEE[_ZTIN8CryptoPP16IteratedHashBaseIjNS_18HashTransformationEEE]+0x10): undefined reference to `typeinfo for CryptoPP::HashTransformation'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o:(.rodata._ZTIN8CryptoPP25SimpleKeyingInterfaceImplINS_9HMAC_BaseENS_4HMACINS_4SHA1EEEEE[_ZTIN8CryptoPP25SimpleKeyingInterfaceImplINS_9HMAC_BaseENS_4HMACINS_4SHA1EEEEE]+0x10): undefined reference to `typeinfo for CryptoPP::HMAC_Base'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::HashTransformation::HashTransformation(CryptoPP::HashTransformation const&)':
/usr/include/cryptopp/cryptlib.h:531: undefined reference to `vtable for CryptoPP::HashTransformation'
CMakeFiles/Chat.dir/src/EncryptorRSA.cpp.o: In function `CryptoPP::IteratedHashWithStaticTransform<unsigned int, CryptoPP::EnumToType<CryptoPP::ByteOrder, 1>, 64u, 20u, CryptoPP::SHA1, 0u, false>::HashEndianCorrectedBlock(unsigned int const*)':
/usr/include/cryptopp/iterhash.h:89: undefined reference to `CryptoPP::SHA1::Transform(unsigned int*, unsigned int const*)'
collect2: error: ld returned 1 exit status
CMakeFiles/Chat.dir/build.make:406: recipe for target 'Chat' failed
make[2]: *** [Chat] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Chat.dir/all' failed
make[1]: *** [CMakeFiles/Chat.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I performed the following after add_executable in my CMakeLists.txt to resolve the issue:
target_link_libraries(Chat /usr/lib/libcrypto++.a)

undefined reference errors when I add boost log dependecies

I am trying to add boost logging functionality.
But I've got a lot of errors with undefined reference.
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(core.o): In function `boost::thread_specific_ptr<boost::log::v2s_mt_nt5::core::implementation::thread_data>::~thread_specific_ptr()':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:79: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(core.o): In function `boost::thread_specific_ptr<boost::log::v2s_mt_nt5::core::implementation::thread_data>::get() const':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:84: undefined reference to `boost::detail::get_tss_data(void const*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(core.o): In function `boost::thread_specific_ptr<boost::log::v2s_mt_nt5::core::implementation::thread_data>::reset(boost::log::v2s_mt_nt5::core::implementation::thread_data*)':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:105: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `get':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:84: undefined reference to `boost::detail::get_tss_data(void const*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `reset':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:105: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `get':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:84: undefined reference to `boost::detail::get_tss_data(void const*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `reset':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:105: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `~thread_specific_ptr':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:79: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:79: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(severity_level.o): In function `void boost::this_thread::at_thread_exit<boost::_bi::bind_t<boost::_bi::unspecified, boost::checked_deleter<unsigned long long>, boost::_bi::list1<boost::_bi::value<unsigned long long*> > > >(boost::_bi::bind_t<boost::_bi::unspecified, boost::checked_deleter<unsigned long long>, boost::_bi::list1<boost::_bi::value<unsigned long long*> > >)':
D:\c++\boost_1_58_0/./boost/thread/detail/thread.hpp:861: undefined reference to `boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(once_block.o): In function `boost::detail::basic_cv_list_entry::wait(boost::detail::timeout)':
D:\c++\boost_1_58_0/./boost/thread/win32/condition_variable.hpp:94: undefined reference to `boost::this_thread::interruptible_wait(void*, boost::detail::timeout)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(thread_id.o): In function `at_thread_exit<boost::log::v2s_mt_nt5::aux::this_thread::(anonymous namespace)::id_storage::deleter>':
D:\c++\boost_1_58_0/./boost/thread/detail/thread.hpp:861: undefined reference to `boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*)'
collect2.exe: error: ld returned 1 exit status
My linked libraries looks like this.
My include declarations looks like this
Also my boost include folder is located in main x86_64-w64-mingw32 include folder
Had the same error under Windows 10, Cygwin GCC setup. I had to link boost_thread separately in addition to boost_log and boost_log_setup.
-lboost_log_setup -lboost_log -lboost_thread
I was using BOOST 1.66.