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

Unable to compile abseil-hello on MacOS Sequoia due to missing C++ standard libraries #12

Open
hiradha opened this issue Nov 15, 2024 · 1 comment

Comments

@hiradha
Copy link

hiradha commented Nov 15, 2024

I am unable to compile abseil-hello on MacOS Sequoia

`
bazel run //:hello_main
INFO: Analyzed target //:hello_main (0 packages loaded, 0 targets configured).
ERROR: /Users/popurir/abseil-hello/bazel-hello/BUILD.bazel:33:10: Compiling hello_main.cc failed: (Exit 1): cc_wrapper.sh failed: error executing CppCompile command (from target //:hello_main) external/bazel_toolscc_configure_extensionlocal_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 29 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from hello_main.cc:15:
./hello.h:15:10: fatal error: 'string' file not found
15 | #include
| ^~~~~~~~
1 error generated.
Target //:hello_main failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.155s, Critical Path: 0.92s
INFO: 18 processes: 18 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target
`

Below is Mac compilation setup details


/usr/bin/gcc --version
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: x86_64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin


softwareupdate -l
Software Update Tool

Finding available software
No new software available.


xcode-select -v
xcode-select version 2409.


xcode-select -v
xcode-select version 2409.
C02FL3VCMD6R:SDKs popurir$ xcode-select -p
/Library/Developer/CommandLineTools
C02FL3VCMD6R:SDKs popurir$ cd /Library/Developer/CommandLineTools/
C02FL3VCMD6R:CommandLineTools popurir$ ls
Library SDKs usr
C02FL3VCMD6R:CommandLineTools popurir$ cd SDKs/
C02FL3VCMD6R:SDKs popurir$ ls -lh
total 0
lrwxr-xr-x 1 root wheel 14B Nov 14 12:49 MacOSX.sdk -> MacOSX13.1.sdk
drwxr-xr-x 7 root wheel 224B Nov 12 2022 MacOSX13.1.sdk
drwxr-xr-x 8 root wheel 256B Nov 14 12:48 MacOSX14.5.sdk
lrwxr-xr-x 1 root wheel 14B Nov 13 15:39 MacOSX14.sdk -> MacOSX14.5.sdk
drwxr-xr-x 8 root wheel 256B Nov 14 12:49 MacOSX15.1.sdk
lrwxr-xr-x 1 root wheel 14B Nov 13 15:37 MacOSX15.sdk -> MacOSX15.1.sdk
lrwxr-xr-x 1 root wheel 14B Nov 13 15:40 MacOSX_old.sdk -> MacOSX15.1.sdk

@hiradha
Copy link
Author

hiradha commented Nov 15, 2024

Uninstalling and reinstalling Command Line Tools as described below seems to have fixed the issue.

https://stackoverflow.com/questions/78999694/cant-compile-c-hello-world-with-clang-on-mac-sequoia-15-0-and-vs-code

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

bazel run //:hello_main --sandbox_debug
INFO: Analyzed target //:hello_main (0 packages loaded, 0 targets configured).
INFO: From Linking external/abseil-cpp~/absl/base/libbase.a:
/Library/Developer/CommandLineTools/usr/bin/libtool: file: bazel-out/darwin_x86_64-fastbuild/bin/external/abseil-cpp~/absl/base/_objs/base/unscaledcycleclock.o has no symbols
INFO: Found 1 target...
Target //:hello_main up-to-date:
bazel-bin/hello_main
INFO: Elapsed time: 14.434s, Critical Path: 10.66s
INFO: 42 processes: 1 internal, 41 darwin-sandbox.
INFO: Build completed successfully, 42 total actions
INFO: Running command line: bazel-bin/hello_main
Hello world

However not sure what changed because the reinstalled version seems to be the same as the previous version

/usr/bin/gcc --version
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: x86_64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
C02FL3VCMD6R:~ popurir$ xcode-select --version
xcode-select version 2409.

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

No branches or pull requests

1 participant