Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error #1676

Closed
2 tasks done
disa6302 opened this issue Jun 10, 2021 · 6 comments
Closed
2 tasks done

Linking error #1676

disa6302 opened this issue Jun 10, 2021 · 6 comments
Assignees
Labels
closed-for-staleness guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@disa6302
Copy link

disa6302 commented Jun 10, 2021

Confirm by changing [ ] to [x] below:

Platform/OS/Hardware/Device
What are you running the sdk on? MacOS Mojave

Describe the question

I am adding this SDK as an external project and using monitoring and logs. It was working fine in the past, but not sure why I get a linking error now. I am using v1.8.17. I checked previous issues, however, did not get a resolution.

Logs/output

Undefined symbols for architecture x86_64:
  "_curl_easy_cleanup", referenced from:
      Aws::Http::CurlHandleContainer::~CurlHandleContainer() in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)

     Aws::Http::CurlHandleContainer::DestroyCurlHandle(void*) in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)
  "_curl_easy_getinfo", referenced from:
      Aws::Http::CurlHttpClient::MakeRequest(std::__1::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
  "_curl_easy_init", referenced from:
      Aws::Http::CurlHandleContainer::CheckAndGrowPool() in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)
  "_curl_easy_perform", referenced from:
      Aws::Http::CurlHttpClient::MakeRequest(std::__1::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
  "_curl_easy_reset", referenced from:
      Aws::Http::CurlHandleContainer::ReleaseCurlHandle(void*) in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)
  "_curl_easy_setopt", referenced from:
      SetOptCodeForHttpMethod(void*, std::__1::shared_ptr<Aws::Http::HttpRequest> const&) in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
      Aws::Http::CurlHttpClient::MakeRequest(std::__1::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
      Aws::Http::CurlHandleContainer::SetDefaultOptionsOnHandle(void*) in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)
  "_curl_easy_strerror", referenced from:
      Aws::Http::CurlHttpClient::MakeRequest(std::__1::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
  "_curl_global_cleanup", referenced from:
      Aws::Http::CurlHttpClient::CleanupGlobalState() in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
  "_curl_global_init", referenced from:
      Aws::Http::CurlHttpClient::InitGlobalState() in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
  "_curl_slist_append", referenced from:
      Aws::Http::CurlHttpClient::MakeRequest(std::__1::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
  "_curl_slist_free_all", referenced from:
      Aws::Http::CurlHttpClient::MakeRequest(std::__1::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
  "_curl_version_info", referenced from:
      Aws::Http::CurlHttpClient::InitGlobalState() in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@disa6302 disa6302 added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Jun 10, 2021
@disa6302
Copy link
Author

disa6302 commented Jun 10, 2021

This is my external project file:

cmake_minimum_required(VERSION 3.10.2)
project(libawscpp-download NONE)
include(ExternalProject)

ExternalProject_Add(libawscpp-download
    GIT_REPOSITORY    https://github.com/aws/aws-sdk-cpp.git
    GIT_TAG           1.8.17
    PREFIX            ${CMAKE_CURRENT_BINARY_DIR}/build
    LIST_SEPARATOR 	  "|"
    CMAKE_ARGS		-DCUSTOM_MEMORY_MANAGEMENT=OFF 
                    -DENABLE_TESTING=OFF 
                    -DAUTORUN_UNIT_TESTS=OFF 
                    -DBUILD_DEPS=ON 
                    -DBUILD_SHARED_LIBS=OFF 
                    -DBUILD_ONLY=monitoring|logs
                    -DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
    BUILD_ALWAYS      0
    TEST_COMMAND      ""
)

This is how I am including in my main CMakeLists.txt file:

find_package(AWSSDK REQUIRED COMPONENTS monitoring logs)
target_link_libraries(lib ${AWSSDK_LINK_LIBRARIES} 

@KaibaLopez
Copy link
Contributor

@disa6302 ,
Hmmm... can't really reproduce the issue... Though it is hard to say if it is all being correctly linked seeing the CMakeLists separate like that...
couple things, first, make sure you've cleaned previous builds from DCMAKE_INSTALL_PREFIX location and try building the SDK manually and then doing the linking, just to make sure it's not the external project part that is failing.
Second, can you tell me more about the project? Specifically I'd like to know what the structure is like so I can try and reproduce this.

@KaibaLopez KaibaLopez added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 10, 2021
@KaibaLopez KaibaLopez self-assigned this Jun 10, 2021
@disa6302
Copy link
Author

@KaibaLopez ,

I removed the libraries from DCMAKE_INSTALL_PREFIX location and performed a clean build. This is my folder structure:

main-repo
-> CMakeLists.txt
-> CMake
->Dependencies
-> libcppsdk-CMakeLists.txt

To know more about the project, you can check this folder in the repo.

I can try building the SDK manually, but wondering how I can link it with the SDK built separately. This is a recent issue and I have not been seeing this in the past and nothing changed. So a little puzzled.

Can you suggest a way for me to find how the libraries are linked?

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Jun 12, 2021
@KaibaLopez
Copy link
Contributor

Hi @disa6302 ,
so the my first thought would be that the libraries are not being found because they are not being properly built/installed, that's why I would suggest you build it manually first, in theory :

find_package(AWSSDK REQUIRED COMPONENTS monitoring logs)
target_link_libraries(lib ${AWSSDK_LINK_LIBRARIES} 

should be enough to link the SDK to your project if it has been built and installed.

@KaibaLopez KaibaLopez added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Jun 15, 2021
@github-actions
Copy link

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 github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 23, 2021
@pr0g
Copy link
Contributor

pr0g commented Nov 5, 2023

I stumbled across this issue and I believe it's related to #2717 (not being able to link Curl against aws-sdk-cpp). This simple change (12b0905) got it working for me, but it's just a quick fix and not integrated properly with all possible platforms/configurations. YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

No branches or pull requests

3 participants