Uploaded image for project: 'Funtoo Linux'
  1. Funtoo Linux
  2. FL-9645

sys-fs/ncdu failed build zig not recognise QEMU pentium-m cpu

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None

      >>> Emerging (1 of 2) sys-fs/ncdu-2.1::core-kit
       * Fetching files in the background.
       * To view fetch progress, run in another terminal:
       * tail -f /var/log/emerge-fetch.log
       * ncdu-2.1.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                        [ ok ]
      >>> Unpacking source...
      >>> Unpacking ncdu-2.1.tar.gz to /var/tmp/portage/sys-fs/ncdu-2.1/work
      >>> Source unpacked in /var/tmp/portage/sys-fs/ncdu-2.1/work
      >>> Preparing source in /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1 ...
      >>> Source prepared.
      >>> Configuring source in /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1 ...
      >>> Source configured.
      >>> Compiling source in /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1 ...
      make -j1
      zig build -Drelease-fast
      error(compilation): clang failed with stderr: error: unknown target CPU 'pentium-m'
      note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
      
      ./src/main.zig:13:11: error: C import failed
      const c = @cImport(@cInclude("locale.h"));
                ^
      ncdu...The following command exited with error code 1:
      /opt/zig-bin-0.9.1/zig build-exe /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1/src/main.zig /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1/src/ncurses_refs.c -lc -lncursesw -OReleaseFast --cache-dir /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1/zig-cache --global-cache-dir /var/tmp/portage/sys-fs/ncdu-2.1/homedir/.cache/zig --name ncdu -I /usr/include/ncursesw -D _DEFAULT_SOURCE -D _XOPEN_SOURCE=600 --enable-cache
      error: the following build command failed with exit code 1:
      /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1/zig-cache/o/6e5d94ef3890ea346f6a4d9e442e7c9d/build /opt/zig-bin-0.9.1/zig /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1 /var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1/zig-cache /var/tmp/portage/sys-fs/ncdu-2.1/homedir/.cache/zig -Drelease-fast
      make: *** [Makefile:15: release] Error 1
       * ERROR: sys-fs/ncdu-2.1::core-kit failed (compile phase):
       *   emake failed
       *
       * If you need support, post the output of `emerge --info '=sys-fs/ncdu-2.1::core-kit'`,
       * the complete build log and the output of `emerge -pqv '=sys-fs/ncdu-2.1::core-kit'`.
       * The complete build log is located at '/var/tmp/portage/sys-fs/ncdu-2.1/temp/build.log'.
       * The ebuild environment file is located at '/var/tmp/portage/sys-fs/ncdu-2.1/temp/environment'.
       * Working directory: '/var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1'
       * S: '/var/tmp/portage/sys-fs/ncdu-2.1/work/ncdu-2.1'
      
      

      and

      /proc/cpuinfo

      processor       : 0
      vendor_id       : GenuineIntel
      cpu family      : 6
      model           : 13
      model name      : QEMU Virtual CPU version 2.5+
      stepping        : 3
      microcode       : 0x1
      cpu MHz         : 0.000
      cache size      : 16384 KB
      physical id     : 0
      siblings        : 1
      core id         : 0
      cpu cores       : 1
      apicid          : 0
      initial apicid  : 0
      fpu             : yes
      fpu_exception   : yes
      cpuid level     : 13
      wp              : yes
      flags           : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl xtopology cpuid pni cx16 x2apic hypervisor lahf_lm pti
      bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf
      bogomips        : 4338.48
      clflush size    : 64
      cache_alignment : 64
      address sizes   : 46 bits physical, 48 bits virtual
      power management:
      

      And it quotes the ncdu author's answer

      
      
      Zig not being to autodetect a proper CPU setting would be a bug in Zig, I don't think it makes sense for me to implement workarounds for that.
      
      What you can do is manually add a -Dcpu=... flag to the zig build command (which the Makefile exposes as ZIG_FLAGS), both Homebrew and Arch do this in their packages to ensure the generated binary is portable across different CPUs.
      
      

      The easiest way to fix this is in the ebuild, but I don't know if it should be implemented on the zig side.

      I think I will try to report a bug in ziglang on a separate path, but taking into account how many open reports there are, I would not count on any reaction.

            seemant seemant
            tczaude tczaude
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: