From d849f8319431cfd627f39108632c4d7f48e50110 Mon Sep 17 00:00:00 2001 From: Sanjay Devireddy Date: Wed, 12 Apr 2017 16:19:34 -0700 Subject: [PATCH] =?UTF-8?q?Some=20machines=20are=20having=20trouble=20comp?= =?UTF-8?q?iling=20our=20SDK,=20particularly=20libAVSUtils.so.=20The=20iss?= =?UTF-8?q?ue=20seems=20to=20be=20that=20the=20linker=20is=20encountering?= =?UTF-8?q?=20an=20error=20finding=20a=20reference=20to=20=E2=80=9Cpthread?= =?UTF-8?q?=5Fcreate=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AVSUtils/src/Logger/ThreadIdAsString.cpp, has a static thread_local variable and includes , 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 so that we don’t run into this issue down the road by mistake. --- ADSL/src/CMakeLists.txt | 2 ++ AVSCommon/test/CMakeLists.txt | 5 ++++- AVSUtils/src/CMakeLists.txt | 3 ++- AVSUtils/test/CMakeLists.txt | 6 +++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ADSL/src/CMakeLists.txt b/ADSL/src/CMakeLists.txt index d4fc2ea7..68dff07b 100644 --- a/ADSL/src/CMakeLists.txt +++ b/ADSL/src/CMakeLists.txt @@ -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) diff --git a/AVSCommon/test/CMakeLists.txt b/AVSCommon/test/CMakeLists.txt index 0ff5e3a3..2614f85b 100644 --- a/AVSCommon/test/CMakeLists.txt +++ b/AVSCommon/test/CMakeLists.txt @@ -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}") diff --git a/AVSUtils/src/CMakeLists.txt b/AVSUtils/src/CMakeLists.txt index 09900ba3..0b78bf11 100644 --- a/AVSUtils/src/CMakeLists.txt +++ b/AVSUtils/src/CMakeLists.txt @@ -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}) diff --git a/AVSUtils/test/CMakeLists.txt b/AVSUtils/test/CMakeLists.txt index 963c6848..15ed9646 100644 --- a/AVSUtils/test/CMakeLists.txt +++ b/AVSUtils/test/CMakeLists.txt @@ -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}")