Skip to content

Troubleshooting

Vignesh Rao edited this page Feb 24, 2024 · 3 revisions

Please note all the steps below apply only for troubleshooting the build process.
If you notice any issues during run time or executing the binary, please raise an issue

OpenSSL

OpenSSL has been the most notorious out of all dependencies since it relies on the OS level bindings.

macOS

  1. First install it with homebrew if you haven't already
brew install openssl@3

Step 1 should have automatically made openssl be available in /usr/local/bin and added to the $PATH, if not proceed to step 2

  1. Try and force brew to link openssl
brew link --force openssl

At this point running which openssl should show openssl under /usr/local/bin. If it still doesn't solve build errors, proceed to step 3

  1. Set the openssl prefix as env var explicitly
export OPENSSL_DIR="$(brew --prefix openssl)"

Linux

Installing libssl as standalone is the only solution for Linux in case there is an error building OpenSSL.

Dependency conflicts may also raise for Linux, but the fix is same as [SIGSEGV errors]

sudo apt-get install libssl-dev

Windows

  • Install the latest version of the Visual Studio Installer (even if you have VS code installed)
  • Check the boxes to install desktop development tools for Linux and windows
  • Check the box to install C++ CMake tools
  1. Install Visual Studio Package
mkdir \Tools
cd \Tools
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg.exe install openssl:x64-windows-static
  1. Set the environment variables for OpenSSL
PoweShell
$env:vcpkg_dir = $pwd.Path
$env:OPENSSL_DIR = "$env:vcpkg_dir\installed\x64-windows-static"
$env:OPENSSL_STATIC = 'Yes'
[System.Environment]::SetEnvironmentVariable('OPENSSL_DIR', $env:OPENSSL_DIR, [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('OPENSSL_STATIC', $env:OPENSSL_STATIC, [System.EnvironmentVariableTarget]::User)
Bash
export OPENSSL_DIR="$pwd\installed\x64-windows-static"
export OPENSSL_STATIC="Yes"
export VCPKG_ROOT="$pwd\installed\x64-windows-static"

References

SIGSEGV

Segmentation fault is an error signal that may occur for linux systems (especially for machines with old/low CPU cores) during build process.

  1. Descope the number of code generation units during the compilation process.
export RUSTFLAGS="-Ccodegen-units=1"

Reducing the number of codegen units may reduce memory usage during compilation but might increase compilation time because fewer tasks can be parallelized.

  1. Control the overall number of concurrent compilation jobs.
cargo build -j 1

By default, Cargo uses the number of available CPU cores as the number of jobs. By influencing the parallelization tasks during the compilation process, the resource usage can be kept to a minimum.

Both of these options can be used in tandem.

References

Clone this wiki locally