【问题标题】:Unable to run make command for BWA on Apple M1 (On Mac OS Big Sur)无法在 Apple M1 上为 BWA 运行 make 命令(在 Mac OS Big Sur 上)
【发布时间】:2021-04-09 19:16:15
【问题描述】:

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

https://github.com/lh3/bwa

make文件如下:

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

【问题讨论】:

    标签: gcc bioinformatics macos-big-sur


    【解决方案1】:

    我遇到了这个问题,发现这个问题与 M1 mac 编译 C 代码的方式有关。对于 bwa,此解决方案对我有用(本质上是交换编译器在此过程中使用的文件)

    cd bwa/
    sed -i -e 's/<emmintrin.h>/"sse2neon.h"/' ksw.c
    wget https://gitlab.com/arm-hpc/packages/uploads/ca862a40906a0012de90ef7b3a98e49d/sse2neon.h
    make clean all
    

    我想这将适用于许多需要在使用前进行编译的生物信息学工具(Bowtie,STAR)。

    【讨论】:

    • 这对我有用
    【解决方案2】:

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

    【讨论】:

    • 您能提供更多信息吗?目前尚不清楚上面链接的二进制文件是什么/应该使用哪个。谢谢!
    猜你喜欢
    • 2021-05-09
    • 2021-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-29
    • 1970-01-01
    • 2022-01-08
    • 2021-04-17
    相关资源
    最近更新 更多