Skip to content

Commit 25df8a7

Browse files
committed
feat: describe Rust build complications
1 parent 786c065 commit 25df8a7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/cookbook/languages/rust.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,24 @@ command = '''
195195
'''
196196
```
197197

198+
### macOS builds require libiconv
199+
200+
Rust executables built for macOS link against the `libiconv` library, which is used for some Unicode operations.
201+
This library is provided by macOS, and the large majority of Rust packages on macOS link against this library already, so this is not a dependency introduced by building via Flox.
202+
For reproducibility you must include this package as a dependency rather than depending on being able to locate the library on the system at runtime.
203+
204+
### Linux builds require GCC
205+
206+
On Linux, Rust executables link against `libgcc` for stack unwinding.
207+
`libgcc` is provided as part of the `gcc` package, which means that `gcc` needs to be available to your package at runtime on Linux.
208+
This happens by default if the package is in the `toplevel` (default) package group, i.e. there is no `pkg-group` set.
209+
If `runtime-packages` is set for this package, `gcc` must be included in the list of included packages.
210+
211+
There are two current limitations related to this issue that are on the roadmap to be addressed:
212+
213+
- `runtime-packages` are not system-specific, which means that both macOS and Linux builds of this package will include `gcc` if you set `runtime-packages = [ "gcc" ]`.
214+
- Depending on the `gcc` package at runtime includes the `libgcc`, the compiler, its manpages, etc when in reality the package only depends on `libgcc` at runtime on Linux.
215+
198216
[example_env]: https://github.com/flox/floxenvs/tree/main/rust
199217
[custom-toolchains]: https://github.com/zmitchell/rust-toolchains
200218
[esp32]: https://www.espressif.com/en/products/socs/esp32

0 commit comments

Comments
 (0)