How to solve this build error on Linux when building libsodium

1k Views Asked by At

I'm trying to build libsodium-sys dependency in an Azure Docker VM which is based on debian. Have spend a couple of hours trying to fix this build error, but can't figure out what's going on.

I fixed a couple of build errors by installing missing dependencies as the Azure Docker VM seems very vanilla. Executed commands are below the error.

error: failed to run custom build command for `libsodium-sys v0.2.6 (https://github.com/cjdelisle/sodiumoxide?rev=76dc0e6e587b8c8a4bb193ebba9f8ae8f090b81b#76dc0e6e)`

Caused by:
  process didn't exit successfully: `/home/packetcrypt_rs/target/release/build/libsodium-sys-169018138a0de36b/build-script-build` (exit code: 101)
  checking for working alloca.h... yes
  checking for alloca... yes
...
  Making check in builds

  --- stderr
  /bin/bash: line 20: cd: builds: No such file or directory
  make: *** [Makefile:516: check-recursive] Error 1
  thread 'main' panicked at '
  Failed to build libsodium using "make" "check" "-j4"
  ', /root/.cargo/git/checkouts/sodiumoxide-9b8c3ad42446e2d9/76dc0e6/libsodium-sys/build.rs:281:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
root@2d0a725cde47:/home/packetcrypt_rs#

Build.rs file it's talking about: https://github.com/sodiumoxide/sodiumoxide/blob/master/libsodium-sys/build.rs

Executed commands:

apt get-update
apt-get install pkg-config
apt install apt-utils
apt install file
apt install gcc git
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
apt install make
apt install build-essential gcc-multilib -y
rustup target add armv7-unknown-linux-gnueabihf
git clone https://github.com/cjdelisle/packetcrypt_rs
cd packetcrypt_rs
~/.cargo/bin/cargo build --release
1

There are 1 best solutions below

0
On

The cause seems related to the issue explained here: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1379#note_280986944 For reasons unbeknownst to me, these are the commands I needed to execute to fix it:

rm ~/.bashrc

rm ~/.profile