Botan static library linking error - c++11

When I compile a source file using option:
-lbotan-2
which means using the shared library, nothing goes wrong.
But after I switch to option:
-l:libbotan-2.a
which means using the static library, an error occurs:
//usr/local/lib/libbotan-2.a(pubkey_rsa.o): In function std::future<std::result_of<Botan::Fixed_Exponent_Power_Mod const& (Botan::BigInt const&)>::type> std::async<Botan::Fixed_Exponent_Power_Mod const&, Botan::BigInt const&>(std::launch, Botan::Fixed_Exponent_Power_Mod const&, Botan::BigInt const&)':
rsa.cpp:(.text._ZSt5asyncIRKN5Botan24Fixed_Exponent_Power_ModEJRKNS0_6BigIntEEESt6futureINSt9result_ofIFT_DpT0_EE4typeEESt6launchOS9_DpOSA_[_ZSt5asyncIRKN5Botan24Fixed_Exponent_Power_ModEJRKNS0_6BigIntEEESt6futureINSt9result_ofIFT_DpT0_EE4typeEESt6launchOS9_DpOSA_]+0x379): undefined reference topthread_create'
collect2: error: ld returned 1 exit status
I'm using Botan 2.1.0 and c++11 under Ubuntu 16.04.
Any ideas what goes wrong?
Thanks in advance.

Related

MINGW64 cannot find reference to libcrypt

I have problem with building my C++ project using CLion, MINGw64.
So this is the problem I cannot handle with ._.
Everything works on Linux but on Win10 I have this log:
libBiblioteka.a(Rent.cpp.obj): In function `boost::uuids::detail::random_provider_base::random_provider_base()':
C:/msys64/mingw64/include/boost/uuid/detail/random_provider_bcrypt.ipp:40: undefined reference to `BCryptOpenAlgorithmProvider'
libBiblioteka.a(Rent.cpp.obj): In function `boost::uuids::detail::random_provider_base::get_random_bytes(void*, unsigned long long)':
C:/msys64/mingw64/include/boost/uuid/detail/random_provider_bcrypt.ipp:76: undefined reference to `BCryptGenRandom'
libBiblioteka.a(Rent.cpp.obj): In function `boost::uuids::detail::random_provider_base::destroy()':
C:/msys64/mingw64/include/boost/uuid/detail/random_provider_bcrypt.ipp:93: undefined reference to `BCryptCloseAlgorithmProvider'
collect2.exe: error: ld returned 1 exit status
I have read these references are unavaiable on win10. But there is an question:
Is there any way to workaround this?
Those are not defined in libcrypt but in libbcrypt.
Did you have the same typo in your linker flags (you should have -lbcrypt)?

Qt5 undefined reference to `QString

I have a sensor that in their SDK, they are calling QT5 package.
This is the GCC command to build the programgcc Main.c -o main -L../../Release -L/usr/lib/arm-linux-gnueabihf -lQt5SerialPort -lLeddarC -lLeddar -lLeddarTech -lstdc++
But after that I'm getting these errors:
../../Release/libLeddar.so: undefined reference to `QString::toLocal8Bit_helper(QChar const*, int)'
../../Release/libLeddarC.so: undefined reference to `QString::toUtf8_helper(QString const&)'
../../Release/libLeddarC.so: undefined reference to `__cxa_throw_bad_array_new_length#CXXABI_1.3.8'
I think Qstring is a part of QtCore, I tired to find it to add to gcc but I just find /usr/lib/arm-linux-gnueabihf/libQtCore.so.4 that is basically based on Qt4 and not 5.
I aleady found the location of Qt5SerialPort at /usr/lib/arm-linux-gnueabihf .But I don't know why I'm getting error for QString
Could you please help me with solving this issue?
When I look for QString I got this:
/usr/include/qt5/QtCore/QStringRef
/usr/include/qt5/QtCore/QStringData
/usr/include/qt5/QtCore/QStringBuilder
/usr/include/qt5/QtCore/QStringMatcher
/usr/include/qt5/QtCore/QStringList
/usr/include/qt5/QtCore/QStringListModel
/usr/include/qt5/QtCore/QStringDataPtr
/usr/include/qt5/QtCore/QString
/usr/include/qt5/QtCore/QStringListIterator
It seems that They are in include folder but I don't know how I can call them with GCC since they are not build *.so libraries.
Think you need add new -lQtCore option to gcc command.

Boost linking error after updating g++ version

my program was OK to build a few days back. But after I update my gcc/g++ I got compiling errors:
CMakeFiles/tripleClassification.dir/src/tripleClassification.cpp.o: In function `boost::program_options::typed_value<std::string, char>::xparse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&) const':
tripleClassification.cpp:(.text._ZNK5boost15program_options11typed_valueISscE6xparseERNS_3anyERKSt6vectorISsSaISsEE[_ZNK5boost15program_options11typed_valueISscE6xparseERNS_3anyERKSt6vectorISsSaISsEE]+0x19): undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, std::string*, int)'
I googled it, it seems to have something to do with gcc version. Can anyone tell me how to change my cmake file to make it work?

OSX linking program: undefined symbols for x86_64

I have a program that runs correctly when using .png files.
I'm trying to convert it to support OpenEXR.
The program is compiled with macports g++-mp-4.5, and links against macports's openexr1.7.
Relevant parts of the compile line:
/opt/local/bin/g++-mp-4.5 ... -I/opt/local/include/OpenEXR -I/opt/local/include/OpenEXR file.cc ...
-L/opt/local/lib -lIlmImf -lHalf ...
When run, it does this when it tries to call the exr library:
libc++abi.dylib: terminate called throwing an exception
When it is changed to link with the .a files
/opt/local/lib/libIlmImf.a /opt/local/lib/libHalf.a
it gives a link error
Undefined symbols for architecture x86_64:
"Iex::throwErrnoExc(std::basic_string, std::allocator > const&)", referenced from:
Imf::(anonymous namespace)::writeLineOffsets(Imf::OStream&, std::vector > const&) in libIlmImf.a(ImfOutputFile.o)
Imf::StdIFStream::StdIFStream(char const*) in libIlmImf.a(ImfStdIO.o)
Imf::(anonymous namespace)::checkError(std::basic_istream >&, long) in libIlmImf.a(ImfStdIO.o)
After searching, it seems that this (*undefined symbols for x86_64*) is a common problem for linux-style mac development, and does not appear to be specific
to openexr. However after reading various posts, I still do not understand what the solution is!
Here is a post on the exact problem, however the solution is not explained in enough detail for me to understand:
http://lists.nongnu.org/archive/html/openexr-devel/2011-08/msg00007.html

Trouble linking Tim Bolstad's Core Audio Example

I'm probably missing something simple, but I'm getting the following linker error when trying to build:
Undefined symbols for architecture i386:
"CAStreamBasicDescription::CAStreamBasicDescription()", referenced from:
-[AudioController initializeAUGraph] in AudioController.o
-[AudioController .cxx_construct] in AudioController.o
"CAStreamBasicDescription::AsString(char*, unsigned long) const", referenced from:
CAStreamBasicDescription::PrintFormat(__sFILE*, char const*, char const*) const in AudioController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I can't figure out what's going on here as the compiler is finding CAStreamBasicDescription.h just fine. I've seen suggestions of clearing the framework search path when encountering this type of error, but there's nothing in that path. Probably something simple, but I feel like I'm drinking from a fire hose. Thanks!
Have you added CAStreamBasicDescription.cpp to your project also? It's part of the unofficial Core Audio SDK, so it isn't available unless you compile it yourself.

Resources