-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Executable built with Bazel on MacOS Monterey with XCode 13.2 throwing seg fault #14206
Comments
Solved the problem using the following steps:
Bazel looks to be completely unreliable at least after MacOS/XCode updates and the fact that a perfectly building and running project is completely broken whenever a new OS version comes out doesn't really make it funnier.... |
|
Thanks for sharing, these steps fixed the segfault for me too. |
looking at the output of /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -std=c++0x -MD -MF main.pic.d -frandom-seed=main.pic.o -fPIC -iquote . -iquote bazel-out/darwin_arm64-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/darwin_arm64-fastbuild/bin/external/bazel_tools -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c main.cpp -o main.pic.o
/usr/bin/gcc -o main main.pic.o -Wl,-S -undefined dynamic_lookup -headerpad_max_install_names
./main
zsh: segmentation fault ./main |
I have the same problem with you. And the solution is to delete the command line tools and install the xcode from app store. At the same time, note the version of the bazel . I fixed the problem with the bazel-5.4.0. |
Description of the problem / feature request:
Bazel will build a simple "Hello World" executable that is throwing a "Segmentation fault: 11" error.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
The build file is having the following content:
Main.cpp:
What operating system are you running Bazel on?
MacOS Monterey (version 12.0.1)
What's the output of
bazel info release
?release 4.2.1-homebrew
Have you found anything relevant by searching the web?
I have found something similar for earlier versions of Apple Clang.
In those cases anyway the program will through segmentation faults during the execution. In my case I will get a segmentation fault before the program is executed. (basically on anything)
https://discussions.apple.com/thread/6009790?answerId=25322969022#25322969022
I am thinking this behavior might have something to do with the default flags from the default Bazel rules for macos.
Any other information, logs, or outputs that you want to share?
I tried re-installing xcode tools, I tried cleaning bazel cache.
You can find the execution log below:
The text was updated successfully, but these errors were encountered: