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

Error in compile: Expected action_config for 'objc-compile' to be configured #21014

Open
trammel-may opened this issue Jan 24, 2024 · 12 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules team-Rules-ObjC Issues for Objective-C maintainers type: bug

Comments

@trammel-may
Copy link

trammel-may commented Jan 24, 2024

Description of the bug:

Context

I am trying to get a minimal example a glfw project running on my mac m1 in bazel. My build file for glwf includes an objc_library which is giving me a headache but I think its the last roadblock before I get my example running.

Error

I get the following error when running the binary of the minimal example:

Error in compile: Expected action_config for 'objc-compile' to be configured

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

I have created a SSCCE to replicate the issue here

  1. clone the repo
  2. navigate to the project workspace
  3. run the following:
./bazel run //packages/example

Which operating system are you running Bazel on?

MacOS Version 14.2.1 (23C71)

What is the output of bazel info release?

release 6.4.0

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.

not that I know of

Have you found anything relevant by searching the web?

I have searched around looking for the answer to this to no avail. Mostly I am pointed in the direction of this being a crosstool error (which it shouldn't be) or an xcode not installed issue.

Any other information, logs, or outputs that you want to share?

Machine: 2020 Mac M1 Mac Mini
OS: Version 14.2.1 (23C71)
Bazel Version: 6.4.0
Xcode Version: 15.2

@bfsoyc
Copy link

bfsoyc commented Jan 25, 2024

@mayt-moonboy Did you have Xcode installed?

@trammel-may
Copy link
Author

@mayt-moonboy Did you have Xcode installed?

Yes. My xcode version is listed in the other information section.

@keith
Copy link
Member

keith commented Jan 25, 2024

I don't see the same failure mode when testing locally, can you pass --xcode_version=15.2 to potentially kick bazel into using that if it somehow picked the command line tools instead? Alternatively you can inspect the contents of bazel-out/../external/local_config_cc/BUILD and bazel-out/../external/local_config_xcode/BUILD to make sure things didn't silently fail somehow

@trammel-may
Copy link
Author

trammel-may commented Jan 25, 2024

./bazel run //packages/example --xcode_version=15.2
INFO: Build option --xcode_version has changed, discarding analysis cache.
ERROR: /private/var/tmp/_bazel_trammelmay/dde546f78e35dbbd51fa07a6dd693b93/external/glfw/BUILD.bazel:133:13: in objc_library rule @glfw//:glfw_src_darwin: Expected action_config for 'objc-compile' to be configured
ERROR: /private/var/tmp/_bazel_trammelmay/dde546f78e35dbbd51fa07a6dd693b93/external/glfw/BUILD.bazel:133:13: in objc_library rule @glfw//:glfw_src_darwin: 
Traceback (most recent call last):
        File "/virtual_builtins_bzl/common/objc/objc_library.bzl", line 57, column 82, in _objc_library_impl
        File "/virtual_builtins_bzl/common/objc/compilation_support.bzl", line 315, column 50, in _register_compile_and_archive_actions
        File "/virtual_builtins_bzl/common/objc/compilation_support.bzl", line 392, column 66, in _cc_compile_and_link
        File "/virtual_builtins_bzl/common/objc/compilation_support.bzl", line 184, column 29, in _compile
Error in compile: Expected action_config for 'objc-compile' to be configured
ERROR: /private/var/tmp/_bazel_trammelmay/dde546f78e35dbbd51fa07a6dd693b93/external/glfw/BUILD.bazel:133:13: Analysis of target '@glfw//:glfw_src_darwin' failed
ERROR: Analysis of target '//packages/example:example' failed; build aborted: 
INFO: Elapsed time: 1.056s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (36 packages loaded, 332 targets configured)

@keith
Copy link
Member

keith commented Jan 25, 2024

I can reproduce this error in a VM where I only have the command line tools, is xcode-select -p correctly pointing to Xcode vs the command line tools? I think there's an issue where after you setup Xcode the first time (open it to make sure you accept the license etc), you have to run bazel clean --expunge and then build again

@trammel-may
Copy link
Author

xcode-select -p
/Applications/Xcode.app/Contents/Developer

I also just started a new project in xcode to confirm it is set up properly. Everything appears to be fine in that regard.

@bfsoyc
Copy link

bfsoyc commented Jan 26, 2024

@mayt-moonboy Did you have Xcode installed?

Yes. My xcode version is listed in the other information section.

I have the same env setting with yours. I suppose you could reboost the system to check if everything goes ok then.
The code you provided runs sucess by my side.

@trammel-may
Copy link
Author

@mayt-moonboy Did you have Xcode installed?

Yes. My xcode version is listed in the other information section.

I have the same env setting with yours. I suppose you could reboost the system to check if everything goes ok then. The code you provided runs sucess by my side.

Thanks. Yes I have tried rebooting, and yesterday I installed an os update as well. All to no avail. I am getting the same error.

@trammel-may
Copy link
Author

I uninstalled xcode and am currently reinstalling. I will report back success or failure.

@trammel-may
Copy link
Author

unforutnately, that did not work.

@comius comius added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed untriaged labels Jan 29, 2024
@comius
Copy link
Contributor

comius commented Jan 29, 2024

Do you have --platforms set to point to one of Apple platforms, defined in @apple_support?

@trammel-may
Copy link
Author

Do you have --platforms set to point to one of Apple platforms, defined in @apple_support?

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules team-Rules-ObjC Issues for Objective-C maintainers type: bug
Projects
None yet
Development

No branches or pull requests

7 participants
@keith @comius @trammel-may @bfsoyc @iancha1992 @rakshitasingh05 and others