Skip to content

Commit c98deec

Browse files
committed
chore(compat.opencv): drop temp diagnostics + simplify now-tri-platform test
All three platforms build green, so remove the debug scaffolding and the per-platform gating that only existed while opencv was Linux-only: - descriptor: drop the trace()/diag_path/_dump_diagnostics on-disk-file scaffolding; on failure just log.error the build-log path (compat.openblas pattern). Refresh the stale header comment (macOS/Windows are done, not follow-ups). - validate.yml: drop MCPP_VERBOSE=1 and the 'opencv build-log on failure' step. - test project: collapse the three identical cfg(linux|macos|windows) dependency blocks into one unconditional [dependencies.compat]; drop roundtrip.cpp's #if defined(__linux__|__APPLE__|_WIN32) guard + #else no-op main.
1 parent 84d5e5d commit c98deec

4 files changed

Lines changed: 24 additions & 103 deletions

File tree

‎.github/workflows/validate.yml‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -190,38 +190,11 @@ jobs:
190190
shell: bash
191191
env:
192192
MCPP_INDEX_MIRROR: GLOBAL
193-
MCPP_VERBOSE: "1" # TEMP: surface install() hook error detail for macOS debug
194193
run: |
195194
"$MCPP" --version
196195
# No `timeout` wrapper: absent on macOS runners; job-level timeout-minutes bounds it.
197196
"$MCPP" test --workspace
198197
199-
# TEMP diagnostic (remove before merge): xim's interface mode hides install()
200-
# source-build output; on failure surface the opencv build log from the runner.
201-
- name: opencv build-log on failure
202-
if: failure()
203-
shell: bash
204-
run: |
205-
# Cross-platform (linux/macOS/Windows-Git-Bash). The hook writes trace/diag
206-
# under $RUNNER_TEMP (set on every runner OS); convert to a bash path on
207-
# Windows. xim's interface mode hides install() output, so these files +
208-
# the on-disk build log are the only window into a source-build failure.
209-
d="$RUNNER_TEMP"
210-
command -v cygpath >/dev/null 2>&1 && d="$(cygpath -u "$RUNNER_TEMP")"
211-
echo "=== opencv install() trace ==="
212-
cat "$d/ocv_trace.txt" 2>/dev/null || echo "(no trace)"
213-
echo "=== opencv install() diag (build log / error, written by the hook) ==="
214-
cat "$d/ocv_diag.txt" 2>/dev/null || echo "(no diag)"
215-
echo "=== opencv build log(s) ==="
216-
find . -name 'mcpp_opencv_build.log' 2>/dev/null | while read -r f; do
217-
echo "--- $f ---"; cat "$f"; echo "--- end ---"
218-
done || true
219-
echo "=== opencv store tree (did cmake even run?) ==="
220-
find . -path '*compat.opencv*4.13.0' -type d 2>/dev/null | head -1 | while read -r t; do ls -la "$t" 2>/dev/null | head; done || true
221-
echo "=== compiler sanity ==="
222-
command -v clang clang++ clang-cl gcc 2>/dev/null || true
223-
xcrun --show-sdk-path 2>/dev/null || echo "(no xcrun)"
224-
225198
# ── Exception: the public `imgui` C++23-module package (namespace "") ──
226199
# Not yet a workspace member: its package has an empty namespace (the builtin
227200
# default index), which a workspace member can't point at a local path the way

‎pkgs/c/compat.opencv.lua‎

Lines changed: 18 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
-- .agents/docs/2026-07-08-opencv-implementation-and-verification.md.
1212
--
1313
-- HOST-FREE / ecosystem-closed: the build uses ONLY ecosystem tools — xim:cmake,
14-
-- xim:make, xim:gcc (declared build-deps) — never host cmake/make/gcc. Verified
15-
-- offline under a network-isolated namespace (unshare -rn): zero downloads (gapi's
16-
-- ADE fetch is killed by WITH_ADE=OFF); everything else is compiled from the
17-
-- tarball's bundled 3rdparty/ (zlib + libpng + libjpeg-turbo built via BUILD_*=ON).
14+
-- xim:ninja + the per-OS compiler (declared build-deps) — never host
15+
-- cmake/ninja/compiler. Zero downloads at build time (gapi's ADE fetch is killed by
16+
-- WITH_ADE=OFF); everything else is compiled from the tarball's bundled 3rdparty/
17+
-- (zlib + libpng + libjpeg-turbo built via BUILD_*=ON).
1818
--
1919
-- MVP module set (this recipe): core + imgproc + imgcodecs (BUILD_LIST). This is a
2020
-- fixed, curated profile — OpenCV's WITH_*/BUILD_opencv_* toggles CANNOT be mcpp
@@ -23,19 +23,15 @@
2323
-- variants (calib3d/dnn/highgui/contrib) are separate follow-up packages, not
2424
-- per-consumer features. See the impl doc §"generic mcpp asks".
2525
--
26-
-- ABI: OpenCV is C++, so its .a must be linked by the SAME C++ ABI (libstdc++) as
27-
-- the consumer. install() builds with xim:gcc (gcc/libstdc++); the consumer must use
28-
-- a gcc toolchain (the test project pins gcc@16.1.0). A clang/libc++ consumer would
29-
-- ABI-clash — this is the toolchain-handshake gap noted in the impl doc.
26+
-- ABI: OpenCV is C++, so its static libs must be linked by the SAME C++ ABI as the
27+
-- consumer. install() therefore builds with the compiler whose ABI matches each
28+
-- platform's mcpp consumer — Linux gcc/libstdc++, macOS clang/libc++ (xim:llvm),
29+
-- Windows clang-cl/msvc-stl — selected in install() by os.host(). See that function
30+
-- for the per-platform toolchain + build-env details.
3031
--
31-
-- Verified locally (mcpp 0.0.85, linux x86_64): build → link → run green
32-
-- (opencv ok=1 core=4x4x3 gray(blue)=29 png_bytes=82 decoded=4x4). macOS follows the
33-
-- same source-CMake path but is NOT yet verified — its default toolchain is clang
34-
-- (libc++), which would ABI-clash with the gcc/libstdc++ .a this recipe builds
35-
-- (the toolchain-handshake gap); making macOS use gcc, or building with the
36-
-- consumer's compiler, is a follow-up. Windows (MSVC-ABI clang vs OpenCV CMake) is
37-
-- likewise a follow-up. The test project is therefore LINUX-GATED for now
38-
-- (gui-stack precedent): off-linux it is a clean no-op.
32+
-- All three platforms build → link → run green in CI (workspace linux/macOS/windows):
33+
-- the roundtrip test asserts core (4x4x3 BGR), imgproc (BGR->GRAY, blue luma 29) and
34+
-- imgcodecs (PNG encode/decode round-trip).
3935
package = {
4036
spec = "1",
4137
namespace = "compat",
@@ -152,14 +148,6 @@ local function sh_quote(value)
152148
return "'" .. tostring(value):gsub("'", "'\\''") .. "'"
153149
end
154150

155-
-- TEMP diagnostics path — cross-platform (no /tmp on Windows). GitHub sets
156-
-- RUNNER_TEMP on every runner OS; the CI step cats these files after a failure.
157-
local function diag_path(name)
158-
local base = os.getenv("RUNNER_TEMP") or os.getenv("TMPDIR")
159-
or os.getenv("TEMP") or "/tmp"
160-
return path.join(base, name)
161-
end
162-
163151
-- Tools are invoked by BARE name, resolved off the install() PATH that xim sets up
164152
-- from the declared build-deps (the compat.openblas `CC=gcc` approach). This is
165153
-- deliberate: xim:cmake is glibc-dynamic, so exec'ing its raw binary by absolute
@@ -182,20 +170,9 @@ local function find_srcroot(version)
182170
end
183171

184172
local function _install_impl()
185-
-- [TEMP macOS debug] on-disk trace: the install() failure is invisible under
186-
-- xim's interface mode; write progress to $HOME so CI can surface where it dies.
187-
local _trbuf = ""
188-
local function trace(s)
189-
_trbuf = _trbuf .. tostring(s) .. "\n"
190-
pcall(function() io.writefile(diag_path("ocv_trace.txt"), _trbuf) end)
191-
end
192-
trace("enter host=" .. tostring(os.host()))
193173
local version = pkginfo.version()
194174
local prefix = pkginfo.install_dir()
195175
local srcroot = find_srcroot(version)
196-
trace("version=" .. tostring(version))
197-
trace("prefix=" .. tostring(prefix))
198-
trace("srcroot=" .. tostring(srcroot) .. " isdir=" .. tostring(os.isdir(srcroot)))
199176

200177
local jobs = (os.default_njob and os.default_njob()) or 4
201178

@@ -316,14 +293,10 @@ local function _install_impl()
316293
-- compat.openblas). Then build out-of-source into ./_bld and install
317294
-- headers+libs back into prefix, which is now the cwd.
318295
os.tryrm(prefix)
319-
trace("compiler gcc=" .. tostring(gcc) .. " gxx=" .. tostring(gxx) .. " isMac=" .. tostring(isMac))
320-
trace("libenv=[" .. tostring(libenv) .. "]")
321296
os.mv(srcroot, prefix)
322297
os.cd(prefix)
323-
trace("after mv+cd, prefix isdir=" .. tostring(os.isdir(prefix)))
324298

325299
local logf = path.join(prefix, "mcpp_opencv_build.log")
326-
trace("about to run cmake configure; logf=" .. tostring(logf))
327300

328301
-- Value quoting differs by driver: the linux/macOS build runs through bash
329302
-- (sh_quote), Windows through cmd (see the exec branch) where single quotes
@@ -457,29 +430,15 @@ local function _install_impl()
457430
return true
458431
end
459432

460-
-- Surface the on-disk build log to the console on ANY failure. xim's interface
461-
-- mode suppresses the cmake/make subprocess stdout, so without this a failed CI
462-
-- build is invisible (the only symptom is the downstream "opencv2/core.hpp: No
463-
-- such file"). Fires whether _install_impl raised or returned false.
464-
-- xlings' interface mode swallows log.*/subprocess output, so write the failure
465-
-- detail to a file the CI step can `cat` instead of logging it.
466-
local function _dump_diagnostics(raised, err)
467-
local out = {}
468-
if raised then table.insert(out, "install() raised: " .. tostring(err)) end
469-
local logf = path.join(pkginfo.install_dir(), "mcpp_opencv_build.log")
470-
if os.isfile(logf) then
471-
table.insert(out, "---- mcpp_opencv_build.log ----\n" .. tostring(io.readfile(logf)))
472-
else
473-
table.insert(out, "no build log at " .. logf)
474-
table.insert(out, "PATH=" .. tostring(os.getenv("PATH")))
475-
end
476-
pcall(function() io.writefile(diag_path("ocv_diag.txt"), table.concat(out, "\n") .. "\n") end)
477-
end
478-
479433
function install()
480434
local ok, ret = pcall(_install_impl)
481435
if not ok or ret == false then
482-
_dump_diagnostics(not ok, ret)
436+
-- Point at the on-disk build log: xim's interface mode suppresses the
437+
-- cmake subprocess stdout, so the log is the only record of a failed
438+
-- source build (the compat.openblas pattern).
439+
local logf = path.join(pkginfo.install_dir(), "mcpp_opencv_build.log")
440+
log.error("compat.opencv install() failed (%s); see %s",
441+
ok and "returned false" or tostring(ret), logf)
483442
return false
484443
end
485444
return true

‎tests/examples/opencv/mcpp.toml‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
# OpenCV test project. compat.opencv builds core+imgproc+imgcodecs from source via
22
# its install() CMake hook (host-free: ecosystem xim:cmake/ninja + per-OS compiler)
3-
# and links the static module libs. All three platforms are wired, each with the
4-
# compiler whose ABI matches that platform's mcpp consumer: linux gcc/libstdc++,
5-
# macOS clang/libc++, Windows clang-cl/msvc-stl. Resolves compat.opencv from this
6-
# repo's own index.
3+
# and links the static module libs. Supported on all three platforms, each with the
4+
# compiler whose ABI matches that platform's mcpp consumer (linux gcc/libstdc++,
5+
# macOS clang/libc++, Windows clang-cl/msvc-stl), so the dependency is unconditional.
6+
# Resolves compat.opencv from this repo's own index.
77
[package]
88
name = "opencv-tests"
99
version = "0.1.0"
1010

1111
[indices]
1212
compat = { path = "../../.." }
1313

14-
[target.'cfg(linux)'.dependencies.compat]
15-
opencv = "4.13.0"
16-
17-
[target.'cfg(macos)'.dependencies.compat]
18-
opencv = "4.13.0"
19-
20-
[target.'cfg(windows)'.dependencies.compat]
14+
[dependencies.compat]
2115
opencv = "4.13.0"

‎tests/examples/opencv/tests/roundtrip.cpp‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// compat.opencv end-to-end assertion across core + imgproc + imgcodecs, linked
22
// against the static libs built from source by the package's install() CMake hook.
3-
// Wired on linux/macOS/Windows (see mcpp.toml); on any other platform this is a
4-
// no-op main so `mcpp test --workspace` stays clean.
5-
#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
3+
// Runs on all three supported platforms (linux/macOS/Windows).
64
#include <opencv2/core.hpp>
75
#include <opencv2/imgproc.hpp>
86
#include <opencv2/imgcodecs.hpp>
@@ -28,6 +26,3 @@ int main() {
2826

2927
return 0;
3028
}
31-
#else
32-
int main() { return 0; } // compat.opencv is Linux-only for now; no-op elsewhere
33-
#endif

0 commit comments

Comments
 (0)