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

Add minimal examples of toolchains in WORKSPACEs #170

Merged
merged 20 commits into from
Jan 5, 2022
Merged

Conversation

itsadrake
Copy link
Contributor

@itsadrake itsadrake commented Dec 1, 2021

This addresses issues #168 and #172.

Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

I think this could use a README with instructions how to build these examples.
It might also be good to add a .bazelrc to each example setting the host platform to enable nix support and a shell.nix to make these examples more self contained.
We should also test these on CI to make sure that they keep working.

examples/toolchains/go/README.md Show resolved Hide resolved
examples/toolchains/go/.bazelrc Outdated Show resolved Hide resolved
examples/toolchains/cc/WORKSPACE Outdated Show resolved Hide resolved
examples/toolchains/cc/WORKSPACE Outdated Show resolved Hide resolved
examples/toolchains/cc/.bazelrc Outdated Show resolved Hide resolved
examples/toolchains/cc/README.md Outdated Show resolved Hide resolved
examples/toolchains/cc/README.md Outdated Show resolved Hide resolved
examples/toolchains/cc/WORKSPACE Show resolved Hide resolved
examples/toolchains/cc/shell.nix Outdated Show resolved Hide resolved
@itsadrake itsadrake self-assigned this Dec 9, 2021
@aherrmann
Copy link
Member

Fails on MacOS 11 with

ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)

I also see a bunch of errors of the form

DEBUG: /private/var/tmp/_bazel_runner/a4a3182e50c9460fa52b8c6c1e6f916f/external/bazel_tools/tools/osx/xcode_configure.bzl:89:14: Invoking xcodebuild failed, developer dir: /Applications/Xcode_12.4.app/Contents/Developer ,return code 1, stderr: src/main/tools/process-wrapper-legacy.cc:80: "execvp(xcrun, ...)": No such file or directory

On rules_haskell with Nix we also had linker related issues with MacOS 11 (tweag/rules_haskell#1607)

Setup.hs: Missing dependency on a foreign library:
* Missing (or bad) C library: z

The error looks different at first, but the way Cabal determines whether a library is missing is by trying to build a C program that links against that library. Issues with the linker it self could potentially manifest this way as well.

Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I've done another round of review on this.

Re the MacOS issue, I'd say we should view it as orthogonal to this PR and try to get this PR merged independently of that issue.

.github/workflows/workflow.yaml Outdated Show resolved Hide resolved
examples/toolchains/cc/README.md Outdated Show resolved Hide resolved
examples/toolchains/cc/WORKSPACE Outdated Show resolved Hide resolved
examples/toolchains/cc/WORKSPACE Outdated Show resolved Hide resolved
examples/toolchains/cc/hello.cc Show resolved Hide resolved
.github/workflows/workflow.yaml Outdated Show resolved Hide resolved
examples/toolchains/cc/WORKSPACE Outdated Show resolved Hide resolved
examples/toolchains/python/README.md Outdated Show resolved Hide resolved
itsadrake and others added 7 commits January 5, 2022 11:09
For py_binary rules, bazel creates a stub python script that launches in the system python by default, the stub_shebang allows changing which python is executed.
This should create a more hermetic environment for running python binaries, and fixes bazel version 5 on systems without python3 installed.

https://docs.bazel.build/versions/main/be/python.html#py_runtime_args
bazelbuild/bazel#14159
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, that looks great!

I think the remaining CI failure can be fixed by adding a .bazelignore file that tells bazel to skip examples from the top-level workspace. See rules_haskell for reference

@itsadrake itsadrake merged commit 05a4455 into master Jan 5, 2022
@itsadrake itsadrake deleted the examples branch January 5, 2022 16:16
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 this pull request may close these issues.

4 participants