sagemath / cysignals

cysignals: interrupt and signal handling for Cython
GNU Lesser General Public License v3.0
44 stars 23 forks source link

`configure` tests the wrong compiler #179

Open mkoeppe opened 10 months ago

mkoeppe commented 10 months ago

Extension modules are built with the compiler configured in distutils/setuptools. When setup.py calls the configure script, it should pass this compiler.

This will eliminate this error seen in https://github.com/sagemath/cysignals/actions/runs/6227465351/job/16902173349:

checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether the compiler supports GNU C++... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C++11 features... none needed
[...]
checking for emms instruction... yes

 clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DCYTHON_CLINE_IN_TRACEBACK=0 -U_FORTIFY_SOURCE -Isrc/cysignals -Isrc -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c build/src/cysignals/signals.c -o build/temp.macosx-10.9-universal2-cpython-311/build/src/cysignals/signals.o -pthread
  In file included from build/src/cysignals/signals.c:1728:
  build/src/cysignals/implementation.c:539:13: warning: unused function 'print_enhanced_backtrace' [-Wunused-function]
  static void print_enhanced_backtrace(void)
              ^
  build/src/cysignals/implementation.c:123:9: error: unrecognized instruction mnemonic
      asm("emms");
          ^
  <inline asm>:1:2: note: instantiated into assembly here
          emms
          ^
  1 warning and 1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  error: subprocess-exited-with-error

  Building wheel for cysignals (pyproject.toml): finished with status 'error'
  × Building wheel for cysignals (pyproject.toml) did not run successfully.
Failed to build cysignals
  │ exit code: 1
  ╰─> See above for output.
mkoeppe commented 10 months ago

Specifically, Python attempts to build using -arch arm64 -arch x86_64 -- but configure only tested for one of the two archs.

mkoeppe commented 10 months ago

178 has fixed this for the case when configure is invoked by setup.py.