Skip to content

Bug: Project generation error with C++ libraries #3278

@ryanbinnsrv

Description

@ryanbinnsrv

Description

I'm getting the following error when attempting to generate an Xcode project from a minimal reproducible. For my real code, I'm seeing it for every C++ library we have in the build.

% bazel run :xcodeproj
(10:48:16) INFO: Current date is 2026-02-19
(10:48:16) INFO: Analyzed target //:xcodeproj (2 packages loaded, 11 targets configured).
(10:48:16) INFO: Found 1 target...
Target //:xcodeproj up-to-date:
  bazel-bin/xcodeproj-runner.sh
(10:48:16) INFO: Elapsed time: 0.332s, Critical Path: 0.03s
(10:48:16) INFO: 11 processes: 10 internal, 1 local.
(10:48:16) INFO: Build completed successfully, 11 total actions
(10:48:16) INFO: Running command line: bazel-bin/xcodeproj-runner.sh

Generating "bazel_test.xcodeproj"
Starting local Bazel server (9.0.0) and connecting to it...
(10:48:18) INFO: Current date is 2026-02-19
(10:48:22) ERROR: /Users/<redacted>/Library/Caches/bazel/_bazel_<redacted>/61126fd48924fbe64a0ab9748ad912bf/rules_xcodeproj.noindex/build_output_base/external/protobuf+/bazel/private/toolchains/prebuilt/BUILD.bazel:25:20: in @@rules_xcodeproj++internal+rules_xcodeproj_generated//generator/xcodeproj:defs.bzl%_aspect aspect on protoc_authenticity rule @@protobuf+//bazel/private/toolchains/prebuilt:authenticity_validation: 
Traceback (most recent call last):
	File "/Users/<redacted>/Library/Caches/bazel/_bazel_<redacted>/61126fd48924fbe64a0ab9748ad912bf/rules_xcodeproj.noindex/build_output_base/external/rules_xcodeproj+/xcodeproj/internal/xcodeproj_aspect.bzl", line 120, column 35, in _xcodeproj_aspect_impl
		info = xcodeprojinfos.make(
	File "/Users/<redacted>/Library/Caches/bazel/_bazel_<redacted>/61126fd48924fbe64a0ab9748ad912bf/rules_xcodeproj.noindex/build_output_base/external/rules_xcodeproj+/xcodeproj/internal/xcodeprojinfos.bzl", line 782, column 60, in _make_xcodeprojinfo
		automatic_target_info = calculate_automatic_target_info(
	File "/Users/<redacted>/Library/Caches/bazel/_bazel_<redacted>/61126fd48924fbe64a0ab9748ad912bf/rules_xcodeproj.noindex/build_output_base/external/rules_xcodeproj+/xcodeproj/automatic_target_info.bzl", line 309, column 40, in calculate_automatic_target_info
		this_target_type = _get_target_type(target = target)
	File "/Users/<redacted>/Library/Caches/bazel/_bazel_<redacted>/61126fd48924fbe64a0ab9748ad912bf/rules_xcodeproj.noindex/build_output_base/external/rules_xcodeproj+/xcodeproj/automatic_target_info.bzl", line 36, column 15, in _get_target_type
		if CcInfo in target:
Error: Type Target only supports querying by object constructors, got NoneType instead
(10:48:22) ERROR: Analysis of target '@@protobuf+//bazel/private/toolchains/prebuilt:authenticity_validation' (config: 75e7ef6) failed
(10:48:22) INFO: Analyzed target @@rules_xcodeproj++internal+rules_xcodeproj_generated//generator/xcodeproj:xcodeproj (179 packages loaded, 5007 targets configured, 5 aspect applications).
(10:48:22) WARNING: errors encountered while analyzing target '@@rules_xcodeproj++internal+rules_xcodeproj_generated//generator/xcodeproj:xcodeproj', it will not be built.
(10:48:22) INFO: Found 0 targets...
(10:48:22) ERROR: command succeeded, but not all targets were analyzed
(10:48:22) INFO: Elapsed time: 4.762s, Critical Path: 0.01s
(10:48:22) INFO: 1 process: 1 internal.
(10:48:22) ERROR: Build did NOT complete successfully
(10:48:22) ERROR: Build failed. Not running target

Reproduction steps

  1. Download/extract bazel_test.zip
  2. Run bazel build //... in the extracted folder to confirm it builds without issues.
  3. Run bazel run :xcodeproj

Note: I do not have any .bazelrc files in use, locally or globally.

Expected behavior

I would expect a .xcodeproj file to be generated.

rules_xcodeproj version

3.6.0

Xcode version

26.0.1

Bazel version

9.0.0

rules_apple version

4.3.3

rules_swift version

N/A

Additional information

This does not happen with just the protobuf compilation. The same error happens with C++ libraries as well, with libraries compiled natively using cc_library, libraries imported with cc_import, as well as external cmake libraries built using rules_foreign_cc. In all cases, the build itself completes without errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions