Skip to content

Commit feab8b7

Browse files
Add note to README.md build for Mac OS (#265)
* Add note to README.md build for Mac OS If you follow the directions here on Mac OS you get the following error: ``` = note: clang: warning: argument unused during compilation: '-static-pie' [-Wunused-command-line-argument] ld: unknown option: --as-needed clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` Following the steps [here](https://aws.amazon.com/blogs/opensource/rust-runtime-for-aws-lambda/) resolved the issue for me, which was basically just installing and using the linker from filosottile/musl-cross/musl-cross. * Addressing nit comments Co-authored-by: Colton Weaver <[email protected]>
1 parent 04712a3 commit feab8b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ Run this script once to add the new target:
6666
$ rustup target add x86_64-unknown-linux-musl
6767
```
6868

69+
70+
* **Note:** If you are running on Mac OS you'll need to install the linker for the target platform. You do this using the `musl-cross` tap from [Homebrew](https://brew.sh/) which provides a complete cross-compilation toolchain for Mac OS. Once `musl-cross` is installed we will also need to inform cargo of the newly installed linker when building for the `x86_64-unknown-linux-musl` platform.
71+
```bash
72+
$ brew install filosottile/musl-cross/musl-cross
73+
$ mkdir .cargo
74+
$ echo $'[target.x86_64-unknown-linux-musl]\nlinker = "x86_64-linux-musl-gcc"' > .cargo/config
75+
```
76+
6977
Compile one of the examples as a _release_ with a specific _target_ for deployment to AWS:
7078
```bash
7179
$ cargo build -p lambda --example hello --release --target x86_64-unknown-linux-musl

0 commit comments

Comments
 (0)