Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916592 - dev-build/cmake: Missing dependency on net-libs/nghttp2
Summary: dev-build/cmake: Missing dependency on net-libs/nghttp2
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-31 21:37 UTC by Raul Rangel
Modified: 2024-01-14 19:55 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raul Rangel 2023-10-31 21:37:22 UTC
I think `cmake` is relying on `curl` being built with with USE="nghttp2". If `nghttp2` isn't installed I see the following error:

```
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find NGHTTP2 (missing: NGHTTP2_LIBRARY NGHTTP2_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  Utilities/cmcurl/CMake/FindNGHTTP2.cmake:30 (find_package_handle_standard_args)
  Utilities/cmcurl/CMakeLists.txt:678 (find_package)
```


It looks like we should add a `net-libs/nghttp2` as a dependency.


Reproducible: Always

Steps to Reproduce:
1. USE="-nghttp2" emerge curl
2. emerge --unmerge nghttp2
3. emerge cmake



What started me down this path is that there is a circular dependency I'm trying to break:

```
.-> @_main~portage~portage//internal/packages/stage2/host/portage-stable/net-misc/curl:8.3.0-r3
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/net-misc/curl:8.3.0-r3_deps
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/net-misc/curl:8.3.0-r3_host_deps
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/net-libs/nghttp2:1.57.0
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/net-libs/nghttp2:1.57.0_deps
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/net-libs/nghttp2:1.57.0_host_deps
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/dev-util/cmake:3.26.4-r1
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/dev-util/cmake:3.26.4-r1_deps
|   @_main~portage~portage//internal/packages/stage2/host/portage-stable/dev-util/cmake:3.26.4-r1_host_deps
`-- @_main~portage~portage//internal/packages/stage2/host/portage-stable/net-misc/curl:8.3.0-r3
```

curl DEPENDs on nghttp2 which BDEPEND on cmake, which DEPEND on curl. I can partially break this by setting `net-misc/curl -nghttp2`, but that just shifts the problem because `cmake` actually requires `nghttp2`, so we end up with a loop again.

I was toying with the following patch that does fix my cycle by using the included libraries:

```
diff --git a/dev-util/cmake/cmake-3.26.4-r1.ebuild b/dev-util/cmake/cmake-3.26.4-r1.ebuild
index 5c9ee71b8933..f8e94fb2cdde 100644
--- a/dev-util/cmake/cmake-3.26.4-r1.ebuild
+++ b/dev-util/cmake/cmake-3.26.4-r1.ebuild
@@ -60,7 +60,7 @@ S="${WORKDIR}/${MY_P}"
 
 LICENSE="CMake"
 SLOT="0"
-IUSE="${CMAKE_DOCS_USEFLAG} emacs ncurses qt5 test"
+IUSE="${CMAKE_DOCS_USEFLAG} system-curl system-nghttp2 emacs ncurses qt5 test"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
@@ -69,7 +69,8 @@ RDEPEND="
        >=dev-libs/expat-2.0.1
        >=dev-libs/jsoncpp-1.9.2-r2:0=
        >=dev-libs/libuv-1.10.0:=
-       >=net-misc/curl-7.21.5[ssl]
+       system-curl? ( >=net-misc/curl-7.21.5[ssl] )
+       system-nghttp2? ( net-libs/nghttp2 )
        sys-libs/zlib
        virtual/pkgconfig
        emacs? ( >=app-editors/emacs-23.1:* )
@@ -209,6 +210,8 @@ src_configure() {
                -DBUILD_TESTING=$(usex test)
        )
        use qt5 && mycmakeargs+=( -DBUILD_QtDialog=ON )
+       use !system-curl && mycmakeargs+=( -DCMAKE_USE_SYSTEM_LIBRARY_CURL=OFF )
+       use !system-nghttp2 && mycmakeargs+=( -DCMAKE_USE_SYSTEM_LIBRARY_NGHTTP2=OFF )
 
        cmake_src_configure
 }
```

Should I send out a PR with the change?
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-01 13:24:14 UTC
WFM, fancy doing a PR?
Comment 2 Raul Rangel 2023-11-01 14:49:56 UTC
Sure, I wast just double checking before hand. Thanks!
Comment 3 Raul Rangel 2023-11-01 15:44:57 UTC
Just FYI, I filed a bug upstream about building without curl or nghttp2: https://gitlab.kitware.com/cmake/cmake/-/issues/25381
Comment 4 Raul Rangel 2023-11-01 18:04:03 UTC
Turns out I misdiagnosed the problem. `USE=-http2 emerge curl && emerge cmake` breaks the dependency cleanly. So nothing really to fix here.

I did have a question about the `ssl` constraint (i.e., `net-misc/curl-7.21.5[ssl]`). Can we drop it? I was able to build without curl having SSL enabled. In my environment we never make network requests when building, so I'm trying to slim down `curl`.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-27 02:02:16 UTC
I think there is still a problem here -- it's automagically depending on nghttp2 if it's installed, but the dependencies of the package don't reflect it.

(And yes, OK, WFM.)