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

Fix darwin flag when cross-compiling from Linux to MacOS #413

Merged
merged 4 commits into from
Sep 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions examples/toolchains/cc_cross_osx_to_linux_amd64/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
C++ With Dependencies Toolchain Example
=======================================
Linux C++ In Docker, Cross Compiled on MacOS
============================================

This is an example C++ project with dependencies that uses `rules_cc`.

This example uses the Nix package manager to provide C++ dependencies, and as such only works with Nix installed. Demonstrating other methods of providing C++ dependencies is out of scope of this example.
Builds a Docker image containing a C++ program cross compiled for Linux, on MacOS.

# Usage

To run the example with Nix, issue the following command:
To build the image with Nix, issue the following command:
```
nix-shell --command 'bazel build --config=cross :hello_image_tarball'
```
nix-shell --command 'bazel run --config=cross :hello'

You can then do load the image into Docker with:
benradf marked this conversation as resolved.
Show resolved Hide resolved
```
docker load -i bazel-bin/hello_image_tarball/tarball.tar
```

And run it as you normally would with Docker.