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

[rxcpp] find_package(rxcpp "4.1.1" CONFIG REQUIRED) fails because of wrong version info #29339

Closed
midrare opened this issue Jan 31, 2023 · 15 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@midrare
Copy link

midrare commented Jan 31, 2023

Library name: rxcpp
New version number: 4.1.1

find_package(rxcpp "4.1.1" CONFIG REQUIRED) fails with the following error.

CMake Error at C:/opt/vcpkg/scripts/buildsystems/vcpkg.cmake:844 (_find_package):
  Could not find a configuration file for package "rxcpp" that is compatible
  with requested version "4.1.1".

  The following configuration files were considered but not accepted:

    C:/Users/User/hello/cmake-build-debug/vcpkg_installed/x64-windows/share/rxcpp/rxcppConfig.cmake, version: 2.2.4

It seems that rxcppConfigVersion.cmake hasn't been updated to match the new package version.

@FrankXie05
Copy link
Contributor

@mediumrarez Please delete the local rxcpp cache and install rxcpp again.

@FrankXie05 FrankXie05 added the category:question This issue is a question label Feb 1, 2023
@midrare midrare changed the title [rxcpp] find_package(rxcpp VERSION 4.1.1) fails because of wrong version info [rxcpp] find_package(rxcpp "4.1.1") fails because of wrong version info Feb 1, 2023
@midrare midrare changed the title [rxcpp] find_package(rxcpp "4.1.1") fails because of wrong version info [rxcpp] find_package(rxcpp "4.1.1" CONFIG REQUIRED) fails because of wrong version info Feb 1, 2023
@midrare
Copy link
Author

midrare commented Feb 1, 2023

I deleted cmake-build-debug, and vcpkg_installed, then reinstalled everything but the error still persists.

I'm running in manifest mode. Do I need to delete the global vcpkg cache too?

@FrankXie05
Copy link
Contributor

FrankXie05 commented Feb 1, 2023

I have not reproduced it, could you please provide me with your sample project file? :)
image
This is my example project :

# CMakeList.txt : CMake project for usage, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

project(test)
# Add source to this project's executable.
add_executable (usage "usage.cpp" "usage.h")

# TODO: Add tests and install targets if needed.
find_package(rxcpp CONFIG REQUIRED)
target_link_libraries(usage PRIVATE rxcpp)
PS E:\port-update\vcpkg> ./vcpkg install rxcpp:x64-windows
 Computing installation plan...                                                
 The following packages will be built and installed:                          
    rxcpp[core]:x64-windows -> 4.1.1#1                                           
 Detecting compiler hash for triplet x64-windows...                           
 A suitable version of powershell-core was not found (required v7.2.8) Downloading portable powershell-core 7.2.8...      
 Downloading powershell-core...                                                                                           
 https://github.com/PowerShell/PowerShell/releases/download/v7.2.8/PowerShell-7.2.8-win-x86.zip->E:\port-update\vcpkg\downloads\PowerShell-7.2.8-win-x86.zip       
 Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.2.8/PowerShell-7.2.8-win-x86.zip                                                     
 Extracting powershell-core...                                                                                                                                 
 Restored 0 package(s) from C:\Users\test\AppData\Local\vcpkg\archives in 316.6 us. Use --debug to see more details.                                    
 Installing 1/1 rxcpp:x64-windows...                                                                                                                          
 Building rxcpp[core]:x64-windows...                                                                                                                          
 -- Downloading https://github.com/ReactiveX/RxCpp/archive/v4.1.1.tar.gz -> ReactiveX-RxCpp-v4.1.1.tar.gz...                                                   
 -- Extracting source E:/port-update/vcpkg/downloads/ReactiveX-RxCpp-v4.1.1.tar.gz                                                                             
 -- Applying patch disable-tests.patch                                                                                                                         
 -- Using source at E:/port-update/vcpkg/buildtrees/rxcpp/src/v4.1.1-aae9c762a3.clean                                                                          
 -- Configuring x64-windows                                                                                                                                   
 -- Building x64-windows-dbg                                                                                                                                 
 -- Building x64-windows-rel                                                                                                                                 
 -- Performing post-build validation                                                                                                                         
 Stored binary cache: "C:\Users\test\AppData\Local\vcpkg\archives\b7\b7d2718f25cd79c64355a6c00af2a849093d982782a6f46edd55ea58ab6927e4.zip"             
 Elapsed time to handle rxcpp:x64-windows: 32.9 s                                                                                                            
 Total install time: 1.014 min                                                                                                                               
 rxcpp provides CMake targets: 
 
    # this is heuristically generated, and may not be correct                                                                                                 
    find_package(rxcpp CONFIG REQUIRED)                                                                                                                       
    target_link_libraries(main PRIVATE rxcpp) 
    
 PS E:\port-update\vcpkg> 

@midrare
Copy link
Author

midrare commented Feb 1, 2023

You're missing the version specifier. I can reproduce with your sample CMakeLists.txt by adding the version specifier.

find_package(rxcpp "4.1.1" CONFIG REQUIRED)
                    ^^^^^

For completeness, here is the CMakeLists.txt I used:

# CMakeList.txt : CMake project for usage, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

project(test)
# Add source to this project's executable.
add_executable (usage "usage.cpp" "usage.h")

# TODO: Add tests and install targets if needed.
find_package(rxcpp "4.1.1" CONFIG REQUIRED)
target_link_libraries(usage PRIVATE rxcpp)

Here's the vcpkg.json

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "demo",
    "version-semver": "0.1.0",
    "builtin-baseline": "ae826fceaa15109814d0531faeda424f43047822",
    "dependencies": [
        {
            "name": "rxcpp",
            "version>=": "4.1.1"
        }
    ]
}

@FrankXie05
Copy link
Contributor

Do you want to specify the port version?

@FrankXie05
Copy link
Contributor

You're missing the version specifier. I can reproduce with your sample CMakeLists.txt by adding the version specifier.

I didn't add a version note because the default is looking for the latest version via CMAKE_TOOLCHAIN_FILE.

@midrare
Copy link
Author

midrare commented Feb 1, 2023

No, just the version of the actual library. The idea is so I can let the user choose if he wants to use vcpkg or not. If he doesn't want to use vcpkg, find_package() will still find the right version from his system.

@FrankXie05
Copy link
Contributor

@mediumrarez At present, vcpkg only provides the latest port version. You can achieve it through manifest mode. But we can't provide such a method as find_package( xxx "version" CONFIG REQUIRED). :(
This will cause the project to find a version conflict between the config file provided by cmake and the config file provided by vcpkg.

@midrare
Copy link
Author

midrare commented Feb 1, 2023

Ok, I think I found the real issue, which is that upstream hasn't been updating their PROJECT_VERSION in the CMakeLists.txt file. I will try to resolve this upstream. Once upstream starts updating their PROJECT_VERSION then the vcpkg package version and the CMake package version should match.

ReactiveX/RxCpp#599

@FrankXie05 FrankXie05 added the depends:upstream-changes Waiting on a change to the upstream project label Feb 1, 2023
@MonicaLiu0311 MonicaLiu0311 added category:port-bug The issue is with a library, which is something the port should already support and removed category:question This issue is a question labels Feb 16, 2023
@FrankXie05
Copy link
Contributor

@mediumrarez Regarding the last update upstream that happened nine months ago, I think we can only deal with it through patches. 🤔

@midrare
Copy link
Author

midrare commented Feb 22, 2023

@FrankXie05 Yes, I think so too. It doesn't look too hopeful.

@dg0yt
Copy link
Contributor

dg0yt commented Feb 22, 2023

Not a vcpkg bug IMO.

I think we can only deal with it through patches

If upstream doesn't suppport versions in find_package, I don't see a good reason to add it though patches. vcpkg has versioning by manifests.

@midrare
Copy link
Author

midrare commented Feb 22, 2023

@dg0yt The idea is to let the user choose whether or not to use vcpkg. If vcpkg isn't used, then find_package can still find the right version from the user's system.

@dg0yt
Copy link
Contributor

dg0yt commented Feb 23, 2023

@dg0yt The idea is to let the user choose whether or not to use vcpkg. If vcpkg isn't used, then find_package can still find the right version from the user's system.

There is nothing wrong with choice. However, I don't think this is a strong argument here:

  • The defect is on upstream's side, and a vendored fix in vcpkg doesn't change it: Until it is fixed upstream, find_package can't reliably find the right pristine config from the user's system.
  • Version control is not explicit control over whether vcpkg is used or not.
  • Version is just one single aspect for choice of actual CMake config.
    There are many ways to guide find_package search in config mode.
  • In general, find_package cannot ensure that there are no transitive ABI-level dependencies on vcpkg's build of the package when the user still consumes other vcpkg ports. To really exclude a particular package, one would need to provide an empty overlay port, letting vcpkg use the system package, too.

@midrare
Copy link
Author

midrare commented Feb 24, 2023

Until it is fixed upstream, find_package can't reliably find the right pristine config from the user's system.

Hmm... I guess you're right. Closing.

@midrare midrare closed this as completed Feb 24, 2023
@FrankXie05 FrankXie05 removed the depends:upstream-changes Waiting on a change to the upstream project label Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

4 participants