I have installed boost as a third library when I install pcl (Point Cloud Library).
Now I am trying to run client and server programs http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/example/cpp03/ssl/client.cpp
When trying to link the required libraries:
g++ -I /usr/include/boost/ server.cpp -o server -lboost_system -lssl -lpthread
following error appears:
/usr/bin/ld: /tmp/ccRbD849.o: undefined reference to symbol
'ERR_reason_error_string##OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libcrypto.so.1.0.0: error adding symbols: DSO
missing from command line collect2: error: ld returned 1 exit status
When I searched the usr folder the Boost folder exists only inside include subfolder.
What can I do to solve this problem.
[...] libcrypto.so: [...] DSO missing from command line
spells it out! You are missing
-lcrypto
on the linker command line. In fact I always use -lssl -lcrypto in tandem
Related
I am trying to use Microsoft REST SDK to create a server listening to HTTP requests. My current computer is Ubuntu 18.04, the server code is pretty simple.
I have already installed the library by following the instructions on libboost official website and I have checked files in /usr/local/lib/, there are libboost_random.so.1.68.0 so I presume that I have libboost library.
However when I try to compile the code with the following command:
g++ server.cpp -o server -lpthread -lcpprest -lcrypto -lssl -lboost_system
It shows:
/tmp/ccKWADuo.o: In function `boost::system::system_category()':
server.cpp:(.text._ZN5boost6system15system_categoryEv[_ZN5boost6system15system_categoryEv]+0x7): undefined reference to `boost::system::detail::system_category_instance'
/tmp/ccKWADuo.o: In function `boost::system::generic_category()':
server.cpp:(.text._ZN5boost6system16generic_categoryEv[_ZN5boost6system16generic_categoryEv]+0x7): undefined reference to `boost::system::detail::generic_category_instance'
collect2: error: ld returned 1 exit status
Thanks for any advices.
Boost consists of several independent libraries. Your linker error suggests you are missing libboost_system.so. You just mentioned libboost_random.so to be in your /usr/local/lib but is there also the required libboost_system.so?
[Problem solved] Reinstalling library libboost 1.68.0 helps. Error occurs when building from source, fixing those building errors will solve the problem.
I'm new with Cygwin and currently I'm trying to build a little project which would encrypt some files.
The problem I'm having is that when I try to build the .cpp with the command:
gcc test.cpp -I /cygdrive/c/OpenSSL-Win32/include/ -L/cygdrive/c/OpenSSL-Win32/lib/MinGW -lcrypto -lssl
(OpenSSL is installed at cygdrive/c/OpenSSL-Win32) I get the error:
/usr/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lcrypto
/usr/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lssl
collect2: error: ld returned 1 exit status
I can't understand why It can't to find the libraries, because I clearly have libssl.lib and libcrypto.lib there. Sorry if my question sounds silly I'm with all this. Thanks.
I'm testing a CNN implementation provided here. I run the command:
make cifar10 && ./cifar10
But I got the following messages:
g++ -o cifar10 BatchProducer.o ConvolutionalLayer.o ConvolutionalTriangularLayer.o IndexLearnerLayer.o MaxPoolingLayer.o MaxPoolingTriangularLayer.o NetworkArchitectures.o NetworkInNetworkLayer.o Picture.o Regions.o Rng.o SigmoidLayer.o SoftmaxClassifier.o SparseConvNet.o SparseConvNetCUDA.o SpatiallySparseBatch.o SpatiallySparseBatchInterface.o SpatiallySparseDataset.o SpatiallySparseLayer.o TerminalPoolingLayer.o cudaUtilities.o readImageToMat.o types.o utilities.o vectorCUDA.o vectorHash.o OpenCVPicture.o SpatiallySparseDatasetCIFAR10.o cifar10.o -lopencv_core -lopencv_highgui -lopencv_imgproc -lrt -larmadillo -lopenblas -lz --std=c++11 -O3
/usr/bin/ld: BatchProducer.o: undefined reference to symbol 'pthread_create##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [cifar10] Error 1
What's wrong with this? I installed all the dependencies listed in the webpage. I did not install CUDA because I tested the CPU version here. Therefore I don't think the error is due to missing CUDA.
I'm using Ubuntu 14.04 and gcc 5.3.0.
Thank you all for helping me!!!
Solution: add '-lz' to your makefile / GCC flags. In other words, your simply missing a library in your make steps, and check if you installled all dependencies
sudo apt-get install libarmadillo-dev libopencv-core-dev libopencv-highgui-dev sparsehash
I am trying to use the SDL_ttf development library in an Ubuntu environment. I started by downloading the dev libraries via: sudo apt-get install libsdl-ttf2.0-dev.
Next, I imported the header file in my code as so:
#include <SDL_ttf.h>
When I compile with the command:
g++ -g -I /usr/include/SDL Main.cpp -lSDL -lSDL_image -lSDL_ttf land.cpp PerlinNoise.cpp Util.cpp org.cpp Init.cpp `sdl-config --libs
I get the following output:
/tmp/ccpLKljA.o: In function `init()':
/home/zoo/Desktop/World-A/Util.cpp:39: undefined reference to `TTF_Init'
/home/zoo/Desktop/World-A/Util.cpp:42: undefined reference to `TTF_Quit'
/home/zoo/Desktop/World-A/Util.cpp:48: undefined reference to `TTF_OpenFont'
/home/zoo/Desktop/World-A/Util.cpp:52: undefined reference to `TTF_Quit'
collect2: ld returned 1 exit status
I understand this is a linker error however I do not know what to do to fix it. I know that the -lSDL_ttf command is not doing anything because removing it does not change anything. I tried to reference the .so file however that didn't change the results. I did this reference via the command: -LlibSDL_ttf-2.0.so.0.6.3. I am able to view the .so file and it does contain the commands listed above.
You have to put land.cpp, and the rest of the CPP files, before the libraries on the command line.
I read V8 hello world example, and follow the steps in the document to build v8 successfully.
But when I compile the example code, link error occured. Here comes my computer detail and error prompts.
OS Ubuntu 13.10 amd64
GCC (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
Compile command:
g++ -Iinclude hello_world.cc -o hello_world -Wl,--start-group out/native/obj.target/{tools/gyp/libv8_{base.x64,snapshot},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group -lrt
Error prompts
/usr/bin/ld: /home/leon/Documents/v8/v8/out/native/obj.target/v8_base.x64/src/platform/mutex.o: undefined reference to symbol 'pthread_mutexattr_settype##GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
The error suggests that you need to add the pthread library to your link command. Just append -lpthread.
(It's a bit odd that it identifies exactly which library you need, then tells you it refuses to use it because you didn't list it on the command-line...)