hcdenbakker / sepia

taxonomic classifier based on the kraken2 algorithms and more
GNU General Public License v3.0
45 stars 3 forks source link

Compile error for ARM64 #21

Closed sirselim closed 2 years ago

sirselim commented 2 years ago

This will be a similar issue to #20 - compiling on non-x64_x86 processors.

I tried compiling on an Nvidia Jetson Xavier AGX (8-core ARM v8.2 64-bit CPU) and received the below error:

The following warnings were emitted during compilation:

warning: cc: error: unrecognized command line option ‘-msse4.2’
warning: cc: error: unrecognized command line option ‘-maes’
warning: cc: error: unrecognized command line option ‘-mavx’
warning: cc: error: unrecognized command line option ‘-mavx2’

error: failed to run custom build command for `fasthash-sys v0.3.2`

Caused by:
  process didn't exit successfully: `/media/nvme/software/sepia/target/release/build/fasthash-sys-55b467a9799ab74c/build-script-build` (exit status: 101)
  --- stdout
  TARGET = Some("aarch64-unknown-linux-gnu")
  OPT_LEVEL = Some("3")
  TARGET = Some("aarch64-unknown-linux-gnu")
  HOST = Some("aarch64-unknown-linux-gnu")
  TARGET = Some("aarch64-unknown-linux-gnu")
  TARGET = Some("aarch64-unknown-linux-gnu")
  HOST = Some("aarch64-unknown-linux-gnu")
  CC_aarch64-unknown-linux-gnu = None
  CC_aarch64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  HOST = Some("aarch64-unknown-linux-gnu")
  TARGET = Some("aarch64-unknown-linux-gnu")
  HOST = Some("aarch64-unknown-linux-gnu")
  CFLAGS_aarch64-unknown-linux-gnu = None
  CFLAGS_aarch64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  DEBUG = Some("false")
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wno-implicit-fallthrough" "-Wno-unknown-attributes" "-msse4.2" "-maes" "-mavx" "-mavx2" "-DT1HA0_RUNTIME_SELECT=1" "-DT1HA0_AESNI_AVAILABLE=1" "-Wall" "-Wextra" "-o" "/media/nvme/software/sepia/target/release/build/fasthash-sys-9f9c5c3893135e0b/out/src/fasthash.o" "-c" "src/fasthash.cpp"
  cargo:warning=cc: error: unrecognized command line option ‘-msse4.2’
  cargo:warning=cc: error: unrecognized command line option ‘-maes’
  cargo:warning=cc: error: unrecognized command line option ‘-mavx’
  cargo:warning=cc: error: unrecognized command line option ‘-mavx2’
  exit status: 1

  --- stderr
  thread 'main' panicked at '

  Internal error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wno-implicit-fallthrough" "-Wno-unknown-attributes" "-msse4.2" "-maes" "-mavx" "-mavx2" "-DT1HA0_RUNTIME_SELECT=1" "-DT1HA0_AESNI_AVAILABLE=1" "-Wall" "-Wextra" "-o" "/media/nvme/software/sepia/target/release/build/fasthash-sys-9f9c5c3893135e0b/out/src/fasthash.o" "-c" "src/fasthash.cpp" with args "cc" did not execute successfully (status code exit status: 1).

  ', /home/minit/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.55/src/lib.rs:1672:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

I'm excited to see tools such as Sepia coming to Rust and would love to see them accessible on non Intel/AMD based machines.

I'm happy to do any testing if it is useful. Thanks for your hard work.

hcdenbakker commented 2 years ago

Hi, thanks for bringing this to my attention. From the error it seems that the offending part of the compilation is found in fasthash. Interestingly enough that crate was still in the Cargo.toml file, but isn't used in Sepia anymore. I just pushed a new updated Cargo.toml, can you try to re-compile again with the new Cargo.toml file?

Thanks a lot, -Henk

sirselim commented 2 years ago

Thanks Henk, that was fast!

Very please to report back that that was all that was needed, I have successfully build Sepia on arm64 (Nvidia Jetson Xavier AGX).

/media/nvme/software/sepia$ cargo build --release
   Compiling quote v1.0.10
   Compiling memoffset v0.6.4
   Compiling num_cpus v1.13.0
   Compiling getrandom v0.1.16
   Compiling crossbeam-channel v0.5.1
   Compiling miniz_oxide v0.4.4
   Compiling atty v0.2.14
   Compiling libz-sys v1.1.3
   Compiling bzip2-sys v0.1.11+1.0.8
   Compiling lzma-sys v0.1.17
   Compiling buf_redux v0.8.4
   Compiling bstr v0.2.17
   Compiling linereader v0.4.0
   Compiling crossbeam-epoch v0.9.5
   Compiling clap v2.33.3
   Compiling bzip2 v0.4.3
   Compiling rand_core v0.5.1
   Compiling xz2 v0.1.6
   Compiling syn v1.0.81
   Compiling flate2 v1.0.22
   Compiling crossbeam-deque v0.8.1
   Compiling rand_chacha v0.2.2
   Compiling rayon-core v1.9.1
   Compiling rand v0.7.3
   Compiling rayon v1.5.1
   Compiling needletail v0.4.1
   Compiling hyperloglog v0.0.12
   Compiling serde_derive v1.0.130
   Compiling thiserror-impl v1.0.30
   Compiling sysinfo v0.20.5
   Compiling thiserror v1.0.30
   Compiling bgzip v0.2.1
   Compiling niffler v2.3.2
   Compiling serde v1.0.130
   Compiling bincode v1.3.3
   Compiling serde_json v1.0.69
   Compiling hashbrown v0.3.1
   Compiling boomphf v0.5.9
   Compiling sepia v0.1.0 (/media/nvme/software/sepia)
    Finished release [optimized] target(s) in 1m 26s

Testing the help options:

/media/nvme/software/sepia$ target/release/sepia --help
sepia 0.0.3.
Henk C. den Bakker <henkcdenbakker@gmail.com>
perfect hash index based read classifier and more

USAGE:
    sepia [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    batch_classify    classifies batch of samples reads
    build             builds an index
    classify          classifies reads using an lca approach
    help              Prints this message or the help of the given subcommand(s)

Building the demo index:

/media/nvme/software/sepia$ target/release/sepia build -r ref_demo.txt -k 31 -m 21 -p 4 -c 2 -i demo_index
Ref_file : ref_demo.txt
db : demo_index
k-mer size: 31
minimizer size: 21
hash mode: sepia
minimizers for 2 samples inferred in parallel.
length taxonomy: 26, root value: 1
5 bits reserved to store taxon information.
Creating index...
Estimating total number of unique kmers/minimizers...
16 accessions processed.ed.
Estimated index size: 0.002 Gb
Estimated number of minimizers: 7013632
Initial size of compact hash set set to 10019474
Buidling index...
Creating final index...
processed 16/16 accessions
Saving index to file.

This is fantastic and I can't wait to dig in and "play" a lot more. Thank you for your hard work on this!

It would be interesting to know whether this is all that is required for it to build on M1 Macs as well (#20).

Cheers,