Skip to content

Fix a Typo Which Causes It Unable to Compile with Old Glibc#5694

Closed
PeronGH wants to merge 1 commit intoggml-org:masterfrom
PeronGH:master
Closed

Fix a Typo Which Causes It Unable to Compile with Old Glibc#5694
PeronGH wants to merge 1 commit intoggml-org:masterfrom
PeronGH:master

Conversation

@PeronGH
Copy link
Copy Markdown

@PeronGH PeronGH commented Feb 23, 2024

I encoutered this error when compiling llama.cpp.

ggml.c: In function 'ggml_numa_init':
ggml.c:2088:26: error: 'SYS_getcpu' undeclared (first use in this function); did you mean 'SYS_get_cpu'?
 2088 |     getcpu_ret = syscall(SYS_getcpu,&current_cpu,&g_state.numa.current_node);
      |                          ^~~~~~~~~~
      |                          SYS_get_cpu
ggml.c:2088:26: note: each undeclared identifier is reported only once for each function it appears in

I followed the comiler suggestions to fix the typo and then successfully compiled it.

Fix a typo which causes it unable to compile with old glibc
@cebtenzzre
Copy link
Copy Markdown
Collaborator

But this isn't a typo - there is no SYS_get_cpu on my system (Arch Linux with up-to-date Linux and glibc), only SYS_getcpu. Perhaps SYS_get_cpu was a typo in the headers that was later fixed?

See the discussion at #5557

@PeronGH
Copy link
Copy Markdown
Author

PeronGH commented Feb 23, 2024

Maybe this is specific to the old version of glibc? Here is more info about my system:

$ uname -a
Linux xxx 3.10.0-1160.105.1.el7.x86_64 #1 SMP Mon Nov 6 06:58:51 EST 2023 x86_64 x86_64 x86_64 GNU/Linux

$ gcc --version
gcc (conda-forge gcc 13.2.0-5) 13.2.0
...

$ ldd --version
ldd (GNU libc) 2.17
...

And SYS_get_cpu works for me, but SYS_getcpu doesn't.

@ggerganov
Copy link
Copy Markdown
Member

Maybe ifdef it specifically for that version of glibc

@petterreinholdtsen
Copy link
Copy Markdown
Contributor

See ggml-org/whisper.cpp#1897 for a proposed solution handling both SYS_ names.

@bobqianic
Copy link
Copy Markdown
Contributor

bobqianic commented Feb 24, 2024

I've searched through various versions of Linux but couldn't locate any reference to SYS_get_cpu. It seems only SYS_getcpu is available.

https://elixir.bootlin.com/linux/latest/A/ident

And SYS_get_cpu works for me, but SYS_getcpu doesn't.

This is strange.

hazelnutcloud pushed a commit to hazelnutcloud/llama.cpp that referenced this pull request Mar 10, 2024
NeoZhangJianyu pushed a commit to NeoZhangJianyu/llama.cpp that referenced this pull request Mar 12, 2024
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants