marbl/canu

Compiling on ARM architecture (Apple M2)

nedelec opened this issue · 4 comments

I tried compiling on Apple M2, using the default compiler and got these errors:

utility/src/parasail/cpuid.c:31:15: error: couldn't allocate output register for constraint 'b'
    __asm__ ( "cpuid" : "+b" (ebx),
              ^
utility/src/parasail/cpuid.c:95:14: error: couldn't allocate output register for constraint 'a'
    __asm__ ("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx" );
             ^

Is there a way to compile these? I suppose xgetbv is the LAPACK routine and this is available on MacOS, so is the problem just related to linking correctly to the right linear algebra library? Sorry I have no idea how the code is organised... Thank you for your help!

skoren commented

The short answer is no, canu does not build on ARM systems. We may add support for this in the future depending on how difficult it is to update the libraries canu depends on to ARM.

For info, we can actually run it on MacOS M2, using the Intel binary within the Rosetta emulator, but there is probably a significant penalty and running a native binary should be much better. Since you know the code base, can you estimate how much work it would be to port it? I suppose that all the libraries can run on macOS, so the matter is more about no having any intel-specific assembly in there... Thank you very much!

See what the master branch does now.

You'll need to install llvm, boost and openjdk using homebrew:

brew install llvm
brew install boost
brew install openjdk

export JAVA_HOME=/opt/homebrew/opt/openjdk

Recent versions of GCC should work, but I haven't tested.

If anyone tests with MacPorts, please let me know!

Java is for the mhap overlapper. If you java from the command line works, you're probably set up already.

Weird. I just built it using the instructions (surprisingly it worked) and it is running fine on my M1 Pro, apparently.

p.s. I already had llvm, boost and openjdk previously