无法在 Apple M1 上为 BWA 运行 make 命令在 Mac OS Big Sur 上

问题描述

我正在尝试使用 make 文件安装 BWA。 Github 仓库如下:

https://github.com/lh3/bwa

制作文件如下:

CC=         gcc
#CC=            clang --analyze
CFLAGS=     -g -Wall -Wno-unused-function -O2
WRAP_MALLOC=-DUSE_MALLOC_WRAPPERS
AR=         ar
DFLAGS=     -DHAVE_PTHREAD $(WRAP_MALLOC)
LOBJS=      utils.o kthread.o kstring.o ksw.o bwt.o bntseq.o bwa.o bwamem.o bwamem_pair.o bwamem_extra.o malloc_wrap.o \
            QSufSort.o bwt_gen.o rope.o rle.o is.o bwtindex.o
AOBJS=      bwashm.o bwase.o bwaseqio.o bwtgap.o bwtaln.o bamlite.o \
            bwape.o kopen.o pemerge.o maxk.o \
            bwtsw2_core.o bwtsw2_main.o bwtsw2_aux.o bwt_lite.o \
            bwtsw2_chain.o fastmap.o bwtsw2_pair.o
PROG=       bwa
INCLUDES=   
LIBS=       -lm -lz -lpthread
SUBDirs=    .

ifeq ($(shell uname -s),Linux)
    LIBS += -lrt
endif

.SUFFIXES:.c .o .cc

.c.o:
        $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@

all:$(PROG)

bwa:libbwa.a $(AOBJS) main.o
        $(CC) $(CFLAGS) $(DFLAGS) $(AOBJS) main.o -o $@ -L. -lbwa $(LIBS)

bwamem-lite:libbwa.a example.o
        $(CC) $(CFLAGS) $(DFLAGS) example.o -o $@ -L. -lbwa $(LIBS)

libbwa.a:$(LOBJS)
        $(AR) -csru $@ $(LOBJS)

clean:
        rm -f gmon.out *.o a.out $(PROG) *~ *.a

depend:
    ( LC_ALL=C ; export LC_ALL; makedepend -Y -- $(CFLAGS) $(DFLAGS) -- *.c )

# DO NOT DELETE THIS LINE -- make depend depends on it.

QSufSort.o: QSufSort.h
bamlite.o: bamlite.h malloc_wrap.h
bntseq.o: bntseq.h utils.h kseq.h malloc_wrap.h khash.h
bwa.o: bntseq.h bwa.h bwt.h ksw.h utils.h kstring.h malloc_wrap.h kvec.h
bwa.o: kseq.h
bwamem.o: kstring.h malloc_wrap.h bwamem.h bwt.h bntseq.h bwa.h ksw.h kvec.h
bwamem.o: ksort.h utils.h kbtree.h
bwamem_extra.o: bwa.h bntseq.h bwt.h bwamem.h kstring.h malloc_wrap.h
bwamem_pair.o: kstring.h malloc_wrap.h bwamem.h bwt.h bntseq.h bwa.h kvec.h
bwamem_pair.o: utils.h ksw.h
bwape.o: bwtaln.h bwt.h kvec.h malloc_wrap.h bntseq.h utils.h bwase.h bwa.h
bwape.o: ksw.h khash.h
bwase.o: bwase.h bntseq.h bwt.h bwtaln.h utils.h kstring.h malloc_wrap.h
bwase.o: bwa.h ksw.h
bwaseqio.o: bwtaln.h bwt.h utils.h bamlite.h malloc_wrap.h kseq.h
bwashm.o: bwa.h bntseq.h bwt.h
bwt.o: utils.h bwt.h kvec.h malloc_wrap.h
bwt_gen.o: QSufSort.h malloc_wrap.h
bwt_lite.o: bwt_lite.h malloc_wrap.h
bwtaln.o: bwtaln.h bwt.h bwtgap.h utils.h bwa.h bntseq.h malloc_wrap.h
bwtgap.o: bwtgap.h bwt.h bwtaln.h malloc_wrap.h
bwtindex.o: bntseq.h bwa.h bwt.h utils.h rle.h rope.h malloc_wrap.h
bwtsw2_aux.o: bntseq.h bwt_lite.h utils.h bwtsw2.h bwt.h kstring.h
bwtsw2_aux.o: malloc_wrap.h bwa.h ksw.h kseq.h ksort.h
bwtsw2_chain.o: bwtsw2.h bntseq.h bwt_lite.h bwt.h malloc_wrap.h ksort.h
bwtsw2_core.o: bwt_lite.h bwtsw2.h bntseq.h bwt.h kvec.h malloc_wrap.h
bwtsw2_core.o: khash.h ksort.h
bwtsw2_main.o: bwt.h bwtsw2.h bntseq.h bwt_lite.h utils.h bwa.h
bwtsw2_pair.o: utils.h bwt.h bntseq.h bwtsw2.h bwt_lite.h kstring.h
bwtsw2_pair.o: malloc_wrap.h ksw.h
example.o: bwamem.h bwt.h bntseq.h bwa.h kseq.h malloc_wrap.h
fastmap.o: bwa.h bntseq.h bwt.h bwamem.h kvec.h malloc_wrap.h utils.h kseq.h
is.o: malloc_wrap.h
kopen.o: malloc_wrap.h
kstring.o: kstring.h malloc_wrap.h
ksw.o: ksw.h malloc_wrap.h
main.o: kstring.h malloc_wrap.h utils.h
malloc_wrap.o: malloc_wrap.h
maxk.o: bwa.h bntseq.h bwt.h bwamem.h kseq.h malloc_wrap.h
pemerge.o: ksw.h kseq.h malloc_wrap.h kstring.h bwa.h bntseq.h bwt.h utils.h
rle.o: rle.h
rope.o: rle.h rope.h
utils.o: utils.h ksort.h malloc_wrap.h kseq.h

但我收到以下错误。你能告诉我我该怎么办吗? 我在我的 macbook 中使用新的 Apply m1 芯片处理器。我尝试将 CC = 更改为 clang 并返回到 gcc,在这两种情况下,它都给出了相同的错误

    gcc -c -g -Wall -Wno-unused-function -O2 -DHAVE_PTHREAD -DUSE_MALLOC_WRAPPERS  ksw.c -o ksw.o
In file included from ksw.c:29:
In file included from /Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/emmintrin.h:13:
In file included from /Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/xmmintrin.h:13:
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:50:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_vec_init_v2si(__i,0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:129:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:159:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1,(__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:189:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:216:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1,(__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:239:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:260:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1,(__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:287:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1,(__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:310:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:331:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1,(__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:352:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1,(__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:373:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:394:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddd((__v2si)__m1,(__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:416:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1,(__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:439:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:461:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddusb((__v8qi)__m1,(__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:483:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddusw((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:504:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_psubb((__v8qi)__m1,(__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLinetools/usr/lib/clang/12.0.0/include/mmintrin.h:525:12: error: 
      invalid conversion between vector type '__m64' (vector of 1 'long long'
      value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_psubw((__v4hi)__m1,(__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fatal error: too many errors emitted,stopping Now [-ferror-limit=]
20 errors generated.
make: *** [ksw.o] Error 1

解决方法

您需要修补 BWA 以使用 NEON 而不是 SSE 指令进行 SIMD 操作。我在以下位置提供了二进制文件:https://github.com/smikkelsendk/bwa-for-arm/tree/master/bin