从源构建 alexa 语音服务 (AVS) SDK 应用程序时,cmake 抛出错误(找不到 curl)

cmake throws error (could not find curl) while building alexa voice service (AVS) SDK app from source

情况

我正在 Ubuntu 20.04 机器上设置 AVS SDK。我正在遵循本指南: https://developer.amazon.com/en-US/docs/alexa/avs-device-sdk/ubuntu.html

我按顺序执行了每条命令,一切都很顺利,直到我开始为 SDK 示例应用构建依赖项。

cmake $HOME/my_alexa_project/source/avs-device-sdk \
 -DGSTREAMER_MEDIA_PLAYER=ON \
 -DPORTAUDIO=ON \
 -DPORTAUDIO_LIB_PATH=$HOME/my_alexa_project/third-party/portaudio/lib/.libs/libportaudio.so \
 -DPORTAUDIO_INCLUDE_DIR=$HOME/my_alexa_project/third-party/portaudio/include \
 -DCMAKE_BUILD_TYPE=DEBUG

我收到错误:

curl: /usr/local/lib/libcurl.so.4: no version information available (required by curl)

从上面的陈述中我发现我在导致此错误的同一系统上安装了两个版本的 CURL,一个是我之前安装的使用:

sudo apt install curl

还有一个是我在安装 SDK 依赖项时安装的(指南中使用的版本截至 2021 年 6 月 20 日已过时):这些是命令。

 wget https://curl.haxx.se/download/curl-7.63.0.tar.gz
 tar xzf curl-7.63.0.tar.gz
 cd curl-7.63.0
 ./configure --with-nghttp2 --prefix=/usr/local --with-ssl
 make && sudo make install
 sudo ldconfig

采取的措施

首先,我从我的设备上卸载了两个版本的 curl。

Apt 一个作者

sudo apt remove curl 
sudo apt purge curl

通过转到 curl 的安装文件夹和 运行

手动一
sudo make uninstall

然后我从 curl 安装了最新版本: 重复上述步骤但替换了 URL.

 wget https://curl.se/download/curl-7.77.0.tar.gz
 tar xzf curl-7.77.0.tar.gz
 cd curl-7.77.0
 ./configure --with-nghttp2 --prefix=/usr/local --with-ssl
 make && sudo make install
 sudo ldconfig

在采取所有步骤后,我现在收到此错误:

Could NOT find CURL: Found unsuitable version "7.63.0", but required is at least "7.67.0" (found /usr/local/lib/libcurl.so)

完整的错误说明:

cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake)
Creating the build directory for the AlexaClientSDK with build type: DEBUG
CMake Warning at cmakeBuild/cmake/BuildOptions.cmake:44 (message):
  WARNING! THIS DEVICE HAS BEEN COMPILED IN DEBUG MODE.

  

  RELEASING A PRODUCTION DEVICE IN DEBUG MODE MAY IMPACT DEVICE PERFORMANCE,
  DOES NOT COMPLY WITH THE AVS SECURITY REQUIREMENTS, AND COULD RESULT IN
  SUSPENSION OR TERMINATION OF THE ALEXA SERVICE ON YOUR DEVICES.

  

Call Stack (most recent call first):
  cmakeBuild/BuildDefaults.cmake:21 (include)
  cmakeBuild/BuildDefaults.cmake:29 (include_once)
  CMakeLists.txt:13 (include)


-- UseDefaultIfNotSet: ACSDKALEXACOMMUNICATIONS_LIB set to acsdkLibcurlAlexaCommunications.
-- UseDefaultIfNotSet: ACSDKAUTHORIZATIONDELEGATE_LIB set to acsdkCBLAuthorizationDelegate.
-- UseDefaultIfNotSet: ACSDKDEVICESETTINGSMANAGER_LIB set to acsdkDefaultDeviceSettingsManager.
-- UseDefaultIfNotSet: ACSDKHTTPCONTENTFETCHER_LIB set to acsdkLibcurlHTTPContentFetcher.
-- UseDefaultIfNotSet: ACSDKINTERNETCONNECTIONMONITOR_LIB set to acsdkDefaultInternetConnectionMonitor.
-- UseDefaultIfNotSet: ACSDKMETRICRECORDER_LIB set to acsdkNullMetricRecorder.
-- UseDefaultIfNotSet: ACSDKSYSTEMTIMEZONE_LIB set to acsdkNullSystemTimeZone.
-- UseDefaultIfNotSet: ACSDKAPPLICATIONAUDIOPIPELINEFACTORY_LIB set to acsdkGstreamerApplicationAudioPipelineFactory.
-- UseDefaultIfNotSet: ACSDKSPEECHENCODER_LIB set to acsdkNullSpeechEncoder.
No keyword detector type specified, skipping build of keyword detector.
Building with Gstreamer enabled
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find CURL: Found unsuitable version "7.63.0", but required is at
  least "7.67.0" (found /usr/local/lib/libcurl.so)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:391 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindCURL.cmake:143 (find_package_handle_standard_args)
  cmakeBuild/cmake/Curl.cmake:11 (find_package)
  cmakeBuild/BuildDefaults.cmake:21 (include)
  cmakeBuild/BuildDefaults.cmake:56 (include_once)
  CMakeLists.txt:13 (include)


-- Configuring incomplete, errors occurred!

我不明白为什么会这样。我在执行卸载时错过了什么吗,我是否必须更新 /usr/local/lib

下的符号链接

分辨率:

在使用 cmake 构建项目时,我使用 -DCURL_LIBRARY 变量手动提供了最新安装的 curl 库的路径,我是从这里找到的:

https://developer.amazon.com/en-US/docs/alexa/avs-device-sdk/cmake-parameters.html#custom-dependencies

对我来说,它位于 /usr/local/lib/ 目录下,名为 libcurl.so.4.7.0 将此参数添加到 cmake build 命令解决了问题。 -DCURL_LIBRARY=/usr/local/lib/libcurl.so.4.7.0

此外,我使用sudo for 运行 cmake 命令,以便它可以访问一些限制区域进行安装。