Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 942563 - dev-lang/zig-0.13.0 - [gcc-15] /.../zig_llvm.cpp: error: static assertion failed
Summary: dev-lang/zig-0.13.0 - [gcc-15] /.../zig_llvm.cpp: error: static assertion failed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Eric Joldasov
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-10-30 18:46 UTC by Toralf Förster
Modified: 2024-11-06 13:35 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,21.64 KB, text/plain)
2024-10-30 18:46 UTC, Toralf Förster
Details
dev-lang:zig-0.13.0:20241030-184044.log (dev-lang:zig-0.13.0:20241030-184044.log,9.72 KB, text/plain)
2024-10-30 18:46 UTC, Toralf Förster
Details
emerge-history.txt.xz (emerge-history.txt.xz,97.70 KB, application/x-xz)
2024-10-30 18:46 UTC, Toralf Förster
Details
environment (environment,128.65 KB, text/plain)
2024-10-30 18:46 UTC, Toralf Förster
Details
etc.clang.tar.xz (etc.clang.tar.xz,1.15 KB, application/x-xz)
2024-10-30 18:46 UTC, Toralf Förster
Details
etc.portage.tar.xz (etc.portage.tar.xz,36.76 KB, application/x-xz)
2024-10-30 18:46 UTC, Toralf Förster
Details
logs.tar.xz (logs.tar.xz,41.85 KB, application/x-xz)
2024-10-30 18:46 UTC, Toralf Förster
Details
qlist-info.txt.xz (qlist-info.txt.xz,99.66 KB, application/x-xz)
2024-10-30 18:46 UTC, Toralf Förster
Details
build.log for gcc 14 (build.log,11.50 KB, text/x-log)
2024-11-02 13:46 UTC, yongxiang
Details
build.log after patch (build.log.bz2,110.05 KB, application/x-bzip2)
2024-11-02 14:57 UTC, yongxiang
Details
build.log with enable all qemu user targets (build.log.bz2,109.93 KB, application/x-bzip2)
2024-11-02 16:59 UTC, yongxiang
Details
build.log after patch (successful) (build.log.3.bz2,134.18 KB, application/x-bzip2)
2024-11-02 23:17 UTC, Eric Joldasov
Details
emerge --info (emerge-info-for-qemu,9.03 KB, text/plain)
2024-11-03 05:23 UTC, yongxiang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2024-10-30 18:46:37 UTC
too long lines were shrinked:

[2/19] : && /usr/bin/x86_64-pc-linux-musl-gcc -O2 -pipe -march=native -fno-diagnostics-color -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--defsym=__gentoo_check_ldflags__=0 CMakeFiles/zig-wasm2c.dir/stage1/wasm2c.c.o -o zig-wasm2c -L/usr/lib/llvm/18/lib  && :
[3/19] cd /var/tmp/portage/dev-lang/zig-0.13.0/work/zig-0.13.0 && /var/tmp/portage/dev-lang/zig-0.13.0/work/zig-0.13.0/build/zig-wasm2c /var/tmp/portage/dev-lang/zig-0.13.0/work/zig-0.13.0/stage1/zig1.wasm /var/tmp/portage/dev-lang/zig-0.13.0/work/zig-0.13.0/build/zig1.c
[4/19] /usr/bin/x86_64-pc-linux-musl-g++ -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/lib/llvm/18/include  -O2 -pipe -march=native -fno-diagnostics-color -fno-diagnostics-color -fno-exceptions -fno-rtti -fno-stack-protector -fvisibility-inlines-hidden -W
[5/19] /usr/bin/x86_64-pc-linux-musl-g++ -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/lib/llvm/18/include  -O2 -pipe -march=native -fno-diagnostics-color -fno-diagnostics-color -fno-exceptions -fno-rtti -fno-stack-protector -fvisibility-inlines-hidden -W
FAILED: CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o 
/usr/bin/x86_64-pc-linux-musl-g++ -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/lib/llvm/18/include  -O2 -pipe -march=native -fno-diagnostics-color -fno-diagnostics-color -fno-exceptions -fno-rtti -fno-stack-protector -fvisibility-inlines-hidden -Wno-type
/var/tmp/portage/dev-lang/zig-0.13.0/work/zig-0.13.0/src/zig_llvm.cpp:738:68: error: static assertion failed
  738 | static_assert((Triple::EnvironmentType)ZigLLVM_LastEnvironmentType == Triple::LastEnvironmentType, "");
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 23.0_musl_hardened-20241019-170007

  UNMASKED:
  <sys-devel/gcc-15.0.9999:15

  The attached etc.portage.tar.xz has all details.
  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-musl-15 *
clang version 19.1.2
llvm-config: 19.1.2
Python 3.12.7
go version go1.23.2 linux/amd64
  [1]   php8.2
  [2]   php8.3 *
Available Ruby profiles:
  [1]   ruby32 (with Rubygems) *
Available Rust versions:
  [1]   rust-bin-1.82.0
  [2]   rust-1.82.0 *
The following VMs are available for generation-2:
1)	Eclipse Temurin JDK 11.0.25_p9 [openjdk-bin-11]
2)	Eclipse Temurin JDK 17.0.13_p11 [openjdk-bin-17]
*)	Eclipse Temurin JDK 21.0.5_p11 [openjdk-bin-21]
Available Java Virtual Machines:
  [1]   openjdk-bin-11 
  [2]   openjdk-bin-17 
  [3]   openjdk-bin-21  system-vm


  HEAD of ::gentoo
commit f26652a96bf094429c7ce17d54806da9b7075893
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Wed Oct 30 17:33:36 2024 +0000

    2024-10-30 17:33:36 UTC

emerge -qpvO =dev-lang/zig-0.13.0
[ebuild  N    ] dev-lang/zig-0.13.0  USE="-doc -test -verify-sig"
Comment 1 Toralf Förster gentoo-dev 2024-10-30 18:46:38 UTC
Created attachment 907391 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2024-10-30 18:46:39 UTC
Created attachment 907392 [details]
dev-lang:zig-0.13.0:20241030-184044.log
Comment 3 Toralf Förster gentoo-dev 2024-10-30 18:46:40 UTC
Created attachment 907393 [details]
emerge-history.txt.xz
Comment 4 Toralf Förster gentoo-dev 2024-10-30 18:46:41 UTC
Created attachment 907394 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2024-10-30 18:46:42 UTC
Created attachment 907395 [details]
etc.clang.tar.xz
Comment 6 Toralf Förster gentoo-dev 2024-10-30 18:46:43 UTC
Created attachment 907396 [details]
etc.portage.tar.xz
Comment 7 Toralf Förster gentoo-dev 2024-10-30 18:46:44 UTC
Created attachment 907397 [details]
logs.tar.xz
Comment 8 Toralf Förster gentoo-dev 2024-10-30 18:46:46 UTC
Created attachment 907398 [details]
qlist-info.txt.xz
Comment 10 Eric Joldasov 2024-11-02 12:06:34 UTC
https://github.com/ziglang/zig/pull/21862 does not apply cleanly, I'll need to backport it...
Comment 11 yongxiang 2024-11-02 13:46:23 UTC
Created attachment 907677 [details]
build.log for gcc 14

I have the same problem when trying to run emerge --empty under default/linux/amd64/23.0/systemd profile
Comment 12 Eric Joldasov 2024-11-02 13:54:39 UTC
(In reply to yongxiang from comment #11)
> Created attachment 907677 [details]
> build.log for gcc 14
> 
> I have the same problem when trying to run emerge --empty under
> default/linux/amd64/23.0/systemd profile

Could you please test with following patch (ideally with tests enabled)? And write your LLVM version? Testing it right now with sys-devel/llvm-18.1.8-r1, I think only 18.1.8-r6 is affected?
Comment 13 Eric Joldasov 2024-11-02 13:58:18 UTC
https://paste.sr.ht/blob/6b0321c550ef8b3eb87b501fd76476ec88a5af5f

It was too large for attachment, sorry.
Comment 14 yongxiang 2024-11-02 14:08:33 UTC
(In reply to Eric Joldasov from comment #12)
> (In reply to yongxiang from comment #11)
> > Created attachment 907677 [details]
> > build.log for gcc 14
> > 
> > I have the same problem when trying to run emerge --empty under
> > default/linux/amd64/23.0/systemd profile
> 
> Could you please test with following patch (ideally with tests enabled)? And
> write your LLVM version? Testing it right now with sys-devel/llvm-18.1.8-r1,
> I think only 18.1.8-r6 is affected?

The previous build.log is under sys-devel/llvm-18.1.8-r6.
I'll try to test under sys-devel/llvm-18.1.8-r1 later.
Comment 15 Eric Joldasov 2024-11-02 14:29:40 UTC
 > The previous build.log is under sys-devel/llvm-18.1.8-r6.
> I'll try to test under sys-devel/llvm-18.1.8-r1 later.

Thanks, and could you re-test with -r6 (not changing revisions) and patch please? No need to downgrade LLVM version
Comment 16 yongxiang 2024-11-02 14:57:58 UTC
Created attachment 907683 [details]
build.log after patch

On my side, after adding the patch, the compilation passes, but the test fails.
Opening build.log directly gives me encoding errors, I use ansifilter to handle escape codes.
Comment 17 yongxiang 2024-11-02 14:58:54 UTC
The above build is based on sys-devel/llvm-18.1.8-r6
Comment 18 Eric Joldasov 2024-11-02 16:06:10 UTC
(In reply to yongxiang from comment #16)
> Created attachment 907683 [details]
> build.log after patch
> 
> On my side, after adding the patch, the compilation passes, but the test
> fails.
> Opening build.log directly gives me encoding errors, I use ansifilter to
> handle escape codes.

Hmm, similar errors appeared in https://github.com/gentoo/gentoo/pull/37257 . Can you re-try with all QEMU user targets enabled? Something like:

```
app-emulation/qemu QEMU_USER_TARGETS: *
```
Comment 19 yongxiang 2024-11-02 16:59:37 UTC
Created attachment 907700 [details]
build.log with enable all qemu user targets
Comment 20 Eric Joldasov 2024-11-02 23:17:58 UTC
Created attachment 907737 [details]
build.log after patch (successful)
Comment 21 Eric Joldasov 2024-11-02 23:19:17 UTC
(In reply to yongxiang from comment #19)
> Created attachment 907700 [details]
> build.log with enable all qemu user targets

Can't reproduce, tests pass locally for me with patch. Can you share "emerge --info qemu"?
Comment 22 yongxiang 2024-11-03 05:23:25 UTC
Created attachment 907742 [details]
emerge --info
Comment 23 Larry the Git Cow gentoo-dev 2024-11-06 13:35:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4a5c79c896bde3dbf6fe3618fd86f68c003577a

commit f4a5c79c896bde3dbf6fe3618fd86f68c003577a
Author:     Eric Joldasov <bratishkaerik@landless-city.net>
AuthorDate: 2024-11-03 00:08:53 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-11-06 13:35:14 +0000

    dev-lang/zig: fix building 0.13.0 with `sys-devel/llvm-18.1.8-r6`
    
    Also, while we are here, sync `.maxrss` fix from 9999 ebuild .
    Patch message:
    
    This is backported PR https://www.github.com/ziglang/zig/pull/21862 ,
    squashed and trimmed down for Zig 0.13.0 . Fixes following error when
    compiling with sys-devel/llvm-18.1.8-r6:
    ```
    /var/tmp/portage/dev-lang/zig-0.13.0/work/zig-0.13.0/src/zig_llvm.cpp:738:68: error: static assertion failed
      738 | static_assert((Triple::EnvironmentType)ZigLLVM_LastEnvironmentType == Triple::LastEnvironmentType, "");
    ```
    
    Chronology as I understood it:
     * New enum tags were added for `Triple::EnvironmentType` to 20.x in
       https://www.github.com/llvm/llvm-project/pull/111302 ,
     * These additions were backported to 19.1.3 in
       https://www.github.com/llvm/llvm-project/pull/112364 , at this point
       Zig upstream (9999) notices static assert failure and fixes in
       https://www.github.com/ziglang/zig/pull/21862 .
       Discussed here:
       https://www.github.com/llvm/llvm-project/pull/112364#discussion_r1823206017 .
     * These additions were backported again to 18.1.8-r6 (Gentoo only) in
       https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9455b76daa769c03686d18098dbf37690c5c5f61 ,
       this time it causes static assert failure for 0.13.0 .
    
    Closes: https://bugs.gentoo.org/942563
    Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
    Closes: https://github.com/gentoo/gentoo/pull/39187
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/zig/Manifest                                    |  1 +
 dev-lang/zig/{zig-0.13.0.ebuild => zig-0.13.0-r1.ebuild} | 14 ++++++++++++++
 2 files changed, 15 insertions(+)