Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

broken build on fedora #22

Closed
sylvain-reynaud opened this issue Mar 16, 2023 · 7 comments
Closed

broken build on fedora #22

sylvain-reynaud opened this issue Mar 16, 2023 · 7 comments

Comments

@sylvain-reynaud
Copy link

The build is broken on fedora 37.

full logs : https://gist.github.com/sylvain-reynaud/fe73ccc7edad1f4f98688cb48b1f101c

--- stderr
  ggml/ggml.h:177:10: fatal error: 'stddef.h' file not found
  thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("ggml/ggml.h:177:10: fatal error: 'stddef.h' file not found\n")', ggml-raw/build.rs:31:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Fix

On Fedora, to avoid build errors due to the missing stddef.h file, you may need to install the following packages:

sudo dnf groupinstall "Development Tools" "Development Libraries"

Then build with CPATH set to the location of the gcc headers :

CPATH="/usr/lib/gcc/x86_64-redhat-linux/12/include/" cargo build --release

Tested on my laptop fedora 37 and fedora:latest docker image.

@setzer22
Copy link
Collaborator

setzer22 commented Mar 16, 2023

That's odd... Of all the possible distros, I happen to be on Fedora 37! 🤣

The thing is, I had to do nothing of the sort. I probably already had the C compiler + headers from other projects, but I definitely didn't have to set up CPATH, the C code builds for me just fine.

Can you try the same fix, minus the CPATH to see whether it works?

@sylvain-reynaud
Copy link
Author

@setzer22 ahah, sure, I had tested it:

docker run -it fedora bash

Then

ls /usr/lib/        #no gcc
dnf groupinstall "Development Tools" "Development Libraries"
ls /usr/lib/gcc/x86_64-redhat-linux/12/include/        #installed
git clone https://github.com/sylvain-reynaud/llama-rs
cd llama-rs/
curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"
cargo build --release        #still fails
CPATH="/usr/lib/gcc/x86_64-redhat-linux/12/include/" cargo build --release        #success

thank you for your fast response btw

@sylvain-reynaud
Copy link
Author

I just tried by opening a new bash in the previous container, cargo clean and cargo build --release. It is still broken.

@setzer22
Copy link
Collaborator

setzer22 commented Mar 16, 2023

Thanks again! Will try to investigate a bit more why exactly the CPATH isn't needed on my system 🤔

Could this have anything to do with the fact I have llvm and clang installed on my system?

@sylvain-reynaud
Copy link
Author

@setzer22 I'm sorry I have no idea. I may take a look this evening.

@philpax
Copy link
Collaborator

philpax commented Mar 16, 2023

Yeah, I just realised that we need llvm/clang for bindgen.

@philpax
Copy link
Collaborator

philpax commented Mar 26, 2023

Should be solved by #73.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants