aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

missing debug support when CMAKE_DEBUG_POSTFIX is used in AWSSDKConfig.cmake

Open mnistor1 opened this issue 2 years ago • 9 comments

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug A clear and concise description of what the bug is.

The CMAKE_DEBUG_POSTFIX debug property was not taken into account in AWSSDKConfig.cmake when the find_library is used.

The solution to fix this problem is below: diff --git a/cmake/AWSSDKConfig.cmake b/cmake/AWSSDKConfig.cmake index 5147335ddc..9ff3a413de 100644 --- a/cmake/AWSSDKConfig.cmake +++ b/cmake/AWSSDKConfig.cmake @@ -110,7 +110,7 @@ if (NOT AWSSDK_ROOT_DIR) endif()

-find_library(AWSSDK_CORE_LIB_FILE aws-cpp-sdk-core +find_library(AWSSDK_CORE_LIB_FILE aws-cpp-sdk-core${CMAKE_DEBUG_POSTFIX} "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}" "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}/Debug" "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}/DebugOpt"

SDK version number tag: 1.9.165

Platform/OS/Hardware/Device What are you running the sdk on? It was compiled on Ubuntu 18.04 host for aarch64 target. it was used cross compilation gcc compiler.

To Reproduce (observed behavior) Steps to reproduce the behavior (please share code)

Expected behavior A clear and concise description of what you expected to happen.

Logs/output If applicable, add logs or error output.

CMake Warning at /opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib/cmake/AWSSDK/AWSSDKConfig.cmake:112 (message):

AWSSDK_CORE_LIB_FILE-NOTFOUND/opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib//opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib//Debug/opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib//DebugOpt/opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib//Release/opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib//RelWithDebInfo/opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib//MinSizeRel Call Stack (most recent call first): CMakeLists.txt:6 (find_package)

CMake Error at /opt/work/devbb/bbsdk/install_dir/lx2-aarch64-linux/opt/bluebox/lib/cmake/AWSSDK/AWSSDKConfig.cmake:131 (message): AWS SDK for C++ headers found, but we were unable to locate the binaries. Have you deleted or moved it?

          Please make sure header files and binaries are located in INSTALL_ROOT_DIR/INCLUDE_DIR/ and INSTALL_ROOT_DIR/LIB_DIR/[PLATFORM_PREFIX]/[Debug|Config|OtherConfigs]

Call Stack (most recent call first): CMakeLists.txt:6 (find_package)

-- Configuring incomplete, errors occurred!

To enable logging, set the following system properties:

REMEMBER TO SANITIZE YOUR PERSONAL INFO

options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
Aws::InitAPI(options)

Additional context Add any other context about the problem here.

mnistor1 avatar Dec 22 '21 18:12 mnistor1

Hi @mnistor1 , Could you explain a bit on how you came across this error? From the description it sounds like you just built for debug and got it but that's not reproducible on my side so I'm wondering what else is happening for you to get this error. Can you walk me through what steps you took to build (or maybe link?) the sdk ?

KaibaLopez avatar Dec 22 '21 22:12 KaibaLopez

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Dec 25 '21 00:12 github-actions[bot]

Hello @KaibaLopez,

You can reproduce it very easily if you set the CMAKE_DEBUG_POSTFIX when you build the aws sdk.

The commands are below: cd <BUILD_DIR> cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEBUG_POSTFIX=”-d” -DCMAKE_PREFIX_PATH= make make install

You can noticed that all libraries have the included -d in the name of library.

The error appears when you want to use one of aws sdk libraries by using find_package. E.G. find_package(AWSSDK REQUIRED COMPONENTS core)

BTW: A similar problem can appear it you set CMAKE_RELEASE_POSTFIX, CMAKE_RELWITHDEBINFO_POSTFIX or CMAKE_MINSIZEREL_POSTFIX

You can see the patch that solves the problem. diff --git a/cmake/AWSSDKConfig.cmake b/cmake/AWSSDKConfig.cmake index 5147335dd..8db262d51 100644 --- a/cmake/AWSSDKConfig.cmake +++ b/cmake/AWSSDKConfig.cmake @@ -109,8 +109,17 @@ if (NOT AWSSDK_ROOT_DIR) message(FATAL_ERROR "AWSSDK_ROOT_DIR is not set or can't be calculated from the path of core header file") endif()

-find_library(AWSSDK_CORE_LIB_FILE aws-cpp-sdk-core +set(_aws_lib_sufix "") +if (CMAKE_BUILD_TYPE MATCHES Release)

  • set(_aws_lib_sufix ${CMAKE_RELEASE_POSTFIX}) +elseif (CMAKE_BUILD_TYPE MATCHES Debug)
  • set(_aws_lib_sufix ${CMAKE_DEBUG_POSTFIX}) +elseif (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
  • set(_aws_lib_sufix ${CMAKE_RELWITHDEBINFO_POSTFIX}) +elseif (CMAKE_BUILD_TYPE MATCHES MinSizeRel)
  • set(_aws_lib_sufix ${CMAKE_MINSIZEREL_POSTFIX}) +endif() +find_library(AWSSDK_CORE_LIB_FILE aws-cpp-sdk-core${_aws_lib_sufix} "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}" "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}/Debug" "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}/DebugOpt

mnistor1 avatar Dec 26 '21 20:12 mnistor1

Greetings! Sorry to say but this is a very old issue that is probably not getting as much attention as it deservers. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one.

github-actions[bot] avatar Dec 27 '22 00:12 github-actions[bot]

Hello,

The problem is not yet resolved. Please don't close this ticket!

mnistor1 avatar Dec 27 '22 08:12 mnistor1

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Dec 27 '22 08:12 github-actions[bot]

The problem is not yet resolved. Please don't close this ticket!

mnistor1 avatar Dec 27 '22 08:12 mnistor1

https://github.com/aws/aws-sdk-cpp/issues/1888

jmklix avatar Dec 28 '22 00:12 jmklix

I just ran into this issue when building with ExternalProject_Add and using CMAKE_CACHE_ARGS -DCMAKE_DEBUG_POSTFIX:STRING=d

I believe the fix (as described above) is just

-find_library(AWSSDK_CORE_LIB_FILE aws-cpp-sdk-core
+find_library(AWSSDK_CORE_LIB_FILE aws-cpp-sdk-core${CMAKE_DEBUG_POSTFIX}
         "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}"
         "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}/Debug"
         "${AWSSDK_ROOT_DIR}/${AWSSDK_INSTALL_LIBDIR}/${AWSSDK_PLATFORM_PREFIX}/DebugOpt"
         ...

I can test this locally and make a simple PR if that would be helpful linking this issue

pr0g avatar Oct 15 '23 19:10 pr0g