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

Compile fails on M1.

Open genevera opened this issue 1 year ago • 1 comments

For some reason I have been getting the following error when trying to compile whisper for my m1 running Ventura. I think maybe I'm using wrong MacOS-SDK but idk why this is failing. Below is the output of {make clean; make}

rm -f *.o main stream bench libwhisper.a libwhisper.so
cc  -I.              -O3 -std=c11   -pthread -DGGML_USE_ACCELERATE   -c ggml.c -o ggml.o
c++ -I. -I./examples -O3 -std=c++11 -pthread -c whisper.cpp -o whisper.o
In file included from whisper.cpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:185:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:136:20: error: use of undeclared identifier 'LC_COLLATE_MASK'
        collate  = LC_COLLATE_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:137:20: error: use of undeclared identifier 'LC_CTYPE_MASK'
        ctype    = LC_CTYPE_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:138:20: error: use of undeclared identifier 'LC_MONETARY_MASK'
        monetary = LC_MONETARY_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:139:20: error: use of undeclared identifier 'LC_NUMERIC_MASK'
        numeric  = LC_NUMERIC_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:140:20: error: use of undeclared identifier 'LC_TIME_MASK'
        time     = LC_TIME_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:141:20: error: use of undeclared identifier 'LC_MESSAGES_MASK'
        messages = LC_MESSAGES_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:355:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:375:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:758:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:777:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1011:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
In file included from whisper.cpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:752:26: error: use of undeclared identifier 'strtoll_l'
        long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:792:35: error: use of undeclared identifier 'strtoull_l'
        unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
                                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:821:12: error: use of undeclared identifier 'strtof_l'
    return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:827:12: error: use of undeclared identifier 'strtod_l'
    return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:833:12: error: use of undeclared identifier 'strtold_l'; did you mean 'strtoll'?
    return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib:116:9: note: 'strtoll' declared here
using ::strtoll _LIBCPP_USING_IF_EXISTS;
        ^
In file included from whisper.cpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:1107:9: error: use of undeclared identifier 'sscanf_l'
    if (__libcpp_sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bsd_locale_defaults.h:34:61: note: expanded from macro '__libcpp_sscanf_l'
#define __libcpp_sscanf_l(...)                              sscanf_l(__VA_ARGS__)
                                                            ^
In file included from whisper.cpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:1214:18: error: use of undeclared identifier 'isxdigit_l'; did you mean 'isxdigit'?
            if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cctype:114:9: note: 'isxdigit' declared here
using ::isxdigit _LIBCPP_USING_IF_EXISTS;
        ^
In file included from whisper.cpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:1214:18: error: too many arguments to function call, expected 1, have 2; did you mean '::std::isxdigit'?
            if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
                 ^~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cctype:114:9: note: '::std::isxdigit' declared here
using ::isxdigit _LIBCPP_USING_IF_EXISTS;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [whisper.o] Error 1

genevera avatar Nov 21 '22 11:11 genevera

Hmm, not sure what is the problem.

Try to compile a basic C++ program and see if it works:

// test.cpp
#include <fstream>
int main() { return 0; }
g++ -std=c++11 test.cpp

ggerganov avatar Nov 21 '22 16:11 ggerganov

Ah yep, must be something very wrong with my environment.. Same errors pretty much:

In file included from test.cpp:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:185:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:136:20: error: use of undeclared identifier 'LC_COLLATE_MASK'
        collate  = LC_COLLATE_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:137:20: error: use of undeclared identifier 'LC_CTYPE_MASK'
        ctype    = LC_CTYPE_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:138:20: error: use of undeclared identifier 'LC_MONETARY_MASK'
        monetary = LC_MONETARY_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:139:20: error: use of undeclared identifier 'LC_NUMERIC_MASK'
        numeric  = LC_NUMERIC_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:140:20: error: use of undeclared identifier 'LC_TIME_MASK'
        time     = LC_TIME_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:141:20: error: use of undeclared identifier 'LC_MESSAGES_MASK'
        messages = LC_MESSAGES_MASK,
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:355:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:375:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:758:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:777:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1011:5: error: unknown type name 'locale_t'; did you mean 'locale'?
    locale_t __l;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:125:24: note: 'locale' declared here
class _LIBCPP_TYPE_VIS locale
                       ^
In file included from test.cpp:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:752:26: error: use of undeclared identifier 'strtoll_l'
        long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:792:35: error: use of undeclared identifier 'strtoull_l'
        unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
                                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:821:12: error: use of undeclared identifier 'strtof_l'
    return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:827:12: error: use of undeclared identifier 'strtod_l'
    return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:833:12: error: use of undeclared identifier 'strtold_l'; did you mean 'strtoll'?
    return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib:116:9: note: 'strtoll' declared here
using ::strtoll _LIBCPP_USING_IF_EXISTS;
        ^
In file included from test.cpp:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:1107:9: error: use of undeclared identifier 'sscanf_l'
    if (__libcpp_sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bsd_locale_defaults.h:34:61: note: expanded from macro '__libcpp_sscanf_l'
#define __libcpp_sscanf_l(...)                              sscanf_l(__VA_ARGS__)
                                                            ^
In file included from test.cpp:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:1214:18: error: use of undeclared identifier 'isxdigit_l'; did you mean 'isxdigit'?
            if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cctype:114:9: note: 'isxdigit' declared here
using ::isxdigit _LIBCPP_USING_IF_EXISTS;
        ^
In file included from test.cpp:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:188:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:140:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:1214:18: error: too many arguments to function call, expected 1, have 2; did you mean '::std::isxdigit'?
            if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
                 ^~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cctype:114:9: note: '::std::isxdigit' declared here
using ::isxdigit _LIBCPP_USING_IF_EXISTS;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

genevera avatar Nov 21 '22 19:11 genevera

It's definitely a problem for any logged in user so this has nothing to do with whisper except that it caused me to notice this.

Update 2022-12-06 (in case somehow Google gets you here): I had created symlinks to various header files located in /opt/homebrew/include in /usr/local (e.g. /usr/local/include/lol.h was a symlink to /opt/homebrew/include/lol.h). This is ultimately what caused the problem mentioned in this ticket. Deleting those symlinks is what fixed compilation for me. I just wiped them all out as I couldn't remember to which end I initially symlinked everything.

genevera avatar Nov 21 '22 20:11 genevera