ggerganov / llama.cpp

LLM inference in C/C++
MIT License
65.09k stars 9.33k forks source link

Make Fail eaa6ca5 #2015

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi,

make fails to build with eaa6ca5

here's the error:

~/ollama> make
I llama.cpp build info:
I UNAME_S:  Linux
I UNAME_P:  unknown
I UNAME_M:  aarch64
I CFLAGS:   -I.              -O3 -std=c11   -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -pthread -DGGML_USE_K_QUANTS -mcpu=native
I CXXFLAGS: -I. -I./examples -O3 -std=c++11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -pthread -DGGML_USE_K_QUANTS -mcpu=native
I LDFLAGS:
I CC:       clang version 16.0.6
I CXX:      clang version 16.0.6

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
cc  -I.              -O3 -std=c11   -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -pthread -DGGML_USE_K_QUANTS -mcpu=native   -c ggml.c -o ggml.o
ggml.c:16644:14: error: call to undeclared function 'pthread_setaffinity_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    int rv = pthread_setaffinity_np(pthread_self(), setsize, cpus);
             ^
ggml.c:16666:14: error: call to undeclared function 'pthread_setaffinity_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    int rv = pthread_setaffinity_np(pthread_self(), setsize, cpus);
             ^
2 errors generated.
make: *** [Makefile:263: ggml.o] Error 1

I also tried cmake and received the same error messages.

Thank you.

Green-Sky commented 1 year ago

make fails to build with eaa6ca5

you probably meant this commit https://github.com/ggerganov/llama.cpp/commit/b853d456018b10820686362af41b2f2f75f1eec6

looks like pthread_*_np are gnu extensions and might not be available everywhere. But you are on linux, so it should be available. I can see you are on arm, what device/os are you using?

ghost commented 1 year ago

make fails to build with eaa6ca5

you probably meant this commit b853d45

Possibly? I figured the issue would resolve itself by downloading the latest release, but I'm wrong. I tried to build master-0be54f7 and have the same error.

looks like pthread_*_np are gnu extensions and might not be available everywhere. But you are on linux, so it should be available. I can see you are on arm, what device/os are you using?

Yes, it is ARM - I use an Android device, Samsung s10+ through Termux.

Linux localhost 4.14.190-23725627-abG975WVLS8IWD1 #2 SMP PREEMPT Mon Apr 10 18:16:39 KST 2023 aarch64 Android
lscpu
Architecture:           aarch64
  CPU op-mode(s):       32-bit, 64-bit
  Byte Order:           Little Endian
CPU(s):                 8
  On-line CPU(s) list:  0-7
Vendor ID:              Qualcomm
  Model name:           Kryo-4XX-Silver
    Model:              14
    Thread(s) per core: 1
    Core(s) per socket: 4
    Socket(s):          1
    Stepping:           0xd
    CPU(s) scaling MHz: 100%
    CPU max MHz:        1785.6000
    CPU min MHz:        300.0000
    BogoMIPS:           38.40
    Flags:              fp asimd evtstrm aes pmull
                         sha1 sha2 crc32 atomics f
                        php asimdhp cpuid asimdrdm
                         lrcpc dcpop asimddp
  Model name:           Kryo-4XX-Gold
    Model:              14
    Thread(s) per core: 1
    Core(s) per socket: 2
    Socket(s):          2
    Stepping:           0xd
    CPU(s) scaling MHz: 83%
    CPU max MHz:        2841.6001
    CPU min MHz:        710.4000
    BogoMIPS:           38.40
    Flags:              fp asimd evtstrm aes pmull
                         sha1 sha2 crc32 atomics f
                        php asimdhp cpuid asimdrdm
                         lrcpc dcpop asimddp
Green-Sky commented 1 year ago

did a little digging and SO pointed me to this: https://android.googlesource.com/platform/bionic/+/master/docs/status.md which lists supported libc functionallity by bionic, androids libc implementation.

the fix would be to test for __BIONIC__ and don't use setaffinity when it is define.

i opened a pr to fix this #2020

ghost commented 1 year ago

did a little digging and SO pointed me to this: https://android.googlesource.com/platform/bionic/+/master/docs/status.md which lists supported libc functionallity by bionic, androids libc implementation.

the fix would be to test for __BIONIC__ and don't use setaffinity when it is define.

i opened a pr to fix this #2020

Thanks for your response. I'm going to try to pull this, but it might take me a minute to figure out how to do so, so I'll report back as soon as possible.

ghost commented 1 year ago

I didn't figure out git, instead I copy/pasted the solution into my ggml.c file which worked.

Your solution allows me to make, thank you!

I'll close for now trusting your solution will be implemented going forward.