DaehwanKimLab / centrifuge

Classifier for metagenomic sequences
GNU General Public License v3.0
235 stars 73 forks source link

Is it possible to compile on M1 Macbooks? #226

Open eparisis opened 2 years ago

eparisis commented 2 years ago

Hi there, after running the make command on the cloned repository on my Macbook with the M1 chip, I'm getting this error:

/opt/homebrew/bin/g++  -O3 -m32 -msse2 -funroll-loops -g3 -std=c++11 -DCOMPILER_OPTIONS="\"-O3 -m32 -msse2 -funroll-loops -g3 -std=c++11 -DPOPCNT_CAPABILITY\"" -DPOPCNT_CAPABILITY \
    -fno-strict-aliasing -DCENTRIFUGE_VERSION="\"1.0.4\"" -DBUILD_HOST="\"`hostname`\"" -DBUILD_TIME="\"`date`\"" -DCOMPILER_VERSION="\"`/opt/homebrew/bin/g++  -v 2>&1 | tail -1`\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE   -DBOWTIE_MM  -DCENTRIFUGE -DBOWTIE2 -DBOWTIE_64BIT_INDEX -DNDEBUG -Wall \
     -I third_party \
    -o centrifuge-build-bin centrifuge_build.cpp \
    ccnt_lut.cpp ref_read.cpp alphabet.cpp shmem.cpp edit.cpp bt2_idx.cpp reference.cpp ds.cpp limit.cpp random_source.cpp tinythread.cpp diff_sample.cpp centrifuge_build_main.cpp \
    -lpthread 
g++: error: unrecognized command-line option '-m32'
g++: error: unrecognized command-line option '-msse2'
make: *** [centrifuge-build-bin] Error 1

After some research I found out that these -m32 and -msse2 flags are not supported in ARM devices such as the M1 chip.

Any ideas on how to fix this? Thanks!

MardahlM commented 2 years ago

I am also interested in the answer to this. I am using a mac mini with an M1 chip, currently performing metataxonomic classification with Kraken2, but wanting to switch to Centrifuge due to the small database size. Cheers, Maibritt

HezhouDing commented 2 years ago

I ran into the same error with my M1 Mac. Hoping to know if anyone managed to solve it. Thanks!

mourisl commented 2 years ago

I don't have an M1 mac to test, but it seems you can set the BITS_FLAG and SSE_FLAG to nothing in the Makefile and it might work.

martin-g commented 3 weeks ago

I came with the following patch to be able to build it on Linux ARM64 for Bioconda - https://github.com/bioconda/bioconda-recipes/pull/48450/files#diff-149f0ba4a048fc42c4307b54f782627d67d967fc68e55c3025748d9a1e910810 Also see https://github.com/bioconda/bioconda-recipes/pull/48450/files#diff-f4828b74bfed062cbc6b9b8e0d190ec61e7434126f253a229c5abd39e175bc70R12-R13 Same should work on Mac ARM64!

Please let me know what you think and I could send a Pull Request !