Compile errors on mac OSX: "No such instruction"

Issue #13 resolved
Taco Cohen created an issue

Hi there,

Thanks for writing what looks like some really awesome spherical harmonics transform code.

I'm trying to compile the library on mac osx 10.9.5. I run ./configure, and get this: https://gist.github.com/anonymous/b67445218ca911cf05ba

Looks fine so far. Next I run 'make', but I get a long list of errors of the following kind:

gcc -march=native -O2 -I/usr/local/include -L/usr/local/lib -ffast-math -fomit-frame-pointer -std=gnu99 -D_GNU_SOURCE -O2 -c sht_init.c -o sht_init.o

/var/folders/s8/c5hbsqw97yn88qhh5khyjp8h0000gn/T//ccGy3z71.s:318:no such instruction: `vcomisd LC5(%rip), %xmm0'

/var/folders/s8/c5hbsqw97yn88qhh5khyjp8h0000gn/T//ccGy3z71.s:326:no such instruction: `vmovsd LC6(%rip), %xmm2'

/var/folders/s8/c5hbsqw97yn88qhh5khyjp8h0000gn/T//ccGy3z71.s:352:no such instruction: `vmovsd (%r11,%rdx,8), %xmm1'

/var/folders/s8/c5hbsqw97yn88qhh5khyjp8h0000gn/T//ccGy3z71.s:353:no such instruction: `vandpd %xmm2, %xmm1,%xmm1'

Any idea what is wrong?

Comments (6)

  1. Nathanaël Schaeffer repo owner

    Hello,

    I'm not an OSX user, but this looks like a problem with your compiler not really supporting avx. Could you tell me the result of these commands: "gcc --version" and "sysctl -n machdep.cpu.brand_string"

    Anyway, as a quick workaround at the expense of a significant performance drop, you can try

    ./configure --disable-simd

    Another solution with probably less performance drop is to try to use clang instead of gcc, which should also support avx:

    ./configure CC=clang

  2. Taco Cohen reporter

    Hi Nathanael,

    Thanks for the swift response. Here is the output for gcc --version: gcc --version gcc (GCC) 5.0.0 20140824 (experimental) Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    sysctl -n machdep.cpu.brand_string Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz


    When I use --disable-simd, I still get the "no such instruction" errors. When I use CC=clang, compilation seems to work, but when I try to run the SHT_example.py I get:

    ImportError: dlopen(/Users/user/anaconda/lib/python2.7/site-packages/_shtns.so, 2): Symbol not found: __an12_l Referenced from: /Users/user/anaconda/lib/python2.7/site-packages/_shtns.so Expected in: dynamic lookup

    (as you can see, I use the Anaconda Python distribution; I set the PYTHON variable to /Users/user/anaconda/bin/python before compiling)

  3. Nathanaël Schaeffer repo owner

    Hello,

    So there are two different problems now !

    1) No such instruction

    So your cpu does indeed support these instructions. It seems to be a problem in your compiling tool chain. I've found a similar problem reported on stackoverflow, with a possible workaround : "Adding -Wa,-q to the compiler flags" (second answer). Could you try it by running :

    ./configure --enable-python CFLAGS="-Wa,-q"
    

    2) non-working python module when compiled with clang

    I can reproduce this on my system too, I have no idea why clang fails at building a proper library here. I will look into it...

  4. Nathanaël Schaeffer repo owner
    • problem 1 (see above comment) is a problem with the compile chain on OSX.
    • problem 2 is now fixed in v2.6.1
  5. Log in to comment