"cannot enable executable stack as shared object requires" on Ubuntu 26.04
ubuntu-latest is moving from Ubuntu 24.04 to 26.04 between October 19 and November 19, 2026 (what else changes). Ubuntu 26.04 has glibc 2.43 (libc6 2.43-2ubuntu2.4 on November 4), where 24.04 has 2.39. Since glibc 2.41, dlopen no longer makes the stack executable when a shared library asks for it; loading the library fails instead (glibc NEWS, version 2.41). On 24.04, the same library loaded.
What it looks like
ERROR: Unable to load dependent library .../lib/julia/libopenlibm.so Message:.../lib/julia/libopenlibm.so: cannot enable executable stack as shared object requires: Invalid argument ImportError: libtensorflow_cc.so.2: cannot enable executable stack as shared object requires: Invalid argument MATLAB:mex:ErrInvalidMEXFile ... blosc_mex.mexa64: cannot enable executable stack as shared object requires: Invalid argument
The first is setup-julia checking julia --version, the second a Python test that imports TensorFlow, the third a MATLAB MEX file. The library named in the message is the one to fix.
Where the reports came from
- Julia 1.9.x, 1.10.0 to 1.10.8 and 1.11.0 to 1.11.3 ship a
libopenlibm.sothat asks for an executable stack, so Julia does not start (setup-julia #426). Julia 1.10.9 and 1.11.4 have the fixed openlibm; 1.9 is end of life and will not get it.version: minpicks the lowest version your compat allows, which can be 1.10.0 (RegistryCI.jl #748). - conda-forge TensorFlow 2.19.1 sets the flag on
libtensorflow_cc.so.2and three other libraries. 2.21.0 no longer does, but at the time of the report its import crashed for another reason (queens #358). - Old Python wheels, such as an onnxruntime in a Python 3.6 environment (spinalcordtoolbox #5349).
- MATLAB MEX files: R2024a's
mexlinks a resource file that has no.note.GNU-stacksection, so the linker marks the whole MEX as needing an executable stack (blosc-matlab #1).
Most of these libraries never run code on the stack. The flag usually comes from one assembly file or binary input without a .note.GNU-stack section, and the linker warns about it at build time: missing .note.GNU-stack section implies executable stack.
Find the flag
readelf -lW libopenlibm.so | grep GNU_STACK GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RWE 0x10
RWE is the problem; RW is fine. patchelf --print-execstack answers the same question.
Fix 1: use a release without the flag
For Julia, raise the lowest version to 1.10.9 (or 1.11.4) in the matrix and in [compat]. For a Python package, a newer wheel may already be built without it. This is the fix that lasts.
Fix 2: clear the flag with patchelf
- run: |
sudo apt-get update && sudo apt-get install -y patchelf
patchelf --clear-execstack "$(dirname "$(which julia)")/../lib/julia/libopenlibm.so"
Put the step after the one that installs the library (here, after setup-julia). patchelf in Ubuntu 26.04's apt is 0.18.0, which has --clear-execstack. This is safe when the library does not really execute code on its stack, which is the usual case. If it does, for example through GCC's nested functions, it crashes later with a segmentation fault, so run the tests after clearing it.
Fix 3: rebuild your own library without it
Link with -Wl,-z,noexecstack, or give each assembly file the section the linker is looking for:
.section .note.GNU-stack,"",@progbits
For a MEX file, add -Wl,-z,noexecstack to the MEX LDFLAGS, as blosc-matlab did. Then check the result with readelf -lW.
Fix 4: let glibc allow it, for now
env: GLIBC_TUNABLES: glibc.rtld.execstack=2
glibc's manual documents the value 2 for this case: the stack is made executable when the process starts, so a later dlopen of such a library works. It makes the whole process's stack executable, so treat it as a stopgap for a test job. Or keep that job on ubuntu-24.04 until GitHub retires the image.
Telling it apart
- The message ends in
Invalid argumentand the file exists. A missing file is a different failure: "cannot open shared object file" on Ubuntu 26.04. - Only libraries loaded with
dlopenafter the program has started fail this way. That is why Python imports, Julia's libraries and MEX files are the usual cases. - Look at "Set up job": the Runner Image group shows the image. Until November 19 a re-run can land on 24.04 and pass, so a green re-run proves nothing.
Other 26.04 failures
- "version `GLIBC_2.43' not found" after building on Ubuntu 26.04: glibc is 2.43, so binaries built there can need
GLIBC_2.42orGLIBC_2.43and fail to start on Ubuntu 24.04, Debian 13 and older; build releases on an older image and check the floor in CI. - rpmbuild on Ubuntu 26.04: rpm is 6.0.1, so
%installruns in a per-package build directory and Electron Forge's RPM maker fails with "cp: cannot stat 'usr/*'", and packages are v6 unless you pass_rpmformat 4. - "cannot open shared object file" on Ubuntu 26.04: libxml2 is
libxml2.so.16and ICU is 78, so a cache saved on 24.04, or a binary built for it, cannot findlibxml2.so.2orlibicudata.so.74. - libpcre3 and libpcre3-dev on Ubuntu 26.04: Ubuntu 26.04 has no PCRE1, so
libpcre3-devis gone from apt and programs built for 24.04 cannot loadlibpcre.so.3. - C and C++ builds that fail with GCC 15 on Ubuntu 26.04: the default gcc goes from 13 to 15, so C is compiled as C23, six old warnings are errors, and C++ headers no longer pull in
<cstdint>for you. - "disk quota exceeded" in /tmp on Ubuntu 26.04: the first 26.04 images had
/tmpas a tmpfs of about 7.9G with a per-user quota, so large builds in/tmpfailed; setTMPDIRto$RUNNER_TEMP. - apt on Ubuntu 26.04: renamed and removed packages.
See failed jobs from IntelliJ IDEA
Pipeline Inbox for GitHub Actions Workflows, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the runs of all your repositories in an IDE tool window, with their jobs and steps, and your current branch's runs are in the status bar. Reading is free; re-running failed jobs, cancelling, running workflows and reviewing deployments are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
GitHub and GitHub Actions are trademarks of GitHub, Inc.; Ubuntu is a trademark of Canonical Ltd.; MATLAB is a trademark of The MathWorks, Inc.; TensorFlow is a trademark of Google LLC; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with, sponsored or endorsed by GitHub, Inc., Canonical, The MathWorks, Google or JetBrains.
More: "The ubuntu-latest label will migrate to Ubuntu 26" · "cannot open shared object file" on Ubuntu 26.04 · GitHub Actions plugins for IntelliJ IDEA compared · 日本語