Skip to content

Conversation

DamonFool
Copy link
Contributor

llama.cpp fails to build with -march=armv9-a on MacOS.

cmake .. -DCMAKE_C_FLAGS=-march=armv9-a \
         -DCMAKE_CXX_FLAGS=-march=armv9-a

The failure is caused by 'sys/prctl.h' file not found.

In file included from /Users/jiefu/llama.cpp/ggml/src/ggml-quants.c:6:
/Users/jiefu/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-impl.h:72:10: fatal error: 'sys/prctl.h' file not found
   72 | #include <sys/prctl.h>
      |          ^~~~~~~~~~~~~
1 error generated.

Similar issue had been reported before: sysown/proxysql#1920 .
Reason: sys/prctl.h does not exist on Mac OS X, only on Linux.

The fix follows what has been done in ggml by adding defined(__linux__) : https://github.com/ggml-org/llama.cpp/blob/master/ggml/src/ggml.c#L72

Copy link
Member

@slaren slaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use SVE ggml_init_arm_arch_features needs to be implemented to initialize sve_cnt.

@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Oct 11, 2025
Signed-off-by: Jie Fu <[email protected]>
@DamonFool
Copy link
Contributor Author

To use SVE ggml_init_arm_arch_features needs to be implemented to initialize sve_cnt.

Good catch.

But it is hard for me to implement the logic since I don't have a Mac which supports sve.

I would suggest fixing the build failure as soon as possible.
And then implement ggml_init_arm_arch_features in another PR by some sve expert.

Maybe, we can add a #pragma message just like https://github.com/ggml-org/llama.cpp/blob/master/ggml/src/ggml-opencl/ggml-opencl.cpp#L2801

What do you think?
Thanks.

@slaren
Copy link
Member

slaren commented Oct 13, 2025

A message would not be enough, it would need to be an #error to stop the build. Enabling SVE without implementing this function will likely lead to errors.

@DamonFool
Copy link
Contributor Author

A message would not be enough, it would need to be an #error to stop the build.

Done.
Thanks @slaren .

@ggerganov ggerganov merged commit 01d2bdc into ggml-org:master Oct 13, 2025
69 of 70 checks passed
@DamonFool
Copy link
Contributor Author

Thanks @slaren and @ggerganov .

@DamonFool DamonFool deleted the sve-broken branch October 13, 2025 14:00
gabe-l-hart added a commit to gabe-l-hart/llama.cpp that referenced this pull request Oct 13, 2025
* origin/master: (32 commits)
metal : FA support F32 K and V and head size = 32 (ggml-org#16531)
graph : support cacheless embeddings with FA and iSWA (ggml-org#16528)
opencl: fix build targeting CL 2 (ggml-org#16554)
CUDA: fix numerical issues in tile FA kernel (ggml-org#16540)
ggml : fix build broken with -march=armv9-a on MacOS (ggml-org#16520)
CANN: fix CPU memory leak in CANN backend (ggml-org#16549)
fix: add remark plugin to render raw HTML as literal text (ggml-org#16505)
metal: add support for opt_step_sgd (ggml-org#16539)
ggml : fix scalar path for computing norm (ggml-org#16558)
CANN: Update several operators to support FP16 data format (ggml-org#16251)
metal : add opt_step_adamw and op_sum (ggml-org#16529)
webui: remove client-side context pre-check and rely on backend for limits (ggml-org#16506)
[SYCL] fix UT fault cases: count-equal, argsort, pad OPs (ggml-org#16521)
ci : add Vulkan on Ubuntu with default packages build (ggml-org#16532)
common : handle unicode during partial json parsing (ggml-org#16526)
common : update presets (ggml-org#16504)
ggml : Fix FP16 ELU positive branch (ggml-org#16519)
hparams : add check for layer index in is_recurrent (ggml-org#16511)
ggml: Correct SVE implementation in ggml_vec_dot_f16_unroll (ggml-org#16518)
CUDA: faster tile FA, add oob checks, more HSs (ggml-org#16492)
...
yael-works pushed a commit to yael-works/llama.cpp that referenced this pull request Oct 15, 2025
* ggml : fix build broken with -march=armv9-a on MacOS

Signed-off-by: Jie Fu <[email protected]>

* Add #pragma message

Signed-off-by: Jie Fu <[email protected]>

* Address review comment.

Signed-off-by: Jie Fu <[email protected]>

* Update ggml/src/ggml-cpu/ggml-cpu.c

---------

Signed-off-by: Jie Fu <[email protected]>
Co-authored-by: Diego Devesa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants