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

Bazel builds using rules_cc on recent (Ventura, Sonoma) MacOS fail due to -undefined dynamic_lookup #229

Open
AIWintermuteAI opened this issue Jul 11, 2024 · 2 comments · May be fixed by #286

Comments

@AIWintermuteAI
Copy link

Description of the problem / feature request:

Bazel builds using rules_cc on recent (Ventura, Sonoma) MacOS fail with

compiling lib/findprog-in.c...
./lib/findprog-in.c:137:25: error: implicit declaration of function 'eaccess' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                    if (eaccess (progpathname, X_OK) == 0)
                        ^
./lib/findprog-in.c:137:25: note: did you mean 'access'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:431:6: note: 'access' declared here
int      access(const char *, int);
         ^
./lib/findprog-in.c:211:21: error: implicit declaration of function 'eaccess' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                if (eaccess (progpathname, X_OK) == 0)
                    ^
2 errors generated.

The root cause of this issue was that bazelbuild/bazel#16414 was not merged to rules_cc, but only to rules_llvm and apple_support. Which removed the culprit -undefined dynamic_lookup.

This issue gives more insight in the problem:
bazel-contrib/rules_foreign_cc#859 (comment)

What operating system are you running Bazel on?

image

What's the output of bazel info release?

release 6.0.0- (@non-git)

If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.

Conda forge

What version of rules_cc do you use? Can you paste the workspace rule used to fetch rules_cc? What other relevant dependencies does your project have?

    maybe(
        http_archive,
        name = "rules_cc",
        sha256 = "3d9e271e2876ba42e114c9b9bc51454e379cbf0ec9ef9d40e2ae4cec61a31b40",
        strip_prefix = "rules_cc-0.0.6",
        urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.6/rules_cc-0.0.6.tar.gz"],
    )

What Bazel options do you use to trigger the issue? What C++ toolchain do you use?

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
@phst
Copy link

phst commented Dec 4, 2024

Probably #163 should be resubmitted; it got rolled back in bc665f9. Right now the toolchain configuration in rules_cc is quite ancient :/

phst added a commit to phst/rules_cc that referenced this issue Dec 4, 2024
@phst phst linked a pull request Dec 4, 2024 that will close this issue
@phst
Copy link

phst commented Dec 4, 2024

Probably already fixed by commit c2549f6

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

Successfully merging a pull request may close this issue.

2 participants