Error with llvm-mingw (clang version 16.0.6)
Some warnings that are causing errors.
PS C:\Users\ernes\Downloads\ggml> cd build PS C:\Users\ernes\Downloads\ggml\build> cmake .. -GNinja CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.
Update the VERSION argument
-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/ernes/scoop/apps/llvm-mingw/current/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/ernes/scoop/apps/llvm-mingw/current/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/Users/ernes/scoop/shims/git.exe (found version "2.41.0.windows.3")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- CMAKE_SYSTEM_PROCESSOR: AMD64
-- x86 detected
-- x86 detected
-- Configuring done (2.9s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/ernes/Downloads/ggml/build
PS C:\Users\ernes\Downloads\ggml\build> cm^C
PS C:\Users\ernes\Downloads\ggml\build> ninja
[7/72] Building C object tests/CMakeFiles/test-vec0.dir/test-vec0.c.obj
FAILED: tests/CMakeFiles/test-vec0.dir/test-vec0.c.obj
C:\Users\ernes\scoop\apps\llvm-mingw\current\bin\cc.exe -IC:/Users/ernes/Downloads/ggml/src/. -IC:/Users/ernes/Downloads/ggml/src/../include -IC:/Users/ernes/Downloads/ggml/src/../include/ggml -mfma -mf16c -mavx -mavx2 -O3 -DNDEBUG -std=gnu11 -MD -MT tests/CMakeFiles/test-vec0.dir/test-vec0.c.obj -MF tests\CMakeFiles\test-vec0.dir\test-vec0.c.obj.d -o tests/CMakeFiles/test-vec0.dir/test-vec0.c.obj -c C:/Users/ernes/Downloads/ggml/tests/test-vec0.c
C:/Users/ernes/Downloads/ggml/tests/test-vec0.c:99:31: error: call to undeclared library function 'aligned_alloc' with type 'void *(unsigned long long, unsigned long long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
afloat * src0 = (float *)(aligned_alloc(32, sizeof(float)NM));
^
C:/Users/ernes/Downloads/ggml/tests/test-vec0.c:99:31: note: include the header <stdlib.h> or explicitly provide a declaration for 'aligned_alloc'
1 error generated.
[34/72] Building C object src/CMakeFiles/ggml.dir/ggml.c.obj
C:/Users/ernes/Downloads/ggml/src/ggml.c:2346:5: warning: implicit conversion increases floating-point precision: 'float' to 'ggml_float' (aka 'double') [-Wdouble-promotion]
GGML_F16_VEC_REDUCE(sumf, sum);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/ernes/Downloads/ggml/src/ggml.c:1978:37: note: expanded from macro 'GGML_F16_VEC_REDUCE'
#define GGML_F16_VEC_REDUCE GGML_F32Cx8_REDUCE
^
C:/Users/ernes/Downloads/ggml/src/ggml.c:1968:33: note: expanded from macro 'GGML_F32Cx8_REDUCE'
#define GGML_F32Cx8_REDUCE GGML_F32x8_REDUCE
^
C:/Users/ernes/Downloads/ggml/src/ggml.c:1914:11: note: expanded from macro 'GGML_F32x8_REDUCE'
res = _mm_cvtss_f32(_mm_hadd_ps(t1, t1));
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/ernes/Downloads/ggml/src/ggml.c:3388:9: warning: implicit conversion increases floating-point precision: 'float' to 'ggml_float' (aka 'double') [-Wdouble-promotion]
GGML_F16_VEC_REDUCE(sumf[k], sum[k]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/ernes/Downloads/ggml/src/ggml.c:1978:37: note: expanded from macro 'GGML_F16_VEC_REDUCE'
#define GGML_F16_VEC_REDUCE GGML_F32Cx8_REDUCE
^
C:/Users/ernes/Downloads/ggml/src/ggml.c:1968:33: note: expanded from macro 'GGML_F32Cx8_REDUCE'
#define GGML_F32Cx8_REDUCE GGML_F32x8_REDUCE
^
C:/Users/ernes/Downloads/ggml/src/ggml.c:1914:11: note: expanded from macro 'GGML_F32x8_REDUCE'
res = _mm_cvtss_f32(_mm_hadd_ps(t1, t1));
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
[36/72] Building CXX object examples/whisper/CMakeFiles/whisper-cpp.dir/whisper.cpp.obj
ninja: build stopped: subcommand failed.
PS C:\Users\ernes\Downloads\ggml\build> clang -v
clang version 16.0.6 (https://github.com/llvm/llvm-project.git 7cbf1a2591520c2491aa35339f227775f4d3adf6)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/Users/ernes/scoop/apps/llvm-mingw/current/bin
See https://stackoverflow.com/questions/62962839/stdaligned-alloc-missing-from-visual-studio-2019 for a possible reason for this, and suggested solution of using macros to switch between the implementations.
Apparently this isn't available on MacOS either. See: https://gitlab.com/gromacs/gromacs/-/issues/3968
https://github.com/ggerganov/ggml/pull/619