-
Notifications
You must be signed in to change notification settings - Fork 603
How to cross compile the AVS Device SDK for iOS
These are step-by-step instructions to cross-compile and build the AVS Device SDK for iOS. If you encounter any errors or have questions, please check our issues list before creating a new issue.
- curl 7.50.2 or greater
- Homebrew
- XCode command line tools
Confirm that these dependencies are installed:
curl --version
brew --version
xcode-select --version
-
Install dependencies:
brew install cmake pkg-config
-
Create a build folder for your project:
cd ~ mkdir cross-compile cd cross-compile
-
Clone CMake for iOS into your build folder:
cd ~/cross-compile git clone https://github.com/leetal/ios-cmake.git
-
Download and cross-compile Google Test:
cd ~/cross-compile git clone https://github.com/google/googletest.git mkdir googletest_build cd googletest_build cmake ../googletest \ -DIOS_DEPLOYMENT_TARGET=10.0 \ -DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake \ -DIOS_PLATFORM=OS \ make
-
Download and cross-compile OpenSSL and curl. For this step, we're going to use an open source script from GitHub. Heads-up, this may take a while:
- Clone the repository:
cd ~/cross-compile git clone https://github.com/jasonacox/Build-OpenSSL-cURL.git cd Build-OpenSSL-cURL/
- Open
build.sh
and change the curl version to 7.55.1 and save.######################################## # EDIT this section to Select Versions # ######################################## OPENSSL="1.0.2l" LIBCURL="7.55.1" NGHTTP2="1.24.0" ########################################
- Run the script:
./build.sh
- Clone the repository:
-
Clone the AVS Device SDK:
cd ~/cross-compile git clone https://github.com/alexa/avs-device-sdk.git cd avs-device-sdk/
-
Replace source code in
/AVSCommon/Utils/src/LibcurlUtils/LibcurlUtils.cpp
if (config.getString(CAPATH_CONFIG_KEY, &caPath) &&
!setopt(handle, CURLOPT_CAPATH, caPath.c_str(), "CURLOPT_CAPATH", caPath.c_str())) {
return false;
}
with this code:
if (config.getString(CAPATH_CONFIG_KEY, &caPath) &&
!setopt(handle, CURLOPT_CAINFO, caPath.c_str(), "CURLOPT_CAINFO", caPath.c_str()) &&
!setopt(handle, CURLOPT_CAPATH, caPath.c_str(), "CURLOPT_CAPATH", caPath.c_str())) {
return false;
}
- The SDK must be run as a STATIC library; make it global in all subfolders:
cd ~/cross-compile/avs-device-sdk/ find . -type f -name '*.txt' -exec sed -i '' s/SHARED/STATIC/ {} +
Build the SDK using the following CMake parameters:
cd ~/cross-compile
mkdir avs_build
cd avs_build
cmake ../avs-device-sdk
-DIOS_DEPLOYMENT_TARGET=10.0 \
-DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake \
-DIOS_PLATFORM=OS \
-DGSTREAMER_MEDIA_PLAYER=OFF \
-DCURL_LIBRARY=../Build-OpenSSL-cURL/archive/libcurl-7.54.1-openssl-1.0.2l-nghttp2-1.24.0/libcurl_iOS.a \
-DCURL_INCLUDE_DIR=../Build-OpenSSL-cURL/curl/curl-7.55.1/include \
-DGTEST_LIBRARY=../googletest_build/googlemock/libgmock.a \
-DGTEST_MAIN_LIBRARY=../googletest_build/googlemock/libgmock_main.a \
-DGTEST_INCLUDE_DIR=../googletest/googletest/include/ \
-DPKG_CONFIG_EXECUTABLE=/usr/local/bin/pkg-config
cd ~/cross-compile
mkdir avs_build_sim
cd avs_build_sim
cmake ../avs-device-sdk
-DIOS_DEPLOYMENT_TARGET=10.0 \
-DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake \
-DIOS_PLATFORM=SIMULATOR64 \
-DGSTREAMER_MEDIA_PLAYER=OFF \
-DCURL_LIBRARY=../Build-OpenSSL-cURL/archive/libcurl-7.54.1-openssl-1.0.2l-nghttp2-1.24.0/libcurl_iOS.a \
-DCURL_INCLUDE_DIR=../Build-OpenSSL-cURL/curl/curl-7.55.1/include \
-DGTEST_LIBRARY=../googletest_build/googlemock/libgmock.a \
-DGTEST_MAIN_LIBRARY=../googletest_build/googlemock/libgmock_main.a \
-DGTEST_INCLUDE_DIR=../googletest/googletest/include/ \
-DPKG_CONFIG_EXECUTABLE=/usr/local/bin/pkg-config
make CBLAuthDelegate
make DefaultClient
make KWD
make PlaylistParser
Make sure that each make command reaches 100%
.
API Reference
Quick-start Guides
- All Quick-start Guides
- For Android
- Cross-compile for iOS
- Generic Linux
- For macOS
- For Raspberry Pi
- For Ubuntu Linux
- For Windows 64-bit
Other Guides + Optimizations
- Authorizing AVS Device SDK Software with AVS
- Build libcurl with mbed TLS and nghttp2
- Build libcurl with nghttp2 for macOS
- Optimize libcurl for Size
- Runtime Configuration for CA Certificates
- Updating the SDK
Development Kits
Resources