BenLangmead / bowtie2

A fast and sensitive gapped read aligner
GNU General Public License v3.0
670 stars 158 forks source link

Mac Silicon GNU Compile Error: impossible constraint in 'asm' - Cupid.h #351

Open Scrivner99 opened 3 years ago

Scrivner99 commented 3 years ago

Hi.

Complete newb here: I haven't compiled code since 1980s on IBM 3084 System/370 command line machines. Hope I'm not wasting your time.

I saw the previous issue about asm, but I still seem to have it on an M1 Mac under Big Sur using Homebrew GNU compilers.

I tried to run bowtie2 from the bowtie2-2.1.0 directory and got the message below: /bowtie2-align: cannot execute binary file

So I tried from with bowtie-master (downloaded today) using make -f Makefile

The compile time error I get is below. Advice?

Thanks.

Michael

In file included from processor_support.h:17, from ebwt.h:41, from ebwt_build.cpp:10: third_party/cpuid.h: In function 'void driver(const string&, EList<std::cxx11::basic_string >&, const string&, bool) [with TStr = S2bDnaString]': third_party/cpuid.h:103:3: error: impossible constraint in 'asm' 103 | asm ("cpuid\n\t" \ | ^~~ third_party/cpuid.h:162:3: note: in expansion of macro 'cpuid' 162 | cpuid (ext, eax, ebx, ecx, __edx); | ^~~ third_party/cpuid.h:103:3: error: impossible constraint in 'asm' 103 | asm__ ("cpuid\n\t" \ | ^~~ third_party/cpuid.h:185:3: note: in expansion of macro 'cpuid' 185 | cpuid (level, *eax, __ebx, ecx, *edx); | ^~~

Scrivner99 commented 3 years ago

Any ideas or pointers?

ch4rr0 commented 3 years ago

Can you try deleting the cpuid.h file. Bowtie2 should fallback to using the system-provided header. Let me know if this works.

ch4rr0 commented 3 years ago

I am now remembering that the M1 processor is based on ARM which does not support the popcnt instruction that we use cpuid.h to check for. Assuming that you fetched the SIMDE module along with the bowtie2 source, try running:

make bowtie2-align-s POPCNT_CAPABILITY=0

If you don't have the SIMDE module present in third_party directory, run the command below from the root of your bowtie2 repository:

$ git submodule init && git submodule update
$ ls third_party
cpuid.h simde

Repeat the above make command to build.

Let me know if this works for you.

Scrivner99 commented 3 years ago

Ben - thanks for the note. I will poke at this and let you know. I'm a tech doc specialist; if we need to document this workaround let me know and I'll roll up the notes you gave me and anything else if you'd like to put it out there as M1-specific data. I'll scrub the whole thing from my machine, download it again, and start from the top. Thanks again. Michael