alexa / avs-device-sdk

An SDK for commercial device makers to integrate Alexa directly into connected products.
https://developer.amazon.com/alexa/alexa-voice-service
Apache License 2.0
1.26k stars 602 forks source link

clang++: error: linker command failed with exit code 1 (use -v to see invocation) #874

Closed pkalebu closed 5 years ago

pkalebu commented 6 years ago

I already build AVS for Android and also build Kitt-AI and tested out their demo app on my Android arm64-v8a device. I'm now trying to build AVS with Kitt-AI so that I can have hotword detection for AVS. I keep getting an error related to a failure to link, citing undefined references to snowboy.

What is the expected behavior?

I expect the build to successfully complete at 100%

What behavior are you observing?

I get an error at around 66%. The VERBOSE output is as follows:

[ 66%] Building CXX object Integration/src/CMakeFiles/Integration.dir/ClientMessageHandler.cpp.o
cd /Users/pkalebu/android_workplace/Integration/src && /Users/pkalebu/Library/Android/sdk/ndk-bundle/android-ndk-r16/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/Users/pkalebu/Library/Android/sdk/ndk-bundle/android-ndk-r16/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/pkalebu/Library/Android/sdk/ndk-bundle/android-ndk-r16/sysroot  -DACSDK_LOG_MODULE=integration -DKWD -DKWD_KITTAI -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ThirdParty/googletest-release-1.8.0/googlemock/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ThirdParty/googletest-release-1.8.0/googletest/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ACL/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/Authorization/CBLAuthDelegate/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ContextManager/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/Integration/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/CapabilityAgents/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/CapabilityAgents/AIP/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/CapabilityAgents/SpeechSynthesizer/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/CapabilityAgents/Alerts/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/CapabilityAgents/AudioPlayer/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/CapabilityAgents/System/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/RegistrationManager/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/Storage/SQLiteStorage/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ThirdParty/MultipartParser -I/Users/pkalebu/android_workplace/BUILD/android-23/armeabi-v7a/install/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ACL/src -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/AVSCommon/AVS/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/AVSCommon/SDKInterfaces/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/AVSCommon/Utils/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ThirdParty/rapidjson/rapidjson-1.1.0/include -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/Storage/SQLiteStorage/src -I/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/ContextManager/src -isystem /Users/pkalebu/Library/Android/sdk/ndk-bundle/android-ndk-r16/sources/cxx-stl/llvm-libc++/include -isystem /Users/pkalebu/Library/Android/sdk/ndk-bundle/android-ndk-r16/sources/android/support/include -isystem /Users/pkalebu/Library/Android/sdk/ndk-bundle/android-ndk-r16/sources/cxx-stl/llvm-libc++abi/include  -isystem /Users/pkalebu/Library/Android/sdk/ndk-bundle/android-ndk-r16/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=23 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -frtti -fexceptions  -DDEBUG -DACSDK_DEBUG_LOG_ENABLED -Wall -Werror -Wsign-compare -g -DRAPIDJSON_HAS_STDSTRING -fPIC   -std=c++11 -o CMakeFiles/Integration.dir/ClientMessageHandler.cpp.o -c /Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/Integration/src/ClientMessageHandler.cpp
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:135: error: undefined reference to 'snowboy::SnowboyDetect::SetSensitivity(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:136: error: undefined reference to 'snowboy::SnowboyDetect::SetAudioGain(float)'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:137: error: undefined reference to 'snowboy::SnowboyDetect::ApplyFrontend(bool)'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/AVSCommon/Utils/include/AVSCommon/Utils/Memory/Memory.h:35: error: undefined reference to 'snowboy::SnowboyDetect::SnowboyDetect(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:155: error: undefined reference to 'snowboy::SnowboyDetect::NumChannels() const'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:156: error: undefined reference to 'snowboy::SnowboyDetect::NumChannels() const'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:162: error: undefined reference to 'snowboy::SnowboyDetect::SampleRate() const'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:163: error: undefined reference to 'snowboy::SnowboyDetect::SampleRate() const'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:169: error: undefined reference to 'snowboy::SnowboyDetect::BitsPerSample() const'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:170: error: undefined reference to 'snowboy::SnowboyDetect::BitsPerSample() const'
/Users/pkalebu/android_workplace/Libraries/Amazon/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp:206: error: undefined reference to 'snowboy::SnowboyDetect::RunDetection(short const*, int, bool)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [KWD/KittAi/src/libKITTAI.so] Error 1
make[2]: Leaving directory `/Users/pkalebu/android_workplace'
make[1]: *** [KWD/KittAi/src/CMakeFiles/KITTAI.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 67%] Building CXX object CapabilityAgents/AIP/src/CMakeFiles/AIP.dir/ESPData.cpp.o

Provide the steps to reproduce the issue, if applicable:

To configure the build, I run the following command:

${ANDROID_HOME}/cmake/3.6.4111459/bin/cmake -DANDROID_ABI=armeabi-v7a -DANDROID_ALLOW_UNDEFINED_SYMBOLS=FALSE -DANDROID_ARM_MODE=thumb -DANDROID_ARM_NEON=FALSE -DANDROID_CPP_FEATURES="rtti exceptions" -DANDROID_DISABLE_FORMAT_STRING_CHECKS=FALSE -DANDROID_DISABLE_NO_EXECUTE=FALSE -DANDROID_DISABLE_RELRO=FALSE -DANDROID_PIE=ON -DANDROID_PLATFORM=android-23 -DANDROID_STL=c++_shared -DANDROID_TOOLCHAIN=clang -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_CROSSCOMPILING=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_TARGET} -DCMAKE_PREFIX_PATH:PATH=${INSTALL_TARGET} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DCURL_INCLUDE_DIR=${INSTALL_TARGET}/include -DCURL_LIBRARY=${INSTALL_TARGET}/lib/libcurl.so -DKITTAI_KEY_WORD_DETECTOR=ON -DKITTAI_KEY_WORD_DETECTOR_LIB_PATH=~/android_workplace/Libraries/ThirdParty/snowboy/lib/android/armv8-aarch64/libsnowboy-detect.a -DKITTAI_KEY_WORD_DETECTOR_INCLUDE_DIR=~/android_workplace/Libraries/ThirdParty/snowboy/include/ ~/android_workplace/Libraries/Amazon/avs-device-sdk

I then run make all -j 4.

What version of the AVS Device SDK are you using?

I'm using v1.8.1 of the SDK

Tell us what hardware you're using:

Tell us about your OS (Type & version):

celinval commented 6 years ago

Hi @pkalebu,

I noticed that you are linking the SDK with the armv8 KittAI library; however, you are using armv7 to build the SDK. Can you please try to use the armv7a KittAI library instead?

Thanks, Celina

pkalebu commented 6 years ago

@celinval I'll give it a shot, thanks! Would you happen to know how I can go about using armv8 to build the SDK?

celinval commented 6 years ago

Can you try to using -DANDROID_ABI=arm64-v8a instead?

pkalebu commented 6 years ago

I tried. Not as straightforward as I'd hoped. I'm hoping Amazon comes out with an updated guide for armv8 Androids

On Thu, Jul 26, 2018 at 3:47 PM Celina G. Val notifications@github.com wrote:

Can you try to using -DANDROID_ABI=arm64-v8a instead?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alexa/avs-device-sdk/issues/874#issuecomment-408258244, or mute the thread https://github.com/notifications/unsubscribe-auth/ADczKVk5MwbP_DCI4ZThSNwSVwPmzKB8ks5uKkb0gaJpZM4VgibH .

kjkh commented 5 years ago

Hi @pkalebu,

Alternatively, I see that KittAI has armv7a versions of the libraries as well. You can try linking against those after building the SDK with the armv7a toolchain as you originally did.

kclchan commented 5 years ago

I am closing this issue due to inactivity. Please feel free to re-open it if it has been closed in error.