Compilation problem of Zig (master)/stage3 on Gentoo linux

Hi,
(guys from the matrix channel pointed my to this mailing list).

I am trying to compiling Zig from the repo (master) on GENTOO Linux, The compilation fails at stage3, because Core.h of llvm cannot be found. Llvm is installed by the package manager of GENTOO like this:

/usr/lib/llvm/14/include/llvm-c/Core.h
/usr/include/llvm → …/lib/llvm

(I included only the path to Core.h here - there is a lot more stuff.)

Stage 1 and stage 2 has no problems with this setup, stage 3 no longe finds Core.h.

How can I compile Zig from source successfully?

Cheers!
Tuxic

Hi! You can use =dev-lang/zig-9999 package, it was fixed 22 min. again:
https://github.com/gentoo/gentoo/pull/27112

If you don’t want to use ebuild, pass -DCMAKE_PREFIX_PATH=/usr/lib/llvm/14/ to cmake.

Hi,

thanks for the fast response to my post.

But I have still problems:
I freshly cloned the repo of zig and tried to build it.

It still fails to build.

My system is GENTOO Linux (multilib).
/etc/ld.so.conf includes all libs of llvm

But in a final step while linking the process fails to load LLVM-14, which exists where expected.
I attached a full build log.

…oooops! It says, that new user are not allowed to upload files.

Then I only could insert the one important line of the failed build process:

ld.lld: error: unable to find library -lLLVM-14
LLD Link… error: FileNotFound

Cheers!

Did you pass -DZIG_SHARED_LLVM=ON to CMake? Also, apply this patch. Related: Troubleshooting Build Issues · ziglang/zig Wiki · GitHub

But in a final step while linking the process fails to load LLVM-14, which exists where expected.
I attached a full build log.

Can you paste build log to pastebin please?

Hi Erik,

Sorry I skrewed up, what I wanted to say (I am no native speaker)…

The Gentoo build works fine. The build log of the “raw compile from repo” is here:

Cheers!