http: fail loudly when wxUSE_WEBREQUEST is not set - #481
Merged
Conversation
got3nks
force-pushed
the
http-wxwebrequest-guard
branch
2 times, most recently
from
April 26, 2026 13:27
d7f50aa to
68faca9
Compare
CHTTPDownloadThread is built directly on top of wxWebRequest /
wxWebSession / wxWebRequestEvent, all of which are gated on
wxUSE_WEBREQUEST in wx/webrequest.h. wxUSE_WEBREQUEST is itself
gated on a backend being present at wx-build time:
Linux / *BSD : wxUSE_WEBREQUEST_CURL (libcurl)
Windows : wxUSE_WEBREQUEST_WINHTTP
macOS / iOS : wxUSE_WEBREQUEST_URLSESSION (NSURLSession)
When wx was compiled without that backend - wxGTK on Gentoo with
USE="-curl", a hand-rolled wx source build that did not pick up
libcurl, etc. - wxUSE_WEBREQUEST collapses to 0 and none of the
classes we depend on are defined. The compile then fails with a
cascade of "wxWebRequest does not name a type" / "wxWebSession has
not been declared" / "wxEVT_WEBREQUEST_STATE was not declared"
diagnostics. The "did you mean wxWebRequestEvent?" hint that follows
is misleading - that name is only visible because of our forward
declaration further down the same header, not because wx provides it.
Add a single #if/#error at the top of HTTPDownload.h so the next
person to build aMule against a wx without wxWebRequest gets one
actionable line pointing at the missing backend, instead of having
to bisect the wall of cascading errors above.
Distro CI (Ubuntu, Debian, Fedora, etc.) ships wxgtk with libcurl,
which is why this hasn't surfaced on the project's GitHub Actions
runners. Reported by @perfect7gentleman on Gentoo in
amule-project#479.
got3nks
force-pushed
the
http-wxwebrequest-guard
branch
from
April 26, 2026 13:28
68faca9 to
e1f4877
Compare
mrjimenez
pushed a commit
to mrjimenez/amule
that referenced
this pull request
Jul 15, 2026
…headers are missing (amule-project#483) FindReadline set HAVE_LIBREADLINE from a check_function_exists(readline) that a bare runtime library -- or libedit's readline() compatibility symbol -- also satisfies, while the header probes look only for <readline.h> / <readline/readline.h>. On a box with the library but no development headers (e.g. Alpine with libedit-dev but no readline-dev), config.h carried HAVE_LIBREADLINE with no header macro, and ExternalConnector.cpp -- which gates its rl_* block on HAVE_LIBREADLINE alone -- failed deep in the build with "rl_compentry_func_t does not name a type" and friends (amule-project#481). Require a usable header too: when the library is found but neither header is, stop at configure time with a message naming the missing package (Alpine readline-dev / Debian libreadline-dev / Fedora readline-devel / Homebrew readline) instead of a confusing mid-build error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the diagnostic gap surfaced by #479.
CHTTPDownloadThreadis built directly on top ofwxWebRequest/wxWebSession/wxWebRequestEvent, all of which are gated onwxUSE_WEBREQUESTinwx/webrequest.h.wxUSE_WEBREQUESTis itself gated on a backend being present at wx-build time:wxUSE_WEBREQUEST_CURLwxUSE_WEBREQUEST_WINHTTPwxUSE_WEBREQUEST_URLSESSIONWhen wx is compiled without that backend — wxGTK on Gentoo with
USE="-curl", a hand-rolled wx source build that didn't pick up libcurl, etc. —wxUSE_WEBREQUESTcollapses to 0 and none of the classes we depend on are defined. The compile then fails with a wall of "wxWebRequest does not name a type", "wxWebSession has not been declared", "wxEVT_WEBREQUEST_STATE was not declared" diagnostics. The "did you meanwxWebRequestEvent?" hint that follows is misleading — that name is only visible because of our forward declaration further down the same header (HTTPDownload.h:36), not because wx provides it.What changes
A
check_cxx_source_compilesprobe added tocmake/wx.cmakeafterfind_package(wxWidgets ...), gated onwx_NEED_NET(the same flag that pulls in thenetcomponent for HTTPDownload). The probe includes<wx/webrequest.h>against the wx include dirs and definitions reported by FindwxWidgets, and fails the configure step with a clearFATAL_ERRORifwxUSE_WEBREQUESTis 0.Two small details worth noting in the cmake change:
wxWidgets_DEFINITIONSis reported by FindwxWidgets as bare names (WXUSINGDLL,__WXGTK__,_FILE_OFFSET_BITS=64); we re-prefix each with-Dbefore assigning toCMAKE_REQUIRED_DEFINITIONS. Without that,wx/defs.htrips its own "No Target! You should use wx-config program for compilation flags!" #error and the probe fails for the wrong reason.CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARYkeeps the probe compile-only — we are inspecting a preprocessor symbol fromwx/setup.h, not exercising any wx symbols, so we don't needCMAKE_REQUIRED_LIBRARIESwired up.Why CI didn't see this
Distro CI (Ubuntu, Debian, Fedora) ships
wxgtkwith libcurl, sowxUSE_WEBREQUEST=1is the default and the project's GitHub Actions runners never hit this path. Gentoo is unusual because users compile wx themselves with explicitUSEflags.Test plan
Verified both directions on the same Linux ARM64 box, by switching only the wx that
find_package(wxWidgets)resolves:Positive — Ubuntu distro
wxgtk-3.2.8(wxUSE_WEBREQUEST=1, wxUSE_WEBREQUEST_CURL=1):Negative — hand-built
wx-3.3.2configured without libcurl (wxUSE_WEBREQUEST=0,wxUSE_WEBREQUEST_CURL=0, mirroring the GentooUSE="-curl"shape):macOS Cocoa GUI build (Homebrew
wxwidgets-3.3.2,wxUSE_WEBREQUEST=1) — clean.