Fix missing includes: <cstring> and <cassert> during build - #84
Open
dahbiz wants to merge 1 commit into
Open
Conversation
felixdollack
referenced
this pull request
in felixdollack/fCWT
May 15, 2026
…#84) - Fix delete→free in Morlet::getWavelet() for malloc-allocated memory - Fix memory leak: free lastscalemem with _aligned_free/_aligned_malloc on Windows, free/aligned_alloc on POSIX - Add missing <cassert> include (issue #84) - Also fix indentation in convolve() else branch Co-Authored-By: Oz <oz-agent@warp.dev>
This was referenced May 15, 2026
Open
felixdollack
added a commit
to felixdollack/fCWT_org
that referenced
this pull request
Aug 28, 2026
The extension does not compile on arm64 macOS. Three things break: 1. `-mavx` is rejected by clang for arm64-apple-darwin targets. The AVX code paths are already guarded by `#if defined(__AVX__)` (fcwt.h) and `#ifdef AVX` (fcwt.cpp), so omitting the flag selects the scalar path. 2. `-lomp` resolves to the vendored libs/libomp.a, which is x86_64-only. The fftw3f archives are universal (x86_64 + arm64); only the OpenMP runtime is missing. Building with -DSINGLE_THREAD takes the non-OpenMP path instead. Note that nthreads is then ignored. 3. Without omp.h, fcwt.cpp has no declaration for assert() or for memset()/memcpy(); they had only ever arrived transitively. The x86_64 macOS and Linux paths are left unchanged. For (3), <cassert> and <cstring> are added to fcwt.h. This is the same fix as PR fastlib#84, and it also covers the MSVC failure in issue fastlib#79 (error C3861: 'assert': identifier not found, at the five assert sites in fcwt.cpp) and the MinGW report in issue fastlib#81 -- neither of which is specific to Apple Silicon. memset/memcpy are used at seven sites in fcwt.cpp with no <cstring> include anywhere in the tree. Also add libs/ to include_dirs so that the `#include "fftw3.h"` in fcwt.h resolves when building from a repository checkout. PR fastlib#32 landed the matching library_dirs entry but not this one; the 0.1.18 sdist on PyPI already carries the include path. Verified on Darwin 25.3.0 / arm64 with Python 3.11.14: the extension builds, `fcwt.cwt()` of a 50 Hz tone (fs=1000, f0=1, f1=100, fn=64, log scaling) peaks in the expected bin, and tests/test_fcwt.py gives 7 passed, 1 failed. The remaining failure, test_plan, is unrelated to this change: only the std::string overload of create_FFT_optimization_plan is present in the checked-in SWIG wrapper, so the (int, int) call in the test cannot dispatch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.