Some machines are having trouble compiling our SDK, particularly libAVSUtils.so. The issue seems to be that the linker is encountering an error finding a reference to “pthread_create”.

AVSUtils/src/Logger/ThreadIdAsString.cpp, has a static thread_local variable and includes <thread>, and since this file is used indirectly from the ExampleLogger, this issue is showing up as an issue in ExampleLogger.

Currently, ACL and AuthDelegate both find the Threads package and link against in their src/CMakeLists.txt file, so we don't see such issues when creating those libraries. However, AVSUtils does not do this. The fix for this particular issue (https://github.com/alexa/alexa-client-sdk/issues/3) is to find the Threads package and link against it in the AVSUtils library as well, which this commit does. This commit also pulls in the Threads package and links against it in other areas that include <thread> so that we don’t run into this issue down the road by mistake.
This commit is contained in:
Sanjay Devireddy 2017-04-12 16:19:34 -07:00
parent 04446f0f61
commit d849f83194
4 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
find_package(Threads ${THREADS_PACKAGE_CONFIG})
add_library(ADSL SHARED
DirectiveRouter.cpp
DirectiveSequencer.cpp
@ -9,5 +10,6 @@ target_include_directories(ADSL PUBLIC
"${ADSL_SOURCE_DIR}/include"
"${AVSCommon_INCLUDE_DIRS}")
target_link_libraries(ADSL
${CMAKE_THREAD_LIBS_INIT}
AVSCommon
AVSUtils)

View File

@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.0)
find_package(Threads ${THREADS_PACKAGE_CONFIG})
set(INCLUDES "${AVSCommon_SOURCE_DIR}/include" "${AVSUtils_SOURCE_DIR}/include" "${ACL_SOURCE_DIR}/ACL/include"
"${ACL_SOURCE_DIR}/test" "${RAPIDJSON_INCLUDE_DIR}")
discover_unit_tests("${INCLUDES}" AVSCommon)
set(LIBRARIES AVSCommon ${CMAKE_THREAD_LIBS_INIT})
discover_unit_tests("${INCLUDES}" "${LIBRARIES}")

View File

@ -1,6 +1,7 @@
find_package(CURL ${CURL_PACKAGE_CONFIG})
find_package(Threads ${THREADS_PACKAGE_CONFIG})
file(GLOB_RECURSE AVSUtils_SRC "${AVSUtils_SOURCE_DIR}/src/*.cpp")
add_library(AVSUtils SHARED ${AVSUtils_SRC})
target_include_directories(AVSUtils PUBLIC ${CURL_INCLUDE_DIRS} "${AVSUtils_SOURCE_DIR}/include")
target_link_libraries(AVSUtils ${CURL_LIBRARIES})
target_link_libraries(AVSUtils ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

View File

@ -1 +1,5 @@
discover_unit_tests("${AVSUtils_SOURCE_DIR}/include" AVSUtils)
find_package(Threads ${THREADS_PACKAGE_CONFIG})
set(LIBRARIES AVSUtils ${CMAKE_THREAD_LIBS_INIT})
discover_unit_tests("${AVSUtils_SOURCE_DIR}/include" "${LIBRARIES}")