Unable to compile Rust package

Hi, I’m trying to use a Rust package on baobab2, mkmolinfo. I first installed Rust, following these instructions. Then I did module load GCCcore/8.2.0 OpenSSL/1.1.1b and tried to run Cargo build to compile the package. However, it fails with the error below. I have tried to fix this by installing clang and other ways, but they all failed unfortunately, and nearly all solutions I found require root access. I would be very grateful for any help?

Apologies if this is not the right forum to post this question. The specifics may not be of general interest, although it might be useful for others too if Rust and dependancies were available on baobab via module load.

Many thanks,
Chris

Error:

[rands@login2 mkmolinfo]$ cargo build

   Compiling rust-htslib v0.24.0

error: failed to run custom build command for `rust-htslib v0.24.0`

Caused by:

  process didn't exit successfully: `/home/rands/MKMOLINFO/mkmolinfo/target/debug/build/rust-htslib-643757b5f95326c9/build-script-build` (exit code: 101)

--- stdout

OPT_LEVEL = Some("0")

TARGET = Some("x86_64-unknown-linux-gnu")

HOST = Some("x86_64-unknown-linux-gnu")

CC_x86_64-unknown-linux-gnu = None

CC_x86_64_unknown_linux_gnu = None

HOST_CC = None

CC = None

CFLAGS_x86_64-unknown-linux-gnu = None

CFLAGS_x86_64_unknown_linux_gnu = None

HOST_CFLAGS = None

CFLAGS = None

CRATE_CC_NO_DEFAULTS = None

DEBUG = Some("true")

echo '/* Default config.h generated by Makefile */' > config.h

echo '#define HAVE_LIBBZ2 1' >> config.h

echo '#define HAVE_LIBLZMA 1' >> config.h

echo '#define HAVE_LZMA_H 1' >> config.h

echo '#define HAVE_FSEEKO 1' >> config.h

echo '#define HAVE_DRAND48 1' >> config.h

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o kfunc.o kfunc.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o knetfile.o knetfile.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o kstring.o kstring.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o bcf_sr_sort.o bcf_sr_sort.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o bgzf.o bgzf.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o errmod.o errmod.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o faidx.o faidx.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o hfile.o hfile.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o hfile_net.o hfile_net.c

echo '#define HTS_VERSION "1.9"' > version.h

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o hts.o hts.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o hts_os.o hts_os.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o md5.o md5.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o multipart.o multipart.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o probaln.o probaln.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o realn.o realn.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o regidx.o regidx.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o sam.o sam.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o synced_bcf_reader.o synced_bcf_reader.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o vcf_sweep.o vcf_sweep.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o tbx.o tbx.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o textutils.o textutils.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o thread_pool.o thread_pool.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o vcf.o vcf.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o vcfutils.o vcfutils.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_codecs.o cram/cram_codecs.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_decode.o cram/cram_decode.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_encode.o cram/cram_encode.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_external.o cram/cram_external.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_index.o cram/cram_index.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_io.o cram/cram_io.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_samtools.o cram/cram_samtools.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/cram_stats.o cram/cram_stats.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/files.o cram/files.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/mFILE.o cram/mFILE.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/open_trace_file.o cram/open_trace_file.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/pooled_alloc.o cram/pooled_alloc.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/rANS_static.o cram/rANS_static.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/sam_header.o cram/sam_header.c

cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include -I.  -c -o cram/string_alloc.o cram/string_alloc.c

ar -rc libhts.a kfunc.o knetfile.o kstring.o bcf_sr_sort.o bgzf.o errmod.o faidx.o hfile.o hfile_net.o hts.o hts_os.o md5.o multipart.o probaln.o realn.o regidx.o sam.o synced_bcf_reader.o vcf_sweep.o tbx.o textutils.o thread_pool.o vcf.o vcfutils.o cram/cram_codecs.o cram/cram_decode.o cram/cram_encode.o cram/cram_external.o cram/cram_index.o cram/cram_io.o cram/cram_samtools.o cram/cram_stats.o cram/files.o cram/mFILE.o cram/open_trace_file.o cram/pooled_alloc.o cram/rANS_static.o cram/sam_header.o cram/string_alloc.o

ranlib libhts.a

running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "/home/rands/MKMOLINFO/mkmolinfo/target/debug/build/bzip2-sys-2c953a1366e86d23/out/include" "-o" "/home/rands/MKMOLINFO/mkmolinfo/target/debug/build/rust-htslib-fccf6082e136540b/out/wrapper.o" "-c" "wrapper.c"

exit code: 0

AR_x86_64-unknown-linux-gnu = None

AR_x86_64_unknown_linux_gnu = None

HOST_AR = None

AR = None

running: "ar" "crs" "/home/rands/MKMOLINFO/mkmolinfo/target/debug/build/rust-htslib-fccf6082e136540b/out/libwrapper.a" "/home/rands/MKMOLINFO/mkmolinfo/target/debug/build/rust-htslib-fccf6082e136540b/out/wrapper.o"

exit code: 0

cargo:rustc-link-lib=static=wrapper

cargo:rustc-link-search=native=/home/rands/MKMOLINFO/mkmolinfo/target/debug/build/rust-htslib-fccf6082e136540b/out

--- stderr

thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:999:5

note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Dear Christopher,

I don’t know if this will solve your issue, but I have installed today Rust 1.35 on Baobab. For more information:

module spider Rust

Best

Thank you for your help! I can load the module and run rustc, but unfortunately the cargo build command still fails with the same error message. My best guess is that clang needs to be installed, but I’m not sure.
Thanks again, Chris