diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4320c656..f157320e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: - name: Install build dependencies (Macos) # Install yasm because nasm does not work when building wheels. # Probably because of nasm-filter.sh not filtering all flags that can not be used. - run: brew install nasm + run: brew install nasm automake autoconf libtool coreutils if: runner.os == 'macOS' - name: Set MSVC developer prompt uses: ilammy/msvc-dev-cmd@v1 @@ -160,14 +160,14 @@ jobs: PYTHON_ISAL_LINK_DYNAMIC: True deploy: - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') +# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') runs-on: ${{ matrix.os }} - needs: - - lint - - package-checks - - test-static - - test-dynamic - - test-arch +# needs: +# - lint +# - package-checks +# - test-static +# - test-dynamic +# - test-arch strategy: matrix: os: @@ -200,7 +200,7 @@ jobs: - name: Install cibuildwheel twine wheel run: python -m pip install cibuildwheel twine wheel - name: Install build dependencies (Macos) - run: brew install nasm + run: brew install nasm automake autoconf libtool coreutils if: runner.os == 'macOS' - name: Set MSVC developer prompt uses: ilammy/msvc-dev-cmd@v1 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b8471793..7e97310e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,9 @@ Changelog version 1.8.1-dev ----------------- ++ Switch back to building ISA-L using autotools as it leads to better compile + time configurations that don't skip functions specialized for the + architecture. This was hurting the MacOS arm64 build. + Restore PyPy wheel builds. version 1.8.0 diff --git a/setup.py b/setup.py index 1ed64c2d..a15ac0e8 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,6 @@ import functools import os -import platform import shutil import subprocess import sys @@ -26,6 +25,7 @@ sys.platform.startswith("darwin") or sys.platform.startswith("gnu") or SYSTEM_IS_BSD) +SYSTEM_IS_MACOS = sys.platform.startswith("darwin") SYSTEM_IS_WINDOWS = sys.platform.startswith("win") # Since pip builds in a temp directory by default, setting a fixed file in @@ -74,7 +74,7 @@ def build_extension(self, ext): isa_l_build_dir = build_isa_l() if SYSTEM_IS_UNIX: ext.extra_objects = [ - os.path.join(isa_l_build_dir, "bin", "isa-l.a")] + os.path.join(isa_l_build_dir, ".libs", "libisal.a")] elif SYSTEM_IS_WINDOWS: ext.extra_objects = [ os.path.join(isa_l_build_dir, "isa-l_static.lib")] @@ -107,23 +107,23 @@ def build_isa_l(): build_env = os.environ.copy() if SYSTEM_IS_UNIX: build_env["CFLAGS"] = build_env.get("CFLAGS", "") + " -fPIC" + if SYSTEM_IS_MACOS: + # See: https://github.com/python/cpython/issues/97524 + build_env["LDFLAGS"] = ( + build_env.get("LDFLAGS", "") + + " -undefined dynamic_lookup -Wl,-no_fixup_chains") if hasattr(os, "sched_getaffinity"): cpu_count = len(os.sched_getaffinity(0)) else: # sched_getaffinity not available on all platforms cpu_count = os.cpu_count() or 1 # os.cpu_count() can return None run_args = dict(cwd=build_dir, env=build_env) if SYSTEM_IS_UNIX: - if platform.machine() == "aarch64": - cflags_param = "CFLAGS_aarch64" - else: - cflags_param = "CFLAGS_" make_cmd = "make" if SYSTEM_IS_BSD: make_cmd = "gmake" - subprocess.run([make_cmd, "-j", str(cpu_count), "-f", "Makefile.unx", - "isa-l.h", "bin/isa-l.a", - f"{cflags_param}={build_env.get('CFLAGS', '')}"], - **run_args) + subprocess.run(os.path.join(build_dir, "autogen.sh"), **run_args) + subprocess.run([os.path.join(build_dir, "configure")], **run_args) + subprocess.run([make_cmd, "-j", str(cpu_count)], **run_args) elif SYSTEM_IS_WINDOWS: subprocess.run(["nmake", "/f", "Makefile.nmake"], **run_args) else: diff --git a/src/isal/isal_zlibmodule.c b/src/isal/isal_zlibmodule.c index 3a280ec8..73db9775 100644 --- a/src/isal/isal_zlibmodule.c +++ b/src/isal/isal_zlibmodule.c @@ -587,7 +587,7 @@ Comp_dealloc(compobject *self) } static compobject * -newcompobject() +newcompobject(void) { compobject *self; self = PyObject_New(compobject, &IsalZlibCompType); @@ -656,7 +656,7 @@ set_inflate_zdict(decompobject *self) } static decompobject * -newdecompobject() +newdecompobject(void) { decompobject *self; self = PyObject_New(decompobject, &IsalZlibDecompType); @@ -1664,8 +1664,8 @@ GzipReader_read_into_buffer(GzipReader *self, uint8_t *out_buffer, size_t out_bu PyThreadState *_save; Py_UNBLOCK_THREADS while(1) { + size_t remaining; // Must be before labels. switch(self->stream_phase) { - size_t remaining; // Must be before labels. case GzipReader_HEADER: remaining = buffer_end - current_pos; if (remaining == 0 && self->all_bytes_read) { diff --git a/tox.ini b/tox.ini index c01b469a..d8274851 100644 --- a/tox.ini +++ b/tox.ini @@ -61,6 +61,17 @@ commands = python -m build twine check dist/* +[testenv:pedantic_compile] +deps=setuptools +skip_install=True +setenv= + CFLAGS=-Wall -Werror -Wpedantic + PYTHON_ISAL_LINK_DYNAMIC=1 +allowlist_externals = bash +commands = + bash -c 'CC=gcc python setup.py build_ext -f' + bash -c 'CC=clang python setup.py build_ext -f' + # Documentation should build on python version 3 [testenv:docs] deps=-r requirements-docs.txt