microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.2k stars 6.39k forks source link

Support using $PORT[$VERSION] to install the specified version #10674

Closed caibf closed 3 years ago

caibf commented 4 years ago

Environment

Operating System: Windows 10(1909) IDE: Visual Studio 2017 Community vcpkg: 2020.01

Context

I have installed vcpkg correctly and tried to install an 3rdparty library called jsoncpp. However, I would like to install a specific version. How do I do that?

PS F:\04_Software\3rdParty\vcpkg-2020.01> .\vcpkg.exe search jsoncpp
jsoncpp              1.9.2            jsoncpp is an implementation of a JSON reader and writer in C++. JSON (JavaScr...
JackBoosY commented 4 years ago

You can use ./vcpkg x-history jsoncpp to list the jsoncpp update history in vcpkg. Then use git reset <commit-id> to roll back vcpkg to the selected version. Finally rebuild jsoncpp.

heydojo commented 4 years ago

Hi @caibf

I have an example. If inside the CONTROL file for the port there is Feature: https://github.com/microsoft/vcpkg/blob/master/ports/qt5-base/CONTROL#L7 you can use it like this:

vcpkg install qt5-base[latest]:x64-windows

In the example:

qt5-base[latest]:x64-windows would install qt version 5.13.1

and:

qt5-base:x64-windows would instead install qt version 5.12.5

Beyond this, fine grained version control of ports is not a thing in vcpkg. You can however, fork the port and change the version you want to use yourself in your local copy (and if it is a version bump forwards, it fixes bugs, you have tested it and it works well - please propose a merge request to the code found in vcpkg master.)

Thanks!

JackBoosY commented 4 years ago

@caibf Does this issue still bother you?

caibf commented 4 years ago

Hi @JackBoosY @heydojo,

I am so sorry about that reply us too late because I am too busy for work in these days.

Dear @JackBoosY : I am not going to install specific version of vcpkg library. My purpose is install different version of library that I need via vcpkg. Maybe you have mistaken my meaning.

Dear @heydojo : Thanks your tips. I will try soon and reply to you with my testing result.

caibf commented 4 years ago

@JackBoosY,

If I want to install qt v5.10 in this sample, I could not reach this through following commands. vcpkg install qt5-base[5.10]:x64-windows

In other words, vcpkg always installed the lastest package that we needed. It can not checkout the specific library version.

By the way, I doesn't know how to participate in code modification and submit if I found a library version which is suitable for me and I have tested well.

JackBoosY commented 4 years ago

@caibf Yep, vcpkg does not yet support this operation. So, we need to use the following steps:

  1. ./vcpkg x-history qt5-base, results:

    version          date    vcpkg commit
    5.12.5-13    2020-04-09    941d5464544eb5812b2cbd6e687c3ebc78ed2624
    5.12.5-12    2020-04-06    359661a22705ca101a27680fbe4d4815414be64f
    5.12.5-11    2020-03-19    cbaafe76d63fd55718ef417c9e833cf389ee73ed
    5.12.5-10    2020-02-19    9db90b397d1257f5af62f57f0b4f53072803b6e2
    5.12.5-9    2020-02-11    f478be7479f4a418d46c34156bb34ae4f87656af
    5.12.5-8    2020-01-13    bdae0904c41a0ee2c5204d6449038d3b5d551726
    2019-12-23    c0d22c88ea7638d1b74339f9e9adfd37b0f525ed
    2019-11-22    9a01ec282e7e1ebe8d901cd08d245e72e2d9a274
    2019-11-02    4ad478783b15d7b4b7029dfc4f9342ea7cf7033b
    2019-10-29    332f6fd3e7e56db31ea49770a5fa169fe19c10a8
    2019-09-16    9b4b5f4ce79df624b4fcf3ae969c6ba61d04d1fb
    2019-09-12    96f4487c77fbf08518a9ee665612927c97ce8ebd
    2019-08-30    7dfb48ed5a35ac3ef20651fc0ad56e7ff00dff89
    2019-07-17    800fd63cf3c1824784fa8c4caff122ab453661ce
    2019-07-17    8e17f07f4446c7d3d2bc5a212d77147674c63f97
    2019-06-20    47d206e149e88201333b5ca8fe55c30e2b1a8177
    2019-05-08    38aeee774a94b4cdb085e450ff579a404cc161c3
    5.12.1-6    2019-04-30    5314524f445222209aff9f372933fef0702e1913
    5.12.1-5    2019-04-25    d299ad61079bc77c331751623308c7739ff977e3
    2019-04-11    29be95a5e58d00ecd6ec85ff66171d0d3d19ccd0
    2019-04-10    e08db20db9220d00b556ddd0da889981b4fff59e
    2019-03-09    06bdb67b664e23d0f582684e89914bcc1e46402b
    2019-02-26    aa909090ace63e19ff738f3062e32c3b275a3da3
    5.12.1    2019-02-22    473e803451a45ddb4d497d4fb6f863ba1ac2b1b2
    5.12.0    2019-01-16    13ec61a842588480f49d3c3a6a3b42d70df4fa84
    5.11.2-1    2019-01-11    885ca2ce6cd1c9353f4a0f28f94547a1342a7ae2
    5.11.1-5    2018-10-23    a1fe9544fd042a40fcfd28f04032a8f539486bdf
    5.11.1-2    2018-10-22    473d63c4edf1ab704b597abc4987372712b005f6
    5.9.2-7    2018-09-20    90e627c7e6312d5ab04060c186e55ac58edaa634
    5.9.2-6    2018-04-28    ed3f943259acd4913f99891a709c8d6713f18397
    5.9.2-5    2018-03-27    26187d1bed865f472caa2dcd2f154a72f7f6d045
    5.9.2-4    2018-02-05    8fde45999026e8291304747796cf945b248b63de
    5.9.2-3    2018-01-29    b2eb87dc71c9df22d5c9fb5c2136786489b03196
    5.9.2-2    2018-01-26    5c9c1bde53f562c11a5248090ad2c63e7e481633
    5.9.2-1    2018-01-18    d9d3744484b1dbe166d2036764f5d78b486e7290
    5.9.2-0    2018-01-18    ca9ff199d6024fa0ef26abcba920928215d77f38
  2. git reset 473e803451a45ddb4d497d4fb6f863ba1ac2b1b2

  3. .\bootstrap-vcpkg.bat

  4. ./vcpkg install qt5-base

caibf commented 4 years ago

@JackBoosY Thanks for your passion answer. I know how to implement my requirement. The issue now is solve.

JackBoosY commented 4 years ago

Although this issue has been solved, I think your proposal is very good.

haquocviet commented 4 years ago

Regarding the issue @caibf mentioned. I think "--overlay-port" option is simpler to solve his issue than resetting vcpkg back to an old commit. I often use the "--overlay-port" to install packages having versions and build options that are different from the those in the default port location. Though that solution works fine, however, I am suffering from "vcpkg upgrade" because the packages in my custom port shall be overwritten by upgrading if the version of the packages in default port is different from ones' in the custom port.

I have described the upgrade issue here: https://github.com/microsoft/vcpkg/issues/10877

JackBoosY commented 3 years ago

Solved by overlay port and versioning.