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

Possible incompatibility with Yams? #1198

Open
ileitch opened this issue Aug 17, 2024 · 5 comments
Open

Possible incompatibility with Yams? #1198

ileitch opened this issue Aug 17, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@ileitch
Copy link

ileitch commented Aug 17, 2024

$ bazel run //:update_build_files

gazelle: failed to create swift.SwiftFileInfo for /Users/me/code/peripheryapp/periphery/.build/checkouts/Yams/Tests/main.swift. open /Users/me/code/peripheryapp/periphery/.build/checkouts/Yams/Tests/main.swift: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x10515aa6c]

...

Steps to reproduce:

  1. git clone [email protected]:peripheryapp/periphery.git
  2. cd periphery
  3. git checkout bazel-swiftpm
  4. swift package resolve
  5. bazel run //:update_build_files

It looks like this select in the Yams project isn't being evaluated correctly. Is there somewhere I need to configure rules_swift_package_manager to only build for macos, or is this an incompatibility with Yams? Alternatively, is it possible to exclude the Yams test targets from the analysis?

Environment:

  • macOS 14.6.1
  • Xcode 15.4.0
@cgrindel cgrindel added the bug Something isn't working label Aug 24, 2024
@cgrindel
Copy link
Owner

I am a little surprised that is being picked up. rules_swift_package_manager deletes existing Bazel build files for Swift packages. The delete logic is here. 🤔

@cgrindel
Copy link
Owner

I just attempted to reproduce the issue. I am seeing a build error:

ERROR: /private/var/tmp/_bazel_chuck/1d745b1f8c4c04cbd181f13871d2aaa3/external/rules_go~/BUILD.bazel:42:7: GoStdlib external/rules_go~/stdlib_/pkg [for tool] failed: (Exit 1): builder failed: error executing GoStdlib command (from target @@rules_go~//:stdlib)
  (cd /private/var/tmp/_bazel_chuck/1d745b1f8c4c04cbd181f13871d2aaa3/sandbox/darwin-sandbox/2/execroot/_main && \
  exec env - \
    CC=external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh \
    CGO_CFLAGS='-U_FORTIFY_SOURCE -fstack-protector -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -O2 -D_FORTIFY_SOURCE=1 -DNDEBUG -ffunction-sections -fdata-sections -mmacosx-version-min=14.4 -no-canonical-prefixes -Wno-builtin-macro-redefined -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted"' \
    CGO_ENABLED=1 \
    CGO_LDFLAGS='-mmacosx-version-min=14.4 -no-canonical-prefixes -fobjc-link-runtime -headerpad_max_install_names -Wl,-dead_strip -lm' \
    GOARCH=amd64 \
    GOEXPERIMENT=nocoverageredesign \
    GOOS=darwin \
    GOPATH='' \
    GOROOT=external/rules_go~~go_sdk~go_default_sdk \
    GOROOT_FINAL=GOROOT \
    GOTOOLCHAIN=local \
    PATH=/Applications/Xcode-15.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:external/bazel_tools~cc_configure_extension~local_config_cc:/bin:/usr/bin \
    ZERO_AR_DATE=1 \
  bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_go~~go_sdk~go_default_sdk/builder_reset/builder stdlib -sdk external/rules_go~~go_sdk~go_default_sdk -installsuffix darwin_amd64 -out bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_go~/stdlib_ -package std -package runtime/cgo -gcflags '')
# Configuration: 472ee93f664283993c12a8846b7e08c17338e9e8797c5cf86698c875fac858f8
# Execution platform: @@platforms//host:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
# runtime/cgo
_cgo_export.c:3:10: fatal error: 'stdlib.h' file not found
stdlib: error running subcommand external/rules_go~~go_sdk~go_default_sdk/bin/go: exit status 1
Target //:update_build_files failed to build

@cgrindel
Copy link
Owner

I will install Xcode 15.4 and try again.

@cgrindel cgrindel self-assigned this Aug 24, 2024
@jpsim
Copy link
Collaborator

jpsim commented Aug 28, 2024

Interesting! Let me know if I can help by making any changes to Yams. What's interesting is that I've been using rspm with Yams for a year without issue.

@luispadron
Copy link
Collaborator

Maybe what's happening here is that the .build directory is being recreated outside of this Bazel rule. This can happen for many reasons like resolving the package or having an editor for Swift/SPM which resolves these files.

We have also been using Yams and other repositories via rules_swift_package_manager which also have BUILD files in their repository without issue but that's potentially because we add the .build to our .bazelignore file so that its never part of the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants