bazel-contrib / bazel-contrib/rules_foreign_cc

make segfaults while building LuaJIT for Envoy when using bazel 7.x.y

Open
#1,338 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

We're trying to update [Envoy](https://github.com/envoyproxy/envoy/) to Bazel 7.4.1 (see https://github.com/envoyproxy/envoy/pull/37578).

One of our blockers is that our MacOS build is failing to build LuaJIT.[^1]

Digging into it, I found that the GNUMake build from rules_foreign_cc was segfaulting on `make -C src` in LuaJIT's top-level `Makefile`. Furthermore, I could reproduce this segfault using the bazel/rules_foreign_cc-built `make` on a clean checkout of LuaJIT's source, otherwise entirely outside of bazel, both at toplevel via `make -C src` and in src with just `make`. I could not reproduce the segfault with a freshly built copy of GNUMake 4.4.1, which is the same version bazel/rules_foreign_cc had.

Here's a repository containing a minimal repro based on the build in Envoy:
- https://github.com/asedeno/luajit-bazel

This works fine with bazel 6.5.0, and breaks in all bazel 7.x.y that I've tried, including but not limited to 7.0.0 and 7.4.1.

I'm out of ideas on this for the day, but figured capturing this would be useful. Again, I'm seeing this only on MacOS.

[^1]: https://github.com/envoyproxy/envoy/actions/runs/12265446817/job/34221552445#step:16:956

Contributor guide

Open the contributing guide

Research direction

Start with the minimal reproduction repository and compare the LuaJIT build using Bazel 6.5.0 versus the reported Bazel 7.x versions on macOS. Reproduce the segfault through the top-level Makefile with `make -C src` and from `src` with `make`; done means identifying the Bazel 7-related cause and establishing a verified fix or clear upstream diagnosis.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, macos
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.