fix(linux): POSIX sh launch wrappers for all executables; load GL via system GLEW - #76
Merged
Merged
Conversation
… system GLEW Two Linux runtime problems found by the new CI tests. #66 -- launch wrappers - The rv->utv target rename broke the <target>.wrapper lookup in rv_stage, so utvio, utvls, utvpkg, utvpush, utvshell, utvprof and the main app were staged without wrappers and could not find their libraries. The wrappers also required tcsh and hard-coded binary names. - rv_stage now installs a wrapper for every Linux executable: the target's own <target>.wrapper if present, otherwise the new generic src/bin/linux_wrapper.sh. Both are POSIX sh, resolve symlinks (rv, rvio, ...) with readlink -f, exec <name>.bin, and put UTV's lib, bundled OpenSSL and the dependency prefix (UTV_DEPS_ROOT, or Homebrew incl. opt/*/lib) on LD_LIBRARY_PATH. - The main app keeps its extras (-d/--debug via gdb, padsp, unsetting QT_PLUGIN_PATH/LANG) in src/bin/apps/rv/utv.wrapper; the 16 per-tool tcsh wrappers are removed. #68 -- GL extension entry points on Mesa - Linux linked GL extension functions directly (GL_GLEXT_PROTOTYPES), which Mesa's libGL does not export (e.g. glBlitFramebufferEXT), so binaries failed to load on AMD/Intel/software GL. - Define TWK_USE_GLEW on Linux and load entry points through the system GLEW 2.x (shared libGLEW, already linked by TwkGLF), as Windows does with its bundled GLEW. - New TWK_GLEW_INIT(proc) in TwkGLF/GL.h: glewInit(proc) for the bundled Windows GLEW; glewContextInit() on Linux, which does not require a GLX display and so also works with EGL (Qt on Wayland). - Initialize GLEW in utvio's offscreen GLX context (FBOVideoDevice) and include GLEW before gl.h in the Linux paths that mix Qt and GL. CI: the Linux ctest step no longer sets LD_LIBRARY_PATH or excludes tests, and utvio is no longer an expected failure in cli-smoke. Fixes #66 Fixes #68 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
TwkGLFMesa includes osmesa.h, which needs the GLAPI macro from Mesa's gl.h; glew.h (pulled in through TwkGLF/GL.h now that Linux uses GLEW) undefines it. Compile the library with TWK_USE_MESA, the existing switch in GL.h for this case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
… GLEW MuUICommands.cpp and PyUICommands.cpp included TwkGLF/GL.h first only on Windows, so on Linux Qt/Python headers pulled in gl.h before glew.h. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
1 task done
- FBOVideoDevice created its hidden GLX window with the visual's depth (32-bit ARGB on Mesa) under a 24-bit root without CWBorderPixel, which X rejects with BadMatch, killing utvio. Set border_pixel. - format_roundtrip: report the "X Error" line for X11 protocol errors. - Linux CI: exclude ApplicationTest and AudioRendererTest, which now load (#68) but crash in their test bodies (#78). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
- Launch wrappers added every Homebrew opt/*/lib (and the combined lib/) to LD_LIBRARY_PATH. Homebrew installs its own Mesa, libdrm and LLVM as glew dependencies, so its software libGL replaced the system driver: on CI that meant a 32-bit visual and X errors in utvio (BadMatch, then BadAccess), and on NVIDIA desktops it would have replaced the GPU driver. Use per-formula lib/lib64 directories only, skip mesa, libglvnd, libdrm, llvm*, libpciaccess and libxshmfence, and fall back to <prefix>/lib for a plain (non-Homebrew) UTV_DEPS_ROOT. - Distro GLEW 2.2 (e.g. Ubuntu 24.04) doesn't export glewContextInit(). TWK_GLEW_INIT now calls glewInit() and treats GLEW_ERROR_NO_GLX_DISPLAY (EGL context: GL entry points already loaded) as success, which works with GLEW 2.2 and 2.3 under GLX and EGL. Verified locally in an Ubuntu 24.04 container: the utvio GLX setup under Xvfb with the system Mesa gets a 24-bit visual, llvmpipe, a complete RGBA16F FBO and reads back 4.0; the wrapper resolves rvio -> utvio.bin, skips the GL stack kegs and preserves arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
TwkGLFMesa compiles with TWK_USE_MESA, which keeps glew.h out of TwkGLF/GL.h; the inline helper referenced GLEW symbols there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
Removing Homebrew's Mesa from LD_LIBRARY_PATH wasn't enough: Homebrew libraries (e.g. libGLEW, Qt) carry a RUNPATH to the Homebrew prefix, so their libGL.so.1 dependency still resolved to Homebrew's software Mesa (CI: X BadAccess in utvio under Xvfb). Preload the system libGL.so.1 and libEGL.so.1 (found via ldconfig) so every reference uses the system driver. UTV_NO_SYSTEM_GL_PRELOAD=1 disables it. CI now logs which GL libraries utvio loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
… render diagnostic Xlib's default error handler exits the process, which turned any X protocol error during utvio's offscreen rendering into a failed write with only "X Error of failed request: BadAccess" to go on. Install a handler in FBOVideoDevice that logs the error with its request codes and continues (as Qt does). CI also runs one utvio render under Xvfb and prints its output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
With utvio rendering working on Linux, 33 of 34 writable formats now round-trip; reading back the FITS file segfaults. Track it with the Windows FITS read-back failure in #67. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
1 task done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
It confirmed the launch wrappers load the system libGL; the one-render diagnostic stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Michael Oliver <mcoliver@gmail.com>
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.
Fixes #66. Fixes #68.
Linux builds couldn't run their own tools: the launch wrappers were lost in the rv → utv rename, and binaries linked OpenGL extension functions that Mesa's libGL doesn't export. This PR fixes both, and Linux CI now runs the full test suite against the result.
#66: Linux launch wrappers
rv_stagenow wraps every Linux executable (renaming the binary to<name>.bin). It uses the target's own<target>.wrapperif present, otherwise the new genericsrc/bin/linux_wrapper.sh. Previously the<target>.wrapperlookup no longer matched the renamedutv*targets, soutvio,utvls,utvpkg,utvpush,utvshell,utvprofandutvhad no wrapper.sh(notcshdependency). They resolve symlinks (rv,rvio, …) withreadlink -fand exec<name>.bin.lib/, the bundled OpenSSL (unlessRV_USE_SYSTEM_OPENSSL), and the dependency prefix (UTV_DEPS_ROOT, else Homebrew) using each formula's ownopt/<formula>/lib[64].mesa,libglvnd,libdrm,llvm*,libpciaccessandlibxshmfenceare skipped.libGL.so.1/libEGL.so.1(found vialdconfig) are preloaded.glew, replaced the system/GPU driver through library RUNPATHs.UTV_NO_SYSTEM_GL_PRELOAD=1disables the preload.-d/--debugvia gdb,padsp, unsettingQT_PLUGIN_PATH/LANG) insrc/bin/apps/rv/utv.wrapper. The 16 per-tool tcsh wrappers are removed.#68: OpenGL on Mesa
TWK_USE_GLEWon Linux: GL entry points are loaded through the system GLEW (sharedlibGLEW, one function table for all modules) instead of being linked directly (GL_GLEXT_PROTOTYPES), as Windows does with its bundled GLEW.TWK_GLEW_INIT(proc)inTwkGLF/GL.h:glewInit(proc)for the bundled Windows GLEW. On Linux it callsglewInit()and treatsGLEW_ERROR_NO_GLX_DISPLAYas success, so it works with GLEW 2.2 (distros) and 2.3 (Homebrew), under GLX and EGL/Wayland.utvio's offscreen GLX device (FBOVideoDevice):CWBorderPixel(X rejects a window whose visual depth differs from the root's without it);glXMakeCurrentfrom a second thread; GLX reportsBadAccess, and Xlib's default handler was exiting the process.gl.hin the Linux paths that mix Qt/Python headers and GL (MuUICommands.cpp,PyUICommands.cpp, …).TwkGLFMesacompiles withTWK_USE_MESA, which keeps GLEW out of it.CI
cteststep no longer setsLD_LIBRARY_PATH(the wrappers do it) and no longer excludesLoadingSharedLibrariesTestorimage-format-roundtrip.utviois no longer an expected failure incli-smoke.utviorender under Xvfb and prints the output, as a debugging aid.LoadingSharedLibrariesTestcases,cli-smoke, and the image format round-trip. macOS and Windows are green.Known issues left open
ApplicationTest/AudioRendererTestcrash in their test bodies (now that they load); excluded on Linux CI.rvio_sw(OSMesa build of rvio) still builds, but is probably broken at runtime: it relies on handing OSMesa's proc lookup to GLEW, which the system GLEW can't do. OSMesa was removed from Mesa 25.1.utviounder Xvfb/llvmpipe covers headless rendering. Decision pending on dropping it.glXMakeCurrentnow logs a warning instead of exiting. It's harmless, but worth cleaning up in the renderer.🤖 Generated with Claude Code