whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Error building PPC64 LE

Open aviks opened this issue 1 year ago • 3 comments

I've been trying to cross compile whisper.cpp to the powerpc64le-linux-gnu platform, with the Cmake build files, and GCC 8.1.0, and getting the following error. Any tips or ideas? Is there a minimum GCC version I should try?

[20:06:41] make[2]: Entering directory '/workspace/srcdir/whisper.cpp/build'
--
  | [20:06:41] [ 33%] Building C object CMakeFiles/whisper.dir/ggml.c.o
  | [20:06:41] /opt/bin/powerpc64le-linux-gnu-libgfortran5-cxx03/powerpc64le-linux-gnu-gcc --sysroot=/opt/powerpc64le-linux-gnu/powerpc64le-linux-gnu/sys-root/ -DWHISPER_SHARED -Dwhisper_EXPORTS -I/workspace/srcdir/whisper.cpp/. -Wall                                       -Wextra                                     -Wpedantic                                  -Wshadow                                    -Wcast-qual                                 -Wstrict-prototypes                         -Wpointer-arith                             -Wno-unused-function                     -Werror=vla -mavx -mavx2 -mfma -mf16c -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/whisper.dir/ggml.c.o -MF CMakeFiles/whisper.dir/ggml.c.o.d -o CMakeFiles/whisper.dir/ggml.c.o -c /workspace/srcdir/whisper.cpp/ggml.c
  | [20:06:41] [ 66%] Building CXX object CMakeFiles/whisper.dir/whisper.cpp.o
  | [20:06:41] /opt/bin/powerpc64le-linux-gnu-libgfortran5-cxx03/powerpc64le-linux-gnu-g++ --sysroot=/opt/powerpc64le-linux-gnu/powerpc64le-linux-gnu/sys-root/ -DWHISPER_SHARED -Dwhisper_EXPORTS -I/workspace/srcdir/whisper.cpp/. -Wall                                       -Wextra                                     -Wpedantic                                  -Wcast-qual                              -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/whisper.dir/whisper.cpp.o -MF CMakeFiles/whisper.dir/whisper.cpp.o.d -o CMakeFiles/whisper.dir/whisper.cpp.o -c /workspace/srcdir/whisper.cpp/whisper.cpp
  | [20:06:41] powerpc64le-linux-gnu-gcc: error: unrecognized command line option ‘-mavx’; did you mean ‘-mads’?
  | [20:06:41] powerpc64le-linux-gnu-gcc: error: unrecognized command line option ‘-mavx2’
  | [20:06:41] powerpc64le-linux-gnu-gcc: error: unrecognized command line option ‘-mfma’; did you mean ‘-memb’?
  | [20:06:41] powerpc64le-linux-gnu-gcc: error: unrecognized command line option ‘-mf16c’
  | [20:06:41] make[2]: *** [CMakeFiles/whisper.dir/build.make:76: CMakeFiles/whisper.dir/ggml.c.o] Error 1
  | [20:06:41] make[2]: *** Waiting for unfinished jobs....
  | [20:06:51] make[2]: Leaving directory '/workspace/srcdir/whisper.cpp/build'
  | [20:06:51] make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/whisper.dir/all] Error 2
  | [20:06:51] make[1]: Leaving directory '/workspace/srcdir/whisper.cpp/build'

aviks avatar Feb 07 '23 20:02 aviks

Not sure if this is meant to be supported, feel free to close otherwise.

aviks avatar Feb 07 '23 21:02 aviks

Maybe @fitzsim can provide some info - they developed most of the PPC64 port

ggerganov avatar Feb 11 '23 07:02 ggerganov

When I build natively on POWER9, I don't use CMake. I just use the checked-in Makefile. The output is attached.

You'll have to get CMake to set the same options. You should just assume the target is >= POWER9, since POWER8 and below aren't supported yet anyway. The Makefile does a check of /proc/cpuinfo to determine options; this works natively when building on systems running the Linux kernel, but it is not portable, and it is incorrect when cross-compiling.

I whisper.cpp build info: 
I UNAME_S:  Linux
I UNAME_P:  unknown
I UNAME_M:  ppc64le
I CFLAGS:   -I.              -O3 -std=c11   -fPIC -pthread -mpower9-vector
I CXXFLAGS: -I. -I./examples -O3 -std=c++11 -fPIC -pthread
I LDFLAGS:  
I CC:       cc (Debian 10.2.1-6) 10.2.1 20210110
I CXX:      g++ (Debian 10.2.1-6) 10.2.1 20210110

cc  -I.              -O3 -std=c11   -fPIC -pthread -mpower9-vector   -c ggml.c -o ggml.o
g++ -I. -I./examples -O3 -std=c++11 -fPIC -pthread -c whisper.cpp -o whisper.o
In file included from /usr/include/c++/10/algorithm:62,
                 from whisper.cpp:6:
/usr/include/c++/10/bits/stl_algo.h: In function ‘void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<whisper_full(whisper_context*, whisper_full_params, const float*, int)::beam_candidate*, std::vector<whisper_full(whisper_context*, whisper_full_params, const float*, int)::beam_candidate> >; _Compare = __gnu_cxx::__ops::_Val_comp_iter<whisper_full(whisper_context*, whisper_full_params, const float*, int)::<lambda(const whisper_full(whisper_context*, whisper_full_params, const float*, int)::beam_candidate&, const whisper_full(whisper_context*, whisper_full_params, const float*, int)::beam_candidate&)> >]’:
/usr/include/c++/10/bits/stl_algo.h:1819:5: note: the layout of aggregates containing vectors with 8-byte alignment has changed in GCC 5
 1819 |     __unguarded_linear_insert(_RandomAccessIterator __last,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
g++ -I. -I./examples -O3 -std=c++11 -fPIC -pthread examples/main/main.cpp ggml.o whisper.o -o main 

fitzsim avatar Feb 12 '23 14:02 fitzsim