-
Notifications
You must be signed in to change notification settings - Fork 2k
[libdb] Conan 2.0 migration #17806
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
[libdb] Conan 2.0 migration #17806
Conversation
I detected other pull requests that are modifying libdb/all recipe: This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there. |
9176cd2
to
9c95aae
Compare
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.
Hi @samuel-emrys, I can see that this PR has quite a bit of commented out code - is this ready for review? |
@jcar87 no, it's failing builds on Windows and Macos at the moment. This is a work in progress. I've been working on the Windows integration but haven't been able to use MSBuildToolchain to inject PlatformToolset effectively. I've used libsodium as a template in that regard, but it still throws errors indicating that it's trying to use Visual Studio 2010 |
This comment has been minimized.
This comment has been minimized.
* Re-adding -Wno-error=implicit-function-delcaration back to add apple-clang >= 12 functionality back in. This was originally added in conan-io#7943 and erroneously removed.
This comment has been minimized.
This comment has been minimized.
Hooks produced the following warnings for commit 5ac16bdlibdb/5.3.28
|
This comment has been minimized.
This comment has been minimized.
…solutions * Add WindowsTargetPlatformVersion definition to visual studio solutions * Remove extraneous comments
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.
@jcar87 this is ready for review now. In scope for this PR is a conan v2 migration of the existing recipe. Note that a limitation of the existing recipe was that msvc > 191 builds were not supported. That property is maintained here, and msvc > 191 build functionality should be implemented in a subsequent PR. Unfortunately this also means that the windows functionality that is here is not exercised as msvc==191 is not a build profile exercised by CCI. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
@uilianries what's going on with this build? I saw that you didn't want people to close/re-open to trigger ci builds, but this seems to have been stuck for a while now? |
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.
Thanks @samuel-emrys for your contribution! this is not the easiest recipe to migrate. Just added one comment. I think there are still a few commented out code or some todos, please let me know when it's ready for a final review!
recipes/libdb/all/conanfile.py
Outdated
replace_in_file(self, file, | ||
"<PropertyGroup Label=\"Globals\">", | ||
"<PropertyGroup Label=\"Globals\"><WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>") | ||
# 10.0 should select the "latest" SDK available, but doesn't always work. It may be necessary to specify a specific version |
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.
This concerns me a little bit. "10.0" for the "latest available" is the documented behaviour: https://learn.microsoft.com/en-us/cpp/build/reference/general-property-page-project?view=msvc-170, and from what I can see this applies to versions 2015-2022.
Is this not the case? it would be good to document when this is a problem. Visual Studio 2015 has a maximum version, but apart from this I dont think there is an issue? https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2014%202015.html#windows-10-sdk-maximum-version-for-vs-2015
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.
so, with this definition locally, I get the following error
replace_in_file(self, file,
"<PropertyGroup Label=\"Globals\">",
"<PropertyGroup Label=\"Globals\"><WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")
The Windows SDK version 10.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Us
ers\user\.conan2\p\b\libdb691c014fe45c0\b\build_windows\VS10\db.vcxproj]
My understanding is the same as yours - this should work. You'll note that the previous implementation uses a specific SDK value - this was an improvement i tried to make, because if the specific SDK isn't installed on the build system then this will fail. My hope is that using 10.0
will work on someones system, but this is an artifact of my specific environment. Using either of the following resolves this error:
replace_in_file(self, file,
"<PropertyGroup Label=\"Globals\">",
"<PropertyGroup Label=\"Globals\"><WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>")
replace_in_file(self, file,
"<PropertyGroup Label=\"Globals\">",
"<PropertyGroup Label=\"Globals\"><WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>")
This is the only reason these are here as comment - they're what works for me locally. Obviously, since this PR only presents VS2017 compatibility (not 2019 or 2022), this won't be exercised by the CI anyway. I banged my head on a wall for a while with this one and this is far as I could take it without someone more experienced taking a look. If anybody has a suggestion for how to generalise this more, I'm happy to take it. Otherwise, we should compromise to get this recipe updated and iterate as necessary.
Logs for failure:
$ conan create . --version 5.3.28 --user user --channel testing -s:h compiler.version=191 -s:b compiler.version=191
======== Exporting recipe to the cache ========
libdb/5.3.28@user/testing: Exporting package recipe: C:\users\user\projects\conan-center-index\recipes\libdb\all\conanfile.py
libdb/5.3.28@user/testing: exports: File 'conandata.yml' found. Exporting it...
libdb/5.3.28@user/testing: Calling export_sources()
libdb/5.3.28@user/testing: Copied 1 '.yml' file: conandata.yml
libdb/5.3.28@user/testing: Copied 1 '.py' file: conanfile.py
libdb/5.3.28@user/testing: Copied 3 '.patch' files: 0001-rename_atomic_compare_exchange.patch, 0002-no-conditional-tcl-include.patch, 0003-msvc-db_tcl-add-static-configuration.patch
libdb/5.3.28@user/testing: Exported to cache folder: C:\Users\user\.conan2\p\libdb669a6ac9034ea\e
libdb/5.3.28@user/testing: Exported: libdb/5.3.28@user/testing#f57e9d9c23f6df8ac5fcceda7f6567bb (2023-08-21 12:28:42 UTC)
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=static
compiler.runtime_type=Release
compiler.update=None
compiler.version=191
os=Windows
os.subsystem=None
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=static
compiler.runtime_type=Release
compiler.update=None
compiler.version=191
os=Windows
os.subsystem=None
======== Computing dependency graph ========
Graph root
cli
Requirements
libdb/5.3.28@user/testing#f57e9d9c23f6df8ac5fcceda7f6567bb - Cache
======== Computing necessary packages ========
libdb/5.3.28@user/testing: Forced build from source
Requirements
libdb/5.3.28@user/testing#f57e9d9c23f6df8ac5fcceda7f6567bb:47ecdd4ab563a726531e9e64a19e19e2c06b73c5 - Build
======== Installing packages ========
libdb/5.3.28@user/testing: Calling source() in C:\Users\user\.conan2\p\libdb669a6ac9034ea\s\.
libdb/5.3.28@user/testing: Downloading 35.1MB db-5.3.28.tar.gz
-------- Installing package libdb/5.3.28@user/testing (1 of 1) --------
libdb/5.3.28@user/testing: Building from source
libdb/5.3.28@user/testing: Package libdb/5.3.28@user/testing:47ecdd4ab563a726531e9e64a19e19e2c06b73c5
libdb/5.3.28@user/testing: Copying sources to build folder
libdb/5.3.28@user/testing: Building your package in C:\Users\user\.conan2\p\b\libdb691c014fe45c0\b
libdb/5.3.28@user/testing: Calling generate()
libdb/5.3.28@user/testing: Generators folder: C:\Users\user\.conan2\p\b\libdb691c014fe45c0\b\conan
libdb/5.3.28@user/testing: MSBuildToolchain created conantoolchain_release_x64.props
libdb/5.3.28@user/testing: MSBuildToolchain writing conantoolchain.props
libdb/5.3.28@user/testing: Generating aggregated env files
libdb/5.3.28@user/testing: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
libdb/5.3.28@user/testing: Calling build()
libdb/5.3.28@user/testing: Apply patch (portability): Rename __atomic_compare_exchange to __atomic_compare_exchange_db
libdb/5.3.28@user/testing: Apply patch (conan): Always include tcl.h. Remove conditions.
libdb/5.3.28@user/testing: Apply patch (conan): Add static configuration
libdb/5.3.28@user/testing: RUN: msbuild "C:\Users\user\.conan2\p\b\libdb691c014fe45c0\b\.\build_windows\VS10\db.vcxproj" /p:Configuration="Static Release" /p:Platform=x64
conanvcvars.bat: Activating environment Visual Studio 15 - amd64 - vcvars_ver=14.1
[vcvarsall.bat] Environment initialized for: 'x64'
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 21/08/2023 10:00:09 PM.
Project "C:\Users\user\.conan2\p\b\libdb691c014fe45c0\b\build_windows\VS10\db.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Us
ers\user\.conan2\p\b\libdb691c014fe45c0\b\build_windows\VS10\db.vcxproj]
Done Building Project "C:\Users\user\.conan2\p\b\libdb691c014fe45c0\b\build_windows\VS10\db.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\user\.conan2\p\b\libdb691c014fe45c0\b\build_windows\VS10\db.vcxproj" (default target) (1) ->
(_CheckWindowsSDKInstalled target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\
Users\user\.conan2\p\b\libdb691c014fe45c0\b\build_windows\VS10\db.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.57
libdb/5.3.28@user/testing: ERROR:
Package '47ecdd4ab563a726531e9e64a19e19e2c06b73c5' build failed
libdb/5.3.28@user/testing: WARN: Build folder C:\Users\user\.conan2\p\b\libdb691c014fe45c0\b\.
*********************************************************
Recipe 'libdb/5.3.28@user/testing' cannot build its binary
It is possible that this recipe is not Conan 2.0 ready
If the recipe comes from ConanCenter check: https://conan.io/cci-v2.html
If it is your recipe, check if it is updated to 2.0
*********************************************************
ERROR: libdb/5.3.28@user/testing: Error in build() method, line 213
msbuild.build(sln=project_file)
ConanException: Error 1 while executing
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.
@conan-io/barbarians has anybody got any ideas on how to get the windows build to pass/to upgrade the project successfully?
Edit: doesn't look like the suggested ping does anything
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.
@samuel-emrys We have a template for MSBuild projects, including dealing with sdk version: https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/msbuild_package/all/conanfile.py#L106. This is not the first recipe here in CCI that needs to change the toolset, according to the profile. If you do a grep PlatformToolset you will find several other recipes doing the same.
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.
Thanks @uilianries. This is something that I've already experimented with/implemented and does not appear to influence the above error: https://github.com/conan-io/conan-center-index/pull/17806/files#diff-b153d74e53befdfc8efd529e900c2626fc8949f9453e701118ad5ba7fdcf2f12R193-R205
It doesn't match what you've posted exactly, so I'll do some more experimentation to further rule it out as the cause, but I'm not confident that it will resolve the issue. The issue as it's currently presenting is with the <WindowsTargetPlatformVersion>
directive, not the <PlatformToolset>
directive.
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.
@uilianries I've re-organised the changes to consolidate all patches into _patch_sources
(probably why you missed the PlatformToolset
implementation, it was in build()
). I've also confirmed that patching the toolset (whilst necessary) doesn't impact the above error. I suspect that this is an issue with the source vcxproj files, because I can't upgrade the project manually (to use <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
) and achieve successful builds from within visual studio either. I still have to select a more specific SDK version, which may or may not be available on any given build agent/user computer.
Note that the previous author must have identified the same limitation given the previous implementation assumed <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
, which didn't work for me locally either.
libdb builds with vs2017, so this should be allowed to build. Erroneously this was included in the invalid compilers.
This comment has been minimized.
This comment has been minimized.
@uilianries maybe you could approve? It's already been a while... |
@AndreyMlashkin let's wait for @jcar87 answer first. |
To improve comprehension and readability, reorganise all source patching into the _patch_sources method. Previously, there were some patches that existed only in build(), which meant that a developer would have to find patches in multiple locations which increases recipe complexity.
Conan v1 pipeline ✔️All green in build 7 (
Conan v2 pipeline ✔️
All green in build 7 (
|
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.
Thanks a lot for your contribution, always appreciated :)
Specify library name and version: libdb/5.3.28