Troubleshooting

This topic provides guidance on resolving common troubleshooting issues for Rust.

Out of memory error

LLVM ERROR: out of memory

In the event of this error, configure the following limit settings.

ulimit -d unlimited
ulimit -m unlimited
ulimit -s unlimited

TOC overflow

By default, the Rust compiler generates code using the large code model. To avoid TOC overflow, C/C++ code linked into the Rust application must be compiled with -mcmodel=large so that it also uses the large code model.

Failed to build openssl-sys

Ensure /usr/lib/libssl.a and /usr/lib/libcrypto.a are installed and set.
export OPENSSL_DIR=/usT
export OPENSSL_STATIC=0
export OPENSSL_NO_VENDOR=1

Missing CC and CXX

Error {kind: ToolNotFound, message "Failed to find tool. Is 'co' installed?"}

Ensure Open XL C/C++ for AIX is installed and CC and CXX are exported.

export CC=/path/to/ibm-clang 
export CXX=/path/to/ibm-clang++_r

byteorder fails to compile on AIX due to alignment assertion

A known assertion in byteorder can fail on AIX when using newer versions of rustc. As a temporary workaround, add the following patch to Cargo.toml to use the fork shown below.

$ printf '\n[patch.crates-io]\nbyteorder = { git = "https://github.com/amy-kwan/byteorder", branch = "amyk/update-byteorder-aix" }\n' >> /path/to/Cargo.toml

$ cargo update -p byteorder --manifest-path /path/to/Cargo.toml

# Build as normal afterwards.
$ cargo build

This provides a temporary solution for building byteorder and any crates that still depend on it.