`build` directory on macos causing glob to fail
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
I'm seeing the following failure:
```
ERROR: no such package '@@folly//': error globbing [**/*.h] op=FILES: /home/vscode/.cache/bazel/_bazel_vscode/d9fd8dd9485b3d1d1994c3846baefa35/external/folly/folly/build (No such file or directory)
ERROR: /workspaces/project-x/cpp_libs/logging/BUILD:130:11: no such package '@@folly//': error globbing [**/*.h] op=FILES: /home/vscode/.cache/bazel/_bazel_vscode/d9fd8dd9485b3d1d1994c3846baefa35/external/folly/folly/build (No such file or directory)
```
When I check the output of `ls -al /home/vscode/.cache/bazel/_bazel_vscode/d9fd8dd9485b3d1d1994c3846baefa35/external/folly/folly/build`
The directory does indeed exist:
```
total 8
drwxr-xr-x 4 vscode vscode 128 May 22 06:48 .
drwxr-xr-x 205 vscode vscode 6560 May 22 06:48 ..
-rwxrwxr-x 1 vscode vscode 2049 May 11 16:29 bootstrap-osx-homebrew.sh
-rwxrwxr-x 1 vscode vscode 3489 May 11 16:29 build-debs-ubuntu-18.04.sh
```
Attempting to add an `exclude = ["folly/build/**"]` to the `glob` rule doesn't seem to help.
My complete build rule is as follows:
```
cc_library(
name = "header_only",
hdrs = glob(["**/*.h"]),
defines = {"FOLLY_NO_CONFIG": "1"},
visibility = ["//visibility:public"],
tags = ["no-clang-tidy"],
)
```
And the library is fetched using (in my `WORKSPACE` file):
```
http_archive(
name = "folly",
build_file = "@//:third_party/folly/build_file.bazel",
sha256 = "f57f0d7726be7b0775fe717784e863866e207eff159b548a17f48d335d8e6504",
url = "https://github.com/facebook/folly/releases/download/v2024.05.13.00/folly-v2024.05.13.00.tar.gz",
)
```
I'm on bazel version 7.0.2 on Mac OS
I have the same issue with another external dependency that also has a `build` folder. If I manually delete the `build` folder or rename it to something else, then the build succeeds.
It appears this has something to do with the case-insensitive filesystem on Mac OS because the same build works fine on Ubuntu. I've even attempted to create a new case-sensitive volume that I've symlinked my `.cache/bazel` directory to and the problem still persists.
### Which category does this issue belong to?
External Dependency
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
_No response_
### Which operating system are you running Bazel on?
mac os
### What is the output of `bazel info release`?
release 7.0.2
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
_No response_
### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
_No response_
### Have you found anything relevant by searching the web?
No
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start by reproducing the failure with Bazel 7.0.2 on macOS using the cited BUILD rule, WORKSPACE http_archive, and third_party/folly/build_file.bazel. Inspect how glob(["**/*.h"]) handles the external folly/build directory and compare behavior with Ubuntu. Done means the external dependency can be built without a missing-directory glob error when a build directory exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100