-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
mysql-connector-cpp: new recipe #25170
base: master
Are you sure you want to change the base?
Conversation
…-cpp' into new/mysql-connector-cpp-2 # Conflicts: # recipes/mysql-connector-cpp/all/conandata.yml # recipes/mysql-connector-cpp/all/conanfile.py # recipes/mysql-connector-cpp/all/test_package/CMakeLists.txt # recipes/mysql-connector-cpp/all/test_package/conanfile.py # recipes/mysql-connector-cpp/config.yml
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1723b98
to
f53cac3
Compare
f53cac3
to
f59bd4a
Compare
This comment has been minimized.
This comment has been minimized.
No longer needed after removing bootstrap().
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good
Co-authored-by: PerseoGI <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR! This project is one that we tried to package many time, but now, with this PR, we are much closer to achieve it.
I have some concerns about those patches, they are related to the upstream directly, and I don't find any other package manager doing the same. I would suggest opening issues to the upstream reporting about find_dependency and merge_library, otherwise, we will need to keep updating the same patch always.
if is_apple_os(self) or self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.extend(["resolv"]) | ||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.extend(["m", "pthread"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.cpp_info.system_libs.extend(["m", "pthread"]) | |
self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) |
https://github.com/mysql/mysql-connector-cpp/blob/9.0.0/mysql-concpp-config.cmake.in#L463
- patch_file: "patches/9.0.0/0001-override-cmake-policy-version.patch" | ||
patch_description: "Set CMake policy version to 3.15, move project() statement" | ||
patch_type: "conan" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- patch_file: "patches/9.0.0/0001-override-cmake-policy-version.patch" | |
patch_description: "Set CMake policy version to 3.15, move project() statement" | |
patch_type: "conan" |
I really don't see an error when not using this patch. I would avoid if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looks like the issues were caused by bootstrap()
rather than the policy version or project()
call location.
- patch_file: "patches/9.0.0/0001-override-cmake-policy-version.patch" | ||
patch_description: "Set CMake policy version to 3.15, move project() statement" | ||
patch_type: "conan" | ||
- patch_file: "patches/9.0.0/0002-rename-find_dependency.patch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer having an issue pointed in the upstream about this. I understand the risk of name collision, but keeping it only here is not good as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not just a potential risk. The CMake configuration step consistently failed for me due to find_package()
calls importing CMakeFindDependencyMacro
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find any other package manager (ubuntu, aur, gentoo and conda) using similar approach. I understand the risk of having duplicated symbols and causing a mess, but this case should be reported to the upstream as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't be overly reliant on the system-wide package managers as a reference. The issue precisely stems from the upstream project assuming that all of the external libraries are system-wide shared libraries rather than static libs.
It's not just a risk either. The apple-clang compiler refuses to link test_package
due to duplicate symbols from OpenSSL and the mysql-connector-cpp lib when OpenSSL is built as static, for example.
I'm not going to reach out to upstream regarding these issues at this time, sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerning duplicate symbols and OpenSSL, do you think it's worth trying my approach in the latest commits? In short, remove the OpenSSL dependency from mysqlx and only link it in the foundation target.
In their 'docs' they do explain that an external openssl lib can be included via a new common target.
4d3c98c
to
d1e517b
Compare
Conan v1 pipeline ✔️All green in build 14 (
Conan v2 pipeline ✔️
All green in build 14 (
|
Despite that hot mess of CMAKE abstraction files and function, you actually did it, nice finds and well done! 🎉 |
@husitawi yes! These are good news! |
Summary
Changes to recipe: mysql-connector-cpp/9.0.0
Motivation
MySQL Connector/C++ is a MySQL database connector for C++. It lets you develop C++ and C applications that connect to MySQL Server.
https://github.com/mysql/mysql-connector-cpp
Details
The project is not doing anything particularly too complex or special in its CMake files overall, but chooses to do some things in quite convoluted and non-standard ways:
boostrap()
, which is done by default beforeproject()
call. This breaks many Conan variables and targets and does not appear to really be necessary (it's disabled for Ninja, for example).merge_libraries()
. This assumes that all external deps have been built as shared. Static external deps get merged into the final archive file, which leads to "duplicate symbol" linker errors on some compilers, such as apple-clang. I replaced it with the much simpler and more common approach of usingOBJECT
-type libs for the internal libraries.Based on
Closes