Skip to content

Commit 4dabc28

Browse files
committed
fix(pkg): use host compiler for libevent probes
1 parent b6b75d0 commit 4dabc28

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎.agents/docs/2026-10-02-add-libevent-plan.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
- License: BSD-3-Clause for the main sources, ISC for arc4random included by `evutil_rand.c`, and MIT for the Windows timer code derived from libutp (`evutil_time.c`; see upstream LICENSE). The separate wepoll and TLS integrations are not compiled.
77
- Mirror: no GitCode credentials/assets available; use a plain upstream URL (not a fictional CN URL).
88
- Local Linux verification: mcpp 2026.10.1.2 `mcpp xpkg parse --all-os pkgs/c/compat.libevent.lua` reports 24/24/25 sources; cold `mcpp test -p libevent --cache off` passed under GCC 16.1.0. The test deliberately uses `EVLOOP_ONCE` because `event_base_dispatch()` returns one after a one-shot timer drains the queue even when its callback ran.
9-
- Linux, macOS and Windows passed the fork-only [final mcpp 2026.10.1.2 matrix](https://github.com/XxingGoD/mcpp-index/actions/runs/36916893185); each ran `mcpp xpkg parse --all-os` and `mcpp test -p libevent --cache off`. The Windows source hook uses `cmd /c` for CMake; the behavior test initializes and cleans up Winsock, avoiding libevent's uninitialized-Winsock warning. A local Linux LLVM 22.1.8 test also passed. The temporary workflow used to obtain the matrix has been removed; its logs remain available from the linked fork run. No PR has been opened.
9+
- The first PR #503 Linux-GCC CI run found CMake's platform probes produced an incomplete `event-config.h` (missing pointer-size and socket/address-family macros) when run through the ambient toolchain wrapper. The install hook now selects native `/usr/bin/cc` for CMake's Linux/macOS host probes; mcpp still compiles the package sources with the selected consumer compiler. A cold Linux GCC build passes with this fix; the PR's next matrix must reconfirm Linux, macOS and Windows.

‎pkgs/c/compat.libevent.lua‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ function install()
103103
local command = quote(cmake) .. " -S " .. quote(srcroot)
104104
.. " -B " .. quote(path.join(prefix, "config"))
105105
.. " -DCMAKE_POLICY_VERSION_MINIMUM=3.5"
106+
-- Probe the native platform with its system compiler, not a toolchain
107+
-- wrapper whose sysroot may differ from the generated headers' ABI.
108+
.. (os.host() == "windows" and "" or " -DCMAKE_C_COMPILER=/usr/bin/cc")
106109
.. " -DEVENT__DISABLE_OPENSSL=ON -DEVENT__DISABLE_MBEDTLS=ON"
107110
.. " -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON"
108111
.. " -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__LIBRARY_TYPE=STATIC"

0 commit comments

Comments
 (0)