• Bug#1105021: gitlab-shell: undefined errors on github.com/tklauser/go-s

    From zhangdandan@21:1/5 to All on Sat May 10 05:30:01 2025
    This is a multi-part message in MIME format.
    Source: gitlab-shell
    Version: 14.35.0+ds1-2
    Severity: normal
    Tags: patch
    User: debian-loongarch@lists.debian.org
    Usertags: loong64

    Dear maintainers,

    Compiling the gitlab-shell failed for loong64 in the Debian Package Auto-Building environment.
    The error log is as follows,
    ```
    #
    gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:20:10:
    undefined: _BC_BASE_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:22:10:
    undefined: _BC_DIM_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:24:10:
    undefined: _BC_SCALE_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:26:10:
    undefined: _BC_STRING_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:28:10:
    undefined: _COLL_WEIGHTS_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:30:10:
    undefined: _EXPR_NEST_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:32:10:
    undefined: _HOST_NAME_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:34:10:
    undefined: _LINE_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:36:10:
    undefined: _LOGIN_NAME_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:40:10:
    undefined: _RE_DUP_MAX src/gitlab.com/gitlab-org/gitlab-shell/v14/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go:40:10:
    too many errors
    ```
    The full build log can be found at https://buildd.debian.org/status/fetch.php?pkg=gitlab-shell&arch=loong64&ver=14.35.0%2Bds1-2&stamp=1742468622&raw=0.

    After analyzing, I found that go.mod is ignored and only use system file. Consistent build phenomena for gitlab and gitlab-shell.

    Please consider the patch I attached.
    - For gitlab-shell(attached patch gitlab-shell-update-go.mod.patch)
    optional: need to update github.com/tklauser/go-sysconf's version in
    go.mod and go.sum.
    loong64 was supported in release https://github.com/tklauser/go-sysconf/blob/v0.3.15.

    - For gitaly(attached patch gitaly-update-tklauser-go-sysconf-for-loong64.patch)
    use vendor in gitaly source package.
    github.com/tklauser/go-sysconf v0.3.10 is too old which do not support
    loong64.
    need to add loong64 support(vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go) to verdor directory in gitaly source package. Or update upstream for gitaly.

    Based on my local gitlay(re-install golang-gitlab-gitlab-org-gitaly-dev
    with loong64 support in my system), gitlab-shell was built successfully
    on locally.

    All in all, please add loong64 support in gitaly first(use upstream
    v0.3.15 or add extra patch).
    Then, please consider regenerating go.mod and go.sum for gitaly and gitlab-shell source package.
    Your opinions are welcome.

    Best regards,
    Dandan Zhang


    Description: Add loongarch64 support
    .
    gitaly (16.11.6+ds1-4+loong64) unstable; urgency=medium
    .
    * Add loongarch64(go arch is loong64) support.
    Author: Dandan Zhang <zhangdandan@loongson.cn>

    ---
    Last-Update: 2025-05-08

    --- gitaly-16.11.6+ds1.orig/go.mod
    +++ gitaly-16.11.6+ds1/go.mod
    @@ -1,6 +1,8 @@
    module gitlab.com/gitlab-org/gitaly/v16

    -go 1.21
    +go 1.23.0
    +
    +toolchain go1.24.1

    // It is a temporary solution, please see https://gitlab.com/gitlab-org/gitaly/-/issues/4423 for details.
    replace github.com/go-enry/go-license-detector/v4 => github.com/gl-gitaly/go-license-detector/v4 v4.0.0-20230524080836-4cc9a3796917
    @@ -43,7 +45,7 @@ require (
    golang.org/x/crypto v0.22.0
    golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
    golang.org/x/sync v0.6.0
    - golang.org/x/sys v0.19.0
    + golang.org/x/sys v0.33.0
    golang.org/x/text v0.14.0
    golang.org/x/time v0.5.0
    google.golang.org/genproto/googleapis/rpc v0.0.0-20240311173647-c811ad7063a7
    @@ -181,8 +183,8 @@ require (
    github.com/skeema/knownhosts v1.2.1 // indirect
    github.com/ssgelm/cookiejarparser v1.0.1 // indirect
    github.com/tinylib/msgp v1.1.2 // indirect
    - github.com/tklauser/go-sysconf v0.3.9 // indirect
    -