Environment differences when building with Homebrew?

I’m trying to write a formula for the DXX-Rebirth project now that it’s able to be compiled just with resources out of Homebrew. However, I’m running into a strange issue that I’m not sure how to track down, so I’m wondering whether anybody here has ever seen something similar.

Building the project can be done with Homebrew-provided resources by installing the scons, sdl, sdl_image, sdl_mixer, libpng, and physfs packages, and then running the following:

scons macos_add_frameworks=False

Doing that from the terminal builds just fine. However, when I try to do that with a formula using a line that looks like this:

system "scons", "macos_add_frameworks=False"

it fails with a linker error when attempting to link the object files together. Specifically:

Undefined symbols for architecture x86_64:
  "dxx_error_object_type_mismatch()", referenced from:
      bump_this_object(valptridx<d1x::object>::ptridx<valptridx<d1x::object>::vm>, valptridx<d1x::object>::ptridx<valptridx<d1x::object>::vm>, dcx::vms_vector const&, int) in .d1x-rebirth.collide.o
  "valptridx<d1x::wall>::null_pointer_exception::report(char const*, unsigned int)", referenced from:
      valptridx<d1x::wall>::ptr<valptridx<d1x::wall>::im>::get_nonnull_pointer(char const*, unsigned int) const in .d1x-rebirth.wall.o
ld: symbol(s) not found for architecture x86_64

The problem is, I have no idea why it would be missing symbols for this architecture other than maybe some sort of environmental edge case, and I’m not really sure how to track that down. Is there any chance anybody else has run into this?

If anybody’s interested, I set up a tap with the non-working formula at https://github.com/Kreeblah/homebrew-dxx-rebirth-tap. It’s pretty basic, though. Just the dependencies, grabbing the source from Github, applying a patch I’m waiting on being incorporated into the codebase to fix a recent Mac build issue (building from the console with that patch works just fine, though), and then starting the build.

See what brew gist-logs says. It’s likely that there’s some interaction going on with superenv.

Looks like it’s failing to do that. I’m guessing with the POST payload generation? I see other Homebrew-related temp stuff in /private/tmp/, so I don’t think it’s a permissions issue there.

/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/kreeblah/homebrew-dxx-rebirth-tap/Formula/dxx-rebirth.rb
/usr/local/Homebrew/Library/Homebrew/shims/scm/git --version
/usr/bin/curl --version
/usr/libexec/java_home --xml --failfast
/usr/libexec/java_home --xml --failfast
/usr/bin/curl --disable --globoff --show-error --user-agent Homebrew/2.5.1-10-g14741e3\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 10.15.6\)\ curl/7.64.1 --retry 3 --location https://api.github.com/gists --header Accept:\ application/vnd.github.v3\+json --write-out '
'\%\{http_code\} --header Accept:\ application/vnd.github.antiope-preview\+json --user Kreeblah:****** --data @/private/tmp/github_api_post20200915-82925-zsdndm --dump-header /private/tmp/github_api_headers20200915-82925-6ma7a8
Error: Not Found
/usr/local/Homebrew/Library/Homebrew/utils/github.rb:286:in `raise_api_error'
/usr/local/Homebrew/Library/Homebrew/utils/github.rb:234:in `open_api'
/usr/local/Homebrew/Library/Homebrew/cmd/gist-logs.rb:129:in `create_gist'
/usr/local/Homebrew/Library/Homebrew/cmd/gist-logs.rb:72:in `gistify_logs'
/usr/local/Homebrew/Library/Homebrew/cmd/gist-logs.rb:144:in `gist_logs'
/usr/local/Homebrew/Library/Homebrew/brew.rb:119:in `<main>'

You need to fix the permissions on your GitHub access token. Their API doesn’t always return insufficient scope errors.