Skip to content

Improve failure, fix crashes in conda environments/older libstdc++ - #112

Open
aaronj0 wants to merge 7 commits into
compiler-research:mainfrom
aaronj0:stdlib-reliability
Open

aaronj0 wants to merge 7 commits into
compiler-research:mainfrom
aaronj0:stdlib-reliability

Conversation

@aaronj0

@aaronj0 aaronj0 commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

This can be split into multiple patches but I am opening it as a single on so that it can be reviewed together.

Fail honestly on an old libstdc++ instead of crashing the process. A manylinux wheel installed on alma8, JIT-compiled code that used std::filesystem crashed the process at its first call, and a missing header produced a generic "Failed to parse the given C++ code" with the real diagnostic lost. The crash came from libcppjit.so exporting its statically linked libstdc++_nonshared copies, which the JIT resolved against instead of the host runtime. This change hides those exports, captures the compiler's real stderr into the Python exceptions, and makes a call whose wrapper cannot be JIT-compiled raise for every return type instead of returning an empty value.

Validation:

  • This also fixed the reason why test21_failing_cppcode failed, which now passes and more tests have been added.
  • Pythonized method calls that invokes JitCall wrappers now checks its result before using it. The reserve call inside the std::vector constructor used to Py_DECREF a null on a failed wrapper, which is a bug. An added test constructs a vector from a range after that wrapper's module has failed and asserts a RuntimeError instead of a process death.
  • On AlmaLinux 10 with conda LLVM 22 and numpy 2.5.3, against CppInterOp with the large-code-model fix (#1112), test_stltypes passes in every import order tried and the full suite passes.
  • A new wheels.yml job installs the manylinux wheel on almalinux:8 with its GCC 8 and runs the runtime-skew tests. It is currently red on main (process crash, empty diagnostics) and green on this branch.
  • libcppjit.so exports no strong toolchain symbols after the change. Before it exported 103 std::filesystem symbols.
  • A failed materialization still poisons the interpreter session for the symbols that module first defined. test04 records this as a strict xfail. I believe this is being worked in LLVM upstream and once we are on newer LLVM versions that include the fixes we can revisit then.

The goal is to ensure current distributions of cppjit do not crash unreasonably on diverse environments where older stdlib implementation are found.

@aaronj0 aaronj0 changed the title Improve failure, fix crashes in conda environments/older libstdc++cccccbkdlkbuiivjhhflbbuilcirjjrivuhrfifjdfbh Improve failure, fix crashes in conda environments/older libstdc++ Sep 26, 2026
@aaronj0 aaronj0 linked an issue Sep 26, 2026 that may be closed by this pull request

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflict with NumPy in test/test_stltypes.py

1 participant