Skip to content

Commit

Permalink
chore: simplify rust activation (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra authored Jan 3, 2025
1 parent b6e4dbd commit 698087b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,18 @@ git = ">=2.46.0,<3"
openssl = "3.*"
pkg-config = "0.29.*"
rust = "~=1.81.0"

[feature.build.target.linux-64.dependencies]
clang = ">=18.1.8,<19.0"
compilers = ">=1.6.0"
make = ">=4.3,<5"
mold = ">=2.33.0,<3.0"

[feature.build.activation]
env.CARGO_TARGET_DIR = "target/pixi"

[feature.build.target.unix.activation]
scripts = ["scripts/activate.sh"]
[feature.build.target.win-64.activation]
scripts = ["scripts/activate.bat"]

[feature.docs.dependencies]
cairosvg = "2.7.1.*"
Expand Down
2 changes: 0 additions & 2 deletions scripts/activate.bat

This file was deleted.

7 changes: 5 additions & 2 deletions scripts/activate.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
set -Eeuo pipefail
export CARGO_TARGET_DIR="target/pixi"

# Setup the mold linker when targeting x86_64-unknown-linux-gnu
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER="clang"
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-fuse-ld=$CONDA_PREFIX/bin/mold"

# on macOS we need to set these rust flags
# On macOS we need to set these rust flags to avoid the following error:
# dyld[98511]: Library not loaded: @rpath/liblzma.5.dylib
# Referenced from: <E86679E3-7383-3039-9E4A-031C60A071A5> ..
# Reason: no LC_RPATH's found
export CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS="-C link-arg=-Wl,-rpath,$CONDA_PREFIX/lib"
export CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS="-C link-arg=-Wl,-rpath,$CONDA_PREFIX/lib"

0 comments on commit 698087b

Please sign in to comment.