curlcmakeubuntu-20.04alexa-voice-service

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


Situation

I am setting up AVS SDK on my Ubuntu 20.04 machine. I am following this guide: https://developer.amazon.com/en-US/docs/alexa/avs-device-sdk/ubuntu.html

I executed every command in order, and everything went smoothly untill I started building dependencies for the SDK sample app.

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

I got the error:

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

From the statement above I figured it out that I have two versions of CURL installed on same system which was causing this error, One that I installed earlier using:

sudo apt install curl

And another one which I installed while installing dependencies for SDK (version used in guide is outdated as of 20 June,2021): These were the commands.

 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

Measures taken

First I uninstalled both versions of curl from my device.

Apt one by

sudo apt remove curl 
sudo apt purge curl

Manual one by going to the install folder of curl and running

sudo make uninstall

Then I installed latest version from curl: repeating the steps above but replaced the 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

After all the steps taken Now I am getting this error:

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

Full error statement:

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!

I couldn't figure it out why is this happening. Have I missed something while performing uninstall, Do I have to update the symlinks under /usr/local/lib


Solution

  • Resolution:

    While building the project using cmake, I provided the path to the latest installed curl library manually using -DCURL_LIBRARY variable, about which I found out from here:

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

    For me it was living under /usr/local/lib/ directory, named libcurl.so.4.7.0 Adding this parameter to cmake build command solved the problem. -DCURL_LIBRARY=/usr/local/lib/libcurl.so.4.7.0

    Also, I used sudo for running cmake command, so that it can access some restricted zones for the installation.