Skip to content

'"default-features": false' doesn't work with a dependency of a dependency(transitive dependency) #26664

@fujiinzukaatusi

Description

@fujiinzukaatusi

Describe the bug
"default-features": false doesn't work when it's in vcpkg.json of a package that's a dependency of my project.

Edit:
For those who got to this issue, here's a summery.

  • This behaviour is currently not considered as a bug.
  • See this comment to grasp how the current implementation being.

Below is vcpkg.json of my projcet.

{
    "name": "my-project",
    "version-string": "0.1.0",
    "dependencies": [
        {
            "name": "osg",
            "features": [
                "fontconfig",
                "freetype",
                "plugins",
                "docs"
            ],
            "default-features": false
        }
    ]
}

"plugins" feature of osg package uses full features of gdal package. I changed osg's vcpkg.json to use only gdal's core feature.
Below is an extract of it.

"plugins": {
      "description": "Build most OSG Plugins",
      "dependencies": [
        "curl",
        {
          "name": "gdal",
          "default-features": false
        },
        {
          "name": "giflib",
          "platform": "windows"
        },
        {
          "name": "jasper",
          "default-features": false
        },
        "libgta",
        {
          "name": "libiconv",
          "platform": "windows"
        },
        "libjpeg-turbo",
        "libpng",
        {
          "name": "libxml2",
          "platform": "windows"
        },
        "tiff"
      ]
    },

Then I ran vcpkg install --triplet x64-windows-static --dry-run. I expected in the installation list gdal package containing only [core] feature.
But I got this:

Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x64-windows-static...
The following packages will be built and installed:
  * brotli[core]:x64-windows-static -> 1.0.9#3
  * bzip2[core]:x64-windows-static -> 1.0.8#2
  * curl[core,non-http,schannel,ssl,sspi]:x64-windows-static -> 7.84.0#2
  * dirent[core]:x64-windows-static -> 1.23.2#1
  * egl-registry[core]:x64-windows-static -> 2021-11-23
  * expat[core]:x64-windows-static -> 2.4.8#1
  * fontconfig[core]:x64-windows-static -> 2.14.0#4
  * freeglut[core]:x64-windows-static -> 3.2.2
  * freetype[brotli,bzip2,core,png,zlib]:x64-windows-static -> 2.12.1#2
  * freexl[core]:x64-windows-static -> 1.0.6#1
  * gdal[core,curl,default-features,geos,hdf5,libspatialite,netcdf,postgresql,recommended-features]:x64-windows-static -> 3.5.1#6
  * geos[core]:x64-windows-static -> 3.11.0#1
  * getopt[core]:x64-windows-static -> 0#2
  * getopt-win32[core]:x64-windows-static -> 0.1#4
  * gettext[core]:x64-windows-static -> 0.21#9
  * giflib[core]:x64-windows-static -> 5.2.1#2
  * gperf[core]:x64-windows -> 3.1#4
  * hdf5[core,cpp,szip,zlib]:x64-windows-static -> 1.12.2#1
  * jasper[core,default-features,opengl]:x64-windows-static -> 2.0.33#6
  * json-c[core]:x64-windows-static -> 2022-06-26#2
  * libgeotiff[core]:x64-windows-static -> 1.7.1#1
  * libgta[core]:x64-windows-static -> 1.0.8#3
  * libiconv[core]:x64-windows-static -> 1.17
  * libjpeg-turbo[core]:x64-windows-static -> 2.1.4
  * liblzma[core]:x64-windows-static -> 5.2.5#6
  * libpng[core]:x64-windows-static -> 1.6.37#19
  * libpq[core,lz4,openssl,zlib]:x64-windows-static -> 14.4
  * libspatialite[core,freexl,geocallbacks]:x64-windows-static -> 5.0.1#7
  * libwebp[core,libwebpmux,nearlossless,simd,unicode]:x64-windows-static -> 1.2.4
  * libxml2[core]:x64-windows-static -> 2.9.14#1
  * lz4[core]:x64-windows-static -> 1.9.3#4
  * netcdf-c[core,dap,hdf5,nczarr,netcdf-4,platform-default-features]:x64-windows-static -> 4.8.1#2
  * nlohmann-json[core]:x64-windows-static -> 3.11.2
  * opengl[core]:x64-windows-static -> 2022-03-14#1
  * opengl-registry[core]:x64-windows-static -> 2021-11-17
  * openjpeg[core]:x64-windows-static -> 2.5.0
  * openssl[core]:x64-windows-static -> 3.0.5#4
    osg[core,docs,fontconfig,freetype,plugins]:x64-windows-static -> 3.6.5#15
  * pcre2[core]:x64-windows-static -> 10.40
  * pkgconf[core]:x64-windows -> 1.8.0#3
  * proj[core,net,tiff]:x64-windows-static -> 9.0.1#1
  * pthread[core]:x64-windows-static -> 3.0.0#1
  * pthreads[core]:x64-windows-static -> 3.0.0#11
  * qhull[core]:x64-windows-static -> 8.0.2#3
  * sqlite3[core,tool]:x64-windows -> 3.39.2
  * sqlite3[core,rtree]:x64-windows-static -> 3.39.2
  * szip[core]:x64-windows-static -> 2.1.1#9
  * tiff[core,jpeg,lzma,zip]:x64-windows-static -> 4.4.0#1
  * vcpkg-cmake[core]:x64-windows -> 2022-07-18
  * vcpkg-cmake-config[core]:x64-windows -> 2022-02-06#1
  * vcpkg-cmake-get-vars[core]:x64-windows -> 2022-05-10#1
  * vcpkg-pkgconfig-get-modules[core]:x64-windows -> 2022-02-10#1
  * vcpkg-pkgconfig-get-modules[core]:x64-windows-static -> 2022-02-10#1
  * vcpkg-tool-meson[core]:x64-windows -> 0.63
  * zlib[core]:x64-windows-static -> 1.2.12#1
  * zstd[core]:x64-windows-static -> 1.5.2#1
Additional packages (*) will be modified to complete this operation.

Environment

  • OS: Windows10 x64
  • Vcpkg version: 2022-09-01-dfb82802c8cc562ce3b665a904a65b22314de724

To Reproduce
See Describe the bug.

Expected behavior
See Describe the bug.

Failure logs
None.

Additional context
I already confirmed:

  1. It works when my project is directly dependent on gdal.
  2. Other features of osg don't use gdal because when I removed gdal from the dependencies of "plugins" it didn't appear any longer in the list.
  3. Trying on curl while gdal is removed resulted the same. curl's full features were listed.
  4. Installing osg in classic mode resulted the same.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions