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

[CMake] Remove assumptions about LIBDIR and INCLUDEDIR being co-located in AWSSDK #2009

Open
jonringer opened this issue Jul 26, 2022 · 2 comments
Labels
bug This issue is a bug. Cmake Cmake related submissions p3 This is a minor priority issue

Comments

@jonringer
Copy link

jonringer commented Jul 26, 2022

Describe the bug

It's possible that the installation LIBDIR to be in a different directory from INCLUDEDIR.

Currently, the AWSSDK logic assumes that it can traverse up then over to the lib directory.

Expected Behavior

Since a package manager installed aws-sdk-cpp, aws-sdk-cpp should re-use the install(TARGETS information to conclude where to find a package (or at least prefer this method) with find_package(). This should also work with export(TARGETS as well.

Current Behavior

At least for nix, the current behavior is that the find_package(AWSSDK COMPONENTS [components]) ... AWSSDK_LINK_LIBRARIES workflow is largely useless.

Reproduction Steps

This would probably not be worthwhile.

Possible Solution

  • Use find_package(aws-sdk-core) + get_target_property(AWS_CORE_HEADER_DIR aws-sdk-core INCLUDE_DIRECTORIES)
    • Takes into account different installation locations (e.g. /usr/local/ vs /usr/ vs build dir)

Additional Information/Context

Nixpkgs for aws-sdk-cpp installs build dependencies separately from runtime

$ nix-build <nixpkgs> -A aws-sdk-cpp.all
/nix/store/8acky9zc3kldyz0m6728ff4vf24sg3rb-aws-sdk-cpp-1.9.238
/nix/store/34qdbh5bn2wdsm76m9gxqvyfxix65p0j-aws-sdk-cpp-1.9.238-dev

$ ls /nix/store/34qdbh5bn2wdsm76m9gxqvyfxix65p0j-aws-sdk-cpp-1.9.238-dev/include/aws/core/Aws.h
/nix/store/34qdbh5bn2wdsm76m9gxqvyfxix65p0j-aws-sdk-cpp-1.9.238-dev/include/aws/core/Aws.h

$ ls /nix/store/8acky9zc3kldyz0m6728ff4vf24sg3rb-aws-sdk-cpp-1.9.238/lib/libaws-cpp-sdk-core.so
/nix/store/8acky9zc3kldyz0m6728ff4vf24sg3rb-aws-sdk-cpp-1.9.238/lib/libaws-cpp-sdk-core.so

Traversing from the -dev output will set AWS_SDK_ROOT_DIR to something which will not contain the respective library, which breaks the AWSSDK logic.

In practice, this isn't too much of an issue as find_package(<pkg>) will find the corresponding <pkg>-targets.cmake, which will correctly reflect the passed CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR values for the build. But it does mean that the QoL features of AWSSDK are largely unusable on packaging tools which don't assume FHS (or similar unification of dependencies).

AWS CPP SDK version used

1.9.238

Compiler and Version used

gcc 11

Operating System and version

NixOS 22.11pre393074.614a842b74b (unstable)

@jonringer jonringer added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 26, 2022
@jonringer
Copy link
Author

jonringer commented Jul 27, 2022

This relates to #1888, although likely out-of-scope; as it looks like there is lower hanging fruit which would impact people more outside of this "niche" use case.

@jmklix jmklix self-assigned this Aug 1, 2022
@jmklix jmklix added needs-review This issue or pull request needs review from a core team member. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Nov 4, 2022
@jmklix
Copy link
Member

jmklix commented Nov 4, 2022

Thanks for the suggestion. I will bring this up to see if we want to include this in our build improvements

@yasminetalby yasminetalby added the Cmake Cmake related submissions label Sep 20, 2023
@jmklix jmklix removed their assignment Jan 12, 2024
@jmklix jmklix removed the needs-review This issue or pull request needs review from a core team member. label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. Cmake Cmake related submissions p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

3 participants