Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bus Error 10 (crash) caused by conflicting symbols in third_party/getopt (With Patch) #7551

Open
beschulz opened this issue Feb 4, 2024 · 0 comments
Assignees
Labels
build Build & build system issues macos Issue/feature request for macOS only

Comments

@beschulz
Copy link

beschulz commented Feb 4, 2024

⚠️ Issues not using this template will be systematically closed.

Describe the bug
I'm on macOS. Xcode ships with getopt. the tools link against the getopt in third_party and (presumably) indirectly against the system provided getopt. everything builds fine, but when I run for example glslminifier it crashes with a Bus Error 10 in line 44 in getopt.c (optopt = c;). After I removed the global "optarg" and "optopt" variables from getopt.c, it still compiled and linked, but the crash was gone.

To Reproduce
Steps to reproduce the behavior:

  1. clone and build filament.

Note: I did not have this problem on my M1 macbook, only on my Intel iMac. So there seems to be some other factor involved here.

Expected behavior
The freshly compiled tools don't crash with a Bus Error 10 when invoked by successive build steps.

Screenshots
N/A

Logs
N/A

Desktop (please complete the following information):

  • OS: macOS 13.2.1, Xcode 13.4.1 & Xcode 14.3.1
  • GPU: not Relevant
  • Backend: not Relevant

Additional context
Two possible solutions:

  1. link against the system getopt when it is available. This involves changing the includes to #include <getopt.h>, searching for the library, etc.
  2. avoid the clash by moving all the symbols of the third_party getopt implementation into a separate namespace. It's a bit extreme as it involves dropping plain c support, but it was easy to do and considering that getopt here is used as a utility library that probably won't be touched again, I'm willing to accept this. Patch attached.

filament-50f605e-fixes Bus Error 10 caused by symbols clashing with system provided getopt..patch

@pixelflinger pixelflinger added macos Issue/feature request for macOS only build Build & build system issues labels Feb 5, 2024
@pixelflinger pixelflinger self-assigned this Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build & build system issues macos Issue/feature request for macOS only
Projects
None yet
Development

No branches or pull requests

2 participants