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

add aws-cdi-sdk 2.2.0 #7407

Merged
merged 12 commits into from
Mar 15, 2022
Merged

add aws-cdi-sdk 2.2.0 #7407

merged 12 commits into from
Mar 15, 2022

Conversation

dvirtz
Copy link
Contributor

@dvirtz dvirtz commented Sep 24, 2021

Specify library name and version: aws-cdi-sdk/2.2.0


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@dvirtz
Copy link
Contributor Author

dvirtz commented Sep 25, 2021

@jgsogo @SSE4 @madebr
This package requires a non-default option (monitoring) of aws-sdk-cpp and thus fails to find a prebuilt binary.
Should I open a PR to change that default value to match this package?

@SSE4
Copy link
Contributor

SSE4 commented Sep 26, 2021

@jgsogo @SSE4 @madebr
This package requires a non-default option (monitoring) of aws-sdk-cpp and thus fails to find a prebuilt binary.
Should I open a PR to change that default value to match this package?

I think so, if there is no other way, let's try to change the defaults of aws-sdk-cpp

@SSE4 SSE4 added the blocked Affected by an external issue and waiting until it is solved label Sep 26, 2021
@dvirtz dvirtz mentioned this pull request Sep 26, 2021
4 tasks
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@dvirtz
Copy link
Contributor Author

dvirtz commented Sep 30, 2021

@SSE4 this is not blocked any more

@SSE4 SSE4 removed the blocked Affected by an external issue and waiting until it is solved label Sep 30, 2021
Comment on lines 28 to 30
self.options["aws-sdk-cpp"].monitoring = True
self.options["aws-sdk-cpp"].shared = True
self.options["aws-libfabric"].shared = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be overridden by consumers so if these are requirements then they should be moved to a validate method

# build aws-cpp-sdk-cdi
cmake = self._configure_cmake()
cmake.build()
cmake.install()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called in the package method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see below

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing install in build breaks the following use case:

conan create . aws-cdi-sdk/2.2.0@
conan create . aws-cdi-sdk/2.2.0@ -kb

So you need to pass a CMAKE_INSTALL_PREFIX variable to cmake and add the --prefix= argument to autotools.

Comment on lines 68 to 71
autotools = self._configure_autotools()
with tools.chdir(self._source_subfolder):
vars = autotools.vars
# configure autotools to find aws-cpp-sdk-cdi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why this is required? I do not understand why it's being build twice 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package contains two components:

  • a AWS SDK plugin under the aws-cpp-sdk-cdi subfolder which is built with cmake
  • the library itself which is built with make

The library depends on the plugin and that's why I need to install it here and tell the library where to find it


def validate(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("The aws-cdi-sdk con only be built on Linux.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows could be supported. https://github.com/aws/aws-cdi-sdk/blob/mainline/INSTALL_GUIDE_WINDOWS.md#build-the-aws-cdi-sdk

Suggested change
raise ConanInvalidConfiguration("The aws-cdi-sdk con only be built on Linux.")
raise ConanInvalidConfiguration("This recipe currently only supports Linux. Feel free to contribute other platforms!")

Comment on lines 116 to 118
-# Ensure that the location of the AWS SDK source code tree was specified unless explicitly opted out. Define and augment
-# some variables needed for building and linking to the AWS SDK.
-ifeq ($(require_aws_sdk),yes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem required to build the library 🤔 can you explain what this patch is for please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original package builds libfabric and the AWS SDK itself and here I remove that part

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can reduce the patch size by surrounding the disabled parts with e.g. ifeq('1','0') and endif.
See https://www.gnu.org/software/make/manual/html_node/Conditionals.html#Conditionals

It makes porting the patch to newer releases easier, I think.

if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["CPP_STANDARD"] = self._cmake.definitions.get("CONAN_CMAKE_CXX_STANDARD", "11")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected this to come from the users profile/settings

Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent start!

I'd love to point you to our docs, https://github.com/conan-io/conan-center-index/blob/master/docs/how_to_add_packages.md#cmake for some examples

also #3951 which is not official but a great summary of what we've been following...
I fear your patches might be too large for us to accept since they will be very difficult to maintain

@conan-center-bot

This comment has been minimized.

@dvirtz
Copy link
Contributor Author

dvirtz commented Oct 1, 2021

The way the original package is built is by downloading the AWS SDK, copying the aws-cpp-sdk-cdi under it and build the SDK together with the aws-cpp-sdk-cdi part.
To make it work with the conan AWS SDK I had to copy some files from AWS SDK to be able to build aws-cpp-sdk-cdi standalone.
That's the reason for the large patches.

tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))

def package_info(self):
self.cpp_info.libs = self.collect_libs()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the logs I only saw one lib being build/installed

Suggested change
self.cpp_info.libs = self.collect_libs()
self.cpp_info.libs = ["aws-cpp-sdk-cdi"]

recipes/aws-cdi-sdk/all/conanfile.py Show resolved Hide resolved
self.cpp_info.libs = self.collect_libs()
if self.settings.os == "Linux":
self.cpp_info.defines = ["_LINUX"]
self.cpp_info.requires = ["aws-sdk-cpp::monitoring", "aws-libfabric::aws-libfabric"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--- a/aws-cpp-sdk-cdi/CMakeLists.txt
+++ b/aws-cpp-sdk-cdi/CMakeLists.txt
@@ -1,4 +1,39 @@
-add_project(aws-cpp-sdk-cdi "C++ SDK for the AWS cdi service" aws-cpp-sdk-core)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the find_package could be called from the wrapper?

recipes/aws-cdi-sdk/all/test_package/CMakeLists.txt Outdated Show resolved Hide resolved
recipes/aws-cdi-sdk/all/conanfile.py Show resolved Hide resolved
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

SSE4
SSE4 previously approved these changes Feb 21, 2022
prince-chrismc
prince-chrismc previously approved these changes Feb 25, 2022
Comment on lines 19 to 22
default_options = {
"aws-libfabric:shared": True,
"aws-sdk-cpp:shared": True
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do that. Force these values in configure(), then check in validate().

Comment on lines 111 to 119
cppSdk.set_property("cmake_file_name", "aws-cpp-sdk-cdi")
cppSdk.set_property("cmake_target_name", "aws-cpp-sdk-cdi")
cppSdk.set_property("pkg_config_name", "aws-cpp-sdk-cdi")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
# TODO: Remove the namespace on CMake targets
cppSdk.names["cmake_find_package"] = "aws-cpp-sdk-cdi"
cppSdk.names["cmake_find_package_multi"] = "aws-cpp-sdk-cdi"
cppSdk.names["pkg_config"] = "aws-cpp-sdk-cdi"
Copy link
Contributor

@SpaceIm SpaceIm Feb 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not consistent. CMakeDeps provides aws-cpp-sdk-cdi imported target, and cmake_find_package* aws-cdi-sdk::aws-cpp-sdk-cdi.
What is the correct imported target upstream?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set both to be AWS::aws-cpp-sdk-cdi similar to the aws-sdk-cpp package.
I couldn't anything existing practice upstream.

Copy link
Contributor

@SpaceIm SpaceIm Feb 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't know how to deduce imported targets from upstream CMakeLists (not always obvious), you can inspect packaged files locally:

  • comment out the deletion of cmake files during packaging.
  • inspect lib/cmake/aws-cpp-sdk-cdi/aws-cpp-sdk-cdi-targets.cmake in package folder and grep add_library to see imported targets names, and therefore deduce cmake_target_name of each component.

From what I can see in build log, cmake_file_name is aws-cpp-sdk-cdi:

-- Installing: /home/conan/w/BuildSingleReference/.conan/data/aws-cdi-sdk/2.2.0/_/_/package/7e1489d0a9b824ecd6e0f2c6473d3bdf325c0375/lib/cmake/aws-cpp-sdk-cdi/aws-cpp-sdk-cdi-targets.cmake
-- Installing: /home/conan/w/BuildSingleReference/.conan/data/aws-cdi-sdk/2.2.0/_/_/package/7e1489d0a9b824ecd6e0f2c6473d3bdf325c0375/lib/cmake/aws-cpp-sdk-cdi/aws-cpp-sdk-cdi-targets-release.cmake
-- Installing: /home/conan/w/BuildSingleReference/.conan/data/aws-cdi-sdk/2.2.0/_/_/package/7e1489d0a9b824ecd6e0f2c6473d3bdf325c0375/lib/cmake/aws-cpp-sdk-cdi/aws-cpp-sdk-cdi-config.cmake
-- Installing: /home/conan/w/BuildSingleReference/.conan/data/aws-cdi-sdk/2.2.0/_/_/package/7e1489d0a9b824ecd6e0f2c6473d3bdf325c0375/lib/cmake/aws-cpp-sdk-cdi/aws-cpp-sdk-cdi-config-version.cmake

And by the way, I forgot to say that cmake_file_name property at component level doesn't make sense for conan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comment. aws-cpp-sdk-cdi is the C++ component. The main C component is named aws-cdi-sdk and doesn't have upstream cmake files installed.
I've removed file name properties from components but I don't see any other problem with the current package info. I'd be glad if you can suggest what is the correct info in your opinion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Very confusing build system: why do they mix CMakeLists to build aws-cpp-sdk-cdi & raw Makefile to build aws-cdi-sdk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess different people worked on each component

Comment on lines 127 to 135
cSdk.set_property("cmake_file_name", "aws-cdi-sdk")
cSdk.set_property("cmake_target_name", "aws-cdi-sdk")
cSdk.set_property("pkg_config_name", "aws-cdi-sdk")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
# TODO: Remove the namespace on CMake targets
cSdk.names["cmake_find_package"] = "aws-cdi-sdk"
cSdk.names["cmake_find_package_multi"] = "aws-cdi-sdk"
cSdk.names["pkg_config"] = "aws-cdi-sdk"
Copy link
Contributor

@SpaceIm SpaceIm Feb 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment than #7407 (comment)

@dvirtz dvirtz dismissed stale reviews from prince-chrismc and SSE4 via ea12bd8 February 28, 2022 20:19
@conan-center-bot

This comment has been minimized.

prince-chrismc
prince-chrismc previously approved these changes Mar 2, 2022
Comment on lines 106 to 141
self.cpp_info.names["cmake_find_package"] = "AWS"
self.cpp_info.names["cmake_find_package_multi"] = "AWS"
self.cpp_info.filenames["cmake_find_package"] = "aws-cdi-sdk"
self.cpp_info.filenames["cmake_find_package_multi"] = "aws-cdi-sdk"

cppSdk = self.cpp_info.components["aws-cpp-sdk-cdi"]
cppSdk.libs = ["aws-cpp-sdk-cdi"]

cppSdk.requires = ["aws-sdk-cpp::monitoring", "aws-libfabric::aws-libfabric"]

cppSdk.set_property("cmake_file_name", "aws-cpp-sdk-cdi")
cppSdk.set_property("cmake_target_name", "AWS::aws-cpp-sdk-cdi")
cppSdk.set_property("pkg_config_name", "aws-cpp-sdk-cdi")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
# TODO: Remove the namespace on CMake targets
cppSdk.names["cmake_find_package"] = "aws-cpp-sdk-cdi"
cppSdk.names["cmake_find_package_multi"] = "aws-cpp-sdk-cdi"
cppSdk.names["pkg_config"] = "aws-cpp-sdk-cdi"

cSdk = self.cpp_info.components["cdisdk"]
cSdk.libs = ["cdisdk"]
cSdk.requires = ["aws-cpp-sdk-cdi"]
if self.settings.os == "Linux":
cSdk.defines = ["_LINUX"]

cSdk.set_property("cmake_file_name", "aws-cdi-sdk")
cSdk.set_property("cmake_target_name", "AWS::aws-cdi-sdk")
cSdk.set_property("pkg_config_name", "aws-cdi-sdk")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
# TODO: Remove the namespace on CMake targets
cSdk.names["cmake_find_package"] = "aws-cdi-sdk"
cSdk.names["cmake_find_package_multi"] = "aws-cdi-sdk"
cSdk.names["pkg_config"] = "aws-cdi-sdk"

Copy link
Contributor

@SpaceIm SpaceIm Mar 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still wrong and inconsistent. See #7407 (comment)

@conan-center-bot

This comment has been minimized.

Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com>
@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

All green in build 2 (9fa8200e33de32325e71e138f1784ef60a25ce0a):

  • aws-cdi-sdk/2.2.0@:
    All packages built successfully! (All logs)

@conan-center-bot conan-center-bot merged commit 9a6ab53 into conan-io:master Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants