我试图在Ubuntu 16.04上使用Boost.Asio 1.58和code on this tutorial。
Boost安装在usr/include/boost
上,随OpenCV Package一起安装。
并尝试使用Cmake构建,CMakeLists.txt是:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(server)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.58 REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIR})
add_executable(server server.cpp)
target_link_libraries(server ${Boost_SYSTEM_LIBRARY})
end if()
尝试以多种方式更改CMakeLists.txt,但它无法正常工作。 然而,现在已经使用Cmake与另一个库(PCL)进行构建 CMAKE停了下来。并且正在给出这个错误...
命令:
cd
cd tests
mkdir daytimeservertcp
cd daytimeservertcp
sudo nano server.cpp `#paste code, ctrl+x , y , enter` \
sudo nano CMakeLists.txt
mkdir build
cd build
cmake ..
server.cpp是包含教程代码的文件,之前提到过CMakeLists.txt。
还尝试使用相同的错误cmake -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib
。
但是,当我运行cmake ..
时,它会显示以下错误:
cmake:加载共享库时出错:libssl.so.1.0.2:无法打开共享对象文件:没有这样的文件或目录
检查openssl版本:
openssl version -v
OpenSSL 1.1.0f 25 May 2017 (Library: OpenSSL 1.1.0g 2 Nov 2017)
ldd
:
版本1.0.2:
ldd /lib/x86_64-linux-gnu/libssl.so.1.0.2
ldd: /lib/x86_64-linux-gnu/libssl.so.1.0.2: No such file or directory
版本1.0.0
ldd /lib/x86_64-linux-gnu/libssl.so.1.0.0
linux-vdso.so.1 => (0x00007ffefa110000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f70e8ec2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f70e8af8000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f70e88f3000)
/lib64/ld-linux-x86-64.so.2 (0x000055996589f000)
版本1.1它位于不同的本地:
ldd /usr/lib/x86_64-linux-gnu/libssl*
/usr/lib/x86_64-linux-gnu/libssl3.so:
linux-vdso.so.1 => (0x00007fff7367d000)
libnss3.so => /usr/lib/x86_64-linux-gnu/libnss3.so (0x00007fb35bb56000)
libnssutil3.so => /usr/lib/x86_64-linux-gnu/libnssutil3.so (0x00007fb35b929000)
libplc4.so => /usr/lib/x86_64-linux-gnu/libplc4.so (0x00007fb35b723000)
libnspr4.so => /usr/lib/x86_64-linux-gnu/libnspr4.so (0x00007fb35b4e4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb35b2c7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb35aefc000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb35ace2000)
libplds4.so => /usr/lib/x86_64-linux-gnu/libplds4.so (0x00007fb35aade000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb35a8d9000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb35a6d1000)
/lib64/ld-linux-x86-64.so.2 (0x000055fb5dcb2000)
/usr/lib/x86_64-linux-gnu/libssl.a:
not a dynamic executable
/usr/lib/x86_64-linux-gnu/libssl.so:
linux-vdso.so.1 => (0x00007ffc8b7e8000)
libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f69b43e4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f69b41c7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f69b3dfc000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f69b3bf8000)
/lib64/ld-linux-x86-64.so.2 (0x000055bacc56a000)
/usr/lib/x86_64-linux-gnu/libssl.so.1.1:
linux-vdso.so.1 => (0x00007fff117e5000)
libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f0e705f4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0e703d7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0e7000c000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0e6fe08000)
/lib64/ld-linux-x86-64.so.2 (0x000055d33980f000)
尝试安装libssl 1.0.2时:
sudo apt-get install libssl1.0.2 libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libssl1.0.2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libssl1.0.2' has no installation candidate
因此使用this link。
如何正确构建?
我的链接不正确吗?我在哪里更改为加载版本1.0.0而不是1.0.2?
p.s。:Ubuntu新手在这里