首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到LibCrypto (失踪: LibCrypto_LIBRARY LibCrypto_INCLUDE_DIR)

找不到LibCrypto (失踪: LibCrypto_LIBRARY LibCrypto_INCLUDE_DIR)
EN

Stack Overflow用户
提问于 2021-05-12 14:27:54
回答 3查看 2.2K关注 0票数 1

这是对以下方面的后续行动:

根据我在本地再次尝试的答案:

代码语言:javascript
复制
$ git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git
$ cd aws-sdk-cpp
$ mkdir build
$ cmake .. -DBUILD_ONLY=core -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=~/install
$ make install -i

我被迫使用'-i',因为至少有一个测试失败了(似乎'make test'规则在'make all'中)。

然后从我的宠物项目:

代码语言:javascript
复制
% cat ../CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
project(lambda-example)
set (CMAKE_CXX_STANDARD 11)

# Locate the aws sdk for c++ package.
find_package(AWSSDK REQUIRED COMPONENTS lambda)

# The executables to build.
set(EXAMPLES "")
list(APPEND EXAMPLES "main")

# The executables to build
foreach(EXAMPLE IN LISTS EXAMPLES)
  add_executable(${EXAMPLE} ${EXAMPLE}.cpp)
  target_link_libraries(${EXAMPLE} ${AWSSDK_LINK_LIBRARIES})
endforeach()

我得到:

代码语言:javascript
复制
% cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=~/install
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found AWS SDK for C++, Version: 1.9.18, Install Root:/home/mathieu/install, Platform Prefix:, Platform Dependent Libraries: pthread;crypto;ssl;z;curl
-- Components specified for AWSSDK: lambda, application will be depending on libs: aws-cpp-sdk-lambda;aws-cpp-sdk-core;aws-crt-cpp;aws-c-auth;aws-c-cal;aws-c-common;aws-c-compression;aws-c-event-stream;aws-c-http;aws-c-io;aws-c-mqtt;aws-c-s3;aws-checksums;pthread;crypto;ssl;z;curl
-- Try finding aws-cpp-sdk-core
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Found LibCrypto: /usr/lib/x86_64-linux-gnu/libcrypto.so
-- LibCrypto Include Dir: /usr/include
-- LibCrypto Shared Lib:  /usr/lib/x86_64-linux-gnu/libcrypto.so
-- LibCrypto Static Lib:  /usr/lib/x86_64-linux-gnu/libcrypto.so
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find LibCrypto (missing: LibCrypto_LIBRARY LibCrypto_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /home/mathieu/install/lib/s2n/cmake/modules/FindLibCrypto.cmake:61 (find_package_handle_standard_args)
  /usr/share/cmake-3.16/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/mathieu/install/lib/aws-c-cal/cmake/aws-c-cal-config.cmake:7 (find_dependency)
  /usr/share/cmake-3.16/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/mathieu/install/lib/aws-c-io/cmake/aws-c-io-config.cmake:8 (find_dependency)
  /usr/share/cmake-3.16/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/mathieu/install/lib/aws-c-http/cmake/aws-c-http-config.cmake:3 (find_dependency)
  /usr/share/cmake-3.16/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/mathieu/install/lib/aws-crt-cpp/cmake/aws-crt-cpp-config.cmake:3 (find_dependency)
  /usr/share/cmake-3.16/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/mathieu/install/lib/cmake/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
  /home/mathieu/install/lib/cmake/AWSSDK/AWSSDKConfig.cmake:305 (find_package)
  CMakeLists.txt:6 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/mathieu/workspace/junk/bin/CMakeFiles/CMakeOutput.log".
See also "/home/mathieu/workspace/junk/bin/CMakeFiles/CMakeError.log".

以上所述是基于以下几点:

  1. 在EC2上从源代码构建SDK
  2. 如何在AWS Lambda上运行任何编程语言:自定义运行时。
  3. AWS的C++代码示例

错误信息似乎自相矛盾:

代码语言:javascript
复制
-- Found LibCrypto: /usr/lib/x86_64-linux-gnu/libcrypto.so
[...]
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find LibCrypto (missing: LibCrypto_LIBRARY LibCrypto_INCLUDE_DIR)

我错过了什么?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-05-27 21:54:55

我正经历着与你所描述的完全相同的问题。

当C++版本1.9.27使用AWS时(从标记中签出),

在CentOS 7环境下构建应用程序的唯一方法是下一个cmake命令:

代码语言:javascript
复制
$ mkdir build && cd build
$ cmake3 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DLibCrypto_INCLUDE_DIR=/usr/include -DLibCrypto_LIBRARY=/usr/lib64/libcrypto.so ..
 -- The C compiler identification is GNU 4.8.5
 -- The CXX compiler identification is GNU 4.8.5
 -- Check for working C compiler: /usr/bin/cc
 -- Check for working C compiler: /usr/bin/cc - works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Detecting C compile features
 -- Detecting C compile features - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ - works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1") 

..............
..............
..............

 -- Found Python: /usr/bin/python3.6 (found version "3.6.8") found components: Interpreter 
 -- Looking for pthread.h
 -- Looking for pthread.h - found
 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
 -- Looking for pthread_create in pthreads
 -- Looking for pthread_create in pthreads - not found
 -- Looking for pthread_create in pthread
 -- Looking for pthread_create in pthread - found
 -- Found Threads: TRUE  
 -- Found AWS SDK for C++, Version: 1.9.27, Install Root:/usr, Platform Prefix:, Platform Dependent Libraries: pthread;crypto;ssl;z;curl
 -- Components specified for AWSSDK: s3;s3-crt;core;transfer;iam;sts;identity-management, application will be depending on libs: aws-cpp-sdk-s3-crt;aws-cpp-sdk-transfer;aws-cpp-sdk-iam;aws-cpp-sdk-identity-management;aws-cpp-sdk-cognito-identity;aws-cpp-sdk-s3;aws-cpp-sdk-sts;aws-cpp-sdk-core;aws-crt-cpp;aws-c-auth;aws-c-cal;aws-c-common;aws-c-compression;aws-c-event-stream;aws-c-http;aws-c-io;aws-c-mqtt;aws-c-s3;aws-checksums;pthread;crypto;ssl;z;curl
 -- Try finding aws-cpp-sdk-core
 -- Check if compiler accepts -pthread
 -- Check if compiler accepts -pthread - yes
 -- Found LibCrypto: /usr/lib64/libcrypto.so  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  /usr/lib64/libcrypto.so
 -- LibCrypto Static Lib:  /usr/lib64/libcrypto.so
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- LibCrypto Include Dir: /usr/include
 -- LibCrypto Shared Lib:  
 -- LibCrypto Static Lib:  
 -- Found aws-cpp-sdk-core
 -- Try finding aws-cpp-sdk-sts
 -- Found aws-cpp-sdk-sts
 -- Try finding aws-cpp-sdk-s3
 -- Found aws-cpp-sdk-s3
 -- Try finding aws-cpp-sdk-cognito-identity
 -- Found aws-cpp-sdk-cognito-identity
 -- Try finding aws-cpp-sdk-identity-management
 -- Found aws-cpp-sdk-identity-management
 -- Try finding aws-cpp-sdk-iam
 -- Found aws-cpp-sdk-iam
 -- Try finding aws-cpp-sdk-transfer
 -- Found aws-cpp-sdk-transfer
 -- Try finding aws-cpp-sdk-s3-crt
 -- Found aws-cpp-sdk-s3-crt
 -- Configuring done
 -- Generating done
 -- Build files have been written to: /home/user/project/path/build

正如您所注意到的,关于LibCrypto Include Dir: /usr/include有很多奇怪的输出行。我想在使用cmake缓存变量进行libcrypto设置时存在问题。在上面的配置命令之后,我可以成功地make -j4make install我的目标。

我使用的cmake版本是3.17.5。GCC版就是在上面输出的。

票数 4
EN

Stack Overflow用户

发布于 2021-05-20 17:54:52

您需要安装libcrypto、libssl和libcurl。

通过运行以下命令,我在Ubuntu机器中解决了同样的问题。

sudo apt-get install libcurl4

sudo apt-get install libcurlpp-dev

sudo apt-get install libcrypto++-dev

参考:https://github.com/aws/aws-sdk-cpp#other-dependencies

票数 -1
EN

Stack Overflow用户

发布于 2022-11-17 02:39:43

您需要安装libssl-dev。

代码语言:javascript
复制
sudo apt-get install libssl-dev
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67505622

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档