GCC compilation fails with "undefined Symbols"

未关闭
#2,637 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
go
领域
build-system, cli

调研方向

Start by examining the package installation path in internal/devpkg/package.go and the Nix build invocation in internal/nix/build.go; the logs show devbox add gcc reaches a failing GCC 15 build on Apple Silicon. Reproduce with the reported devbox and Nix versions, then inspect the full derivation log with nix log to understand the undefined symbols. Done means GCC installs successfully on macOS Apple Silicon without breaking other package installations.

由索引模型根据 Issue 内容生成。

描述

bug triage
What happened?

I tried to add gcc to devbox, but devbox add gcc failed

Steps to reproduce
  1. devbox init
  2. devbox add gcc
Command

add

devbox.json
{
    "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
    "packages": [],
    "shell": {
      "init_hook": [
        "echo 'Welcome to devbox!' > /dev/null"
      ],
      "scripts": {
        "test": [
          "echo \"Error: no test specified\" && exit 1"
        ]
      }
    }
  }
}
Devbox version

0.14.2

Nix version

nix (Nix) 2.23.3

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

~/tmp/rust_compile % DEVBOX_DEBUG=1 devbox add gcc
time=2025-06-29T21:07:23.024+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:126 msg="searching for config file (including parent directories)" path=.
time=2025-06-29T21:07:23.024+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:147 msg="trying config file" path=devbox.json
time=2025-06-29T21:07:23.024+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:134 msg="config file found" path=/Users/add_gcc/devbox.json dur=203.083µs
time=2025-06-29T21:07:23.025+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:126 msg="searching for config file (including parent directories)" path=.
time=2025-06-29T21:07:23.025+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:147 msg="trying config file" path=devbox.json
time=2025-06-29T21:07:23.025+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:134 msg="config file found" path=/Users/add_gcc/devbox.json dur=52.542µs
time=2025-06-29T21:07:23.042+02:00 level=DEBUG source=go.jetify.com/devbox/nix/nix.go:143 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' --version --debug"
time=2025-06-29T21:07:23.084+02:00 level=DEBUG source=go.jetify.com/devbox/nix/nix.go:143 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' --version --debug" cmd.path=/nix/var/nix/profiles/default/bin/nix cmd.pid=23877 cmd.code=0 cmd.dur=42.127458ms
time=2025-06-29T21:07:23.084+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:126 msg="searching for config file (including parent directories)" path=.
time=2025-06-29T21:07:23.084+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:147 msg="trying config file" path=devbox.json
time=2025-06-29T21:07:23.084+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:134 msg="config file found" path=/Users/add_gcc/devbox.json dur=111.25µs
time=2025-06-29T21:07:23.084+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devpkg/package.go:204 msg="package doesn't need patching" pkg=gcc mode=auto
time=2025-06-29T21:07:23.084+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devpkg/package.go:204 msg="package doesn't need patching" pkg=gcc mode=auto
time=2025-06-29T21:07:23.361+02:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/store.go:145 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' store info --store daemon --json"
time=2025-06-29T21:07:23.440+02:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/store.go:145 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' store info --store daemon --json" cmd.path=/nix/var/nix/profiles/default/bin/nix cmd.pid=23879 cmd.code=0 cmd.dur=79.555042ms
time=2025-06-29T21:07:23.440+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devbox/providers/nixcache/setup.go:86 msg="nixcache: running setup: first time setup"
Info: Adding package "gcc@latest" to devbox.json
time=2025-06-29T21:07:23.990+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devpkg/package.go:204 msg="package doesn't need patching" pkg=gcc mode=auto
time=2025-06-29T21:07:23.990+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devpkg/package.go:204 msg="package doesn't need patching" pkg=gcc mode=auto
time=2025-06-29T21:07:23.990+02:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/store.go:61 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' path-info --offline --json /nix/store/8r1ihidd9z6l6lzvryvg409vscr259ms-gcc-wrapper-15.1.0 /nix/store/ybihi6w1b23zm4674amci4a3h811sh95-gcc-wrapper-15.1.0-man"
time=2025-06-29T21:07:24.079+02:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/store.go:61 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' path-info --offline --json /nix/store/8r1ihidd9z6l6lzvryvg409vscr259ms-gcc-wrapper-15.1.0 /nix/store/ybihi6w1b23zm4674amci4a3h811sh95-gcc-wrapper-15.1.0-man" cmd.path=/nix/var/nix/profiles/default/bin/nix cmd.pid=23882 cmd.code=0 cmd.dur=88.671292ms
Info: Installing the following packages to the nix store: gcc@latest
time=2025-06-29T21:07:24.079+02:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/build.go:50 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' build --impure --no-link 'github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb#gcc15' 'github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb#gcc15'"
error: builder for '/nix/store/hz8mv9d8hvkjsazd5yh63a2dbj55jn16-gcc-15.1.0.drv' failed with exit code 2;
last 25 log lines:
> done
> Undefined symbols for architecture arm64:
> "___deregister_frame_info", referenced from:
> -reexported_symbols_list command line option
> "___deregister_frame_info_bases", referenced from:
> -reexported_symbols_list command line option
> "___register_frame_info", referenced from:
> -reexported_symbols_list command line option
> "___register_frame_info_bases", referenced from:
> -reexported_symbols_list command line option
> "___register_frame_info_table", referenced from:
> -reexported_symbols_list command line option
> "___register_frame_info_table_bases", referenced from:
> -reexported_symbols_list command line option
> "___register_frame_table", referenced from:
> -reexported_symbols_list command line option
> ld: symbol(s) not found for architecture arm64
> collect2: error: ld returned 1 exit status
> make[3]: *** [../../../gcc-15.1.0/libgcc/config/t-slibgcc-darwin:143: libgcc_s.1.dylib] Error 1
> make[3]: Leaving directory '/private/tmp/nix-build-gcc-15.1.0.drv-2/build/arm64-apple-darwin/libgcc'
> make[2]: *** [Makefile:17913: all-stage1-target-libgcc] Error 2
> make[2]: Leaving directory '/private/tmp/nix-build-gcc-15.1.0.drv-2/build'
> make[1]: *** [Makefile:23151: stage1-bubble] Error 2
> make[1]: Leaving directory '/private/tmp/nix-build-gcc-15.1.0.drv-2/build'
> make: *** [Makefile:23456: bootstrap] Error 2
For full logs, run 'nix log /nix/store/hz8mv9d8hvkjsazd5yh63a2dbj55jn16-gcc-15.1.0.drv'.
error: 1 dependencies of derivation '/nix/store/q5bdw4inzxr9pnb78b41rd8kr7gri12z-gcc-wrapper-15.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/q5bdw4inzxr9pnb78b41rd8kr7gri12z-gcc-wrapper-15.1.0.drv' failed to build
error: build of '/nix/store/q5bdw4inzxr9pnb78b41rd8kr7gri12z-gcc-wrapper-15.1.0.drv^man,out' failed
time=2025-06-29T21:12:33.882+02:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/build.go:50 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' build --impure --no-link 'github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb#gcc15' 'github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb#gcc15'" cmd.path=/nix/var/nix/profiles/default/bin/nix cmd.pid=23888 cmd.code=1 cmd.dur=5m9.803110833s

Error: There was an error installing nix packages
source: nix: command error: nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' build --impure --no-link 'github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb#gcc15' 'github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb#gcc15': exit code 1

time=2025-06-29T21:12:33.883+02:00 level=ERROR source=go.jetify.com/devbox/internal/boxcli/midcobra/debug.go:68 msg="command error" stderr="" execid=8ca2453be92844138f7e34c8cc2e4592 stack=
time=2025-06-29T21:12:33.884+02:00 level=ERROR source=go.jetify.com/devbox/internal/boxcli/midcobra/debug.go:70 msg="command error" execid=8ca2453be92844138f7e34c8cc2e4592 stack=
time=2025-06-29T21:12:33.884+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:126 msg="searching for config file (including parent directories)" path=.
time=2025-06-29T21:12:33.884+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:147 msg="trying config file" path=devbox.json
time=2025-06-29T21:12:33.885+02:00 level=DEBUG source=go.jetify.com/devbox/internal/devconfig/config.go:134 msg="config file found" path=/Users/add_gcc/devbox.json dur=886.292µs

主要语言
Go
星标
12.4k
派生
358
平均合并
17 小时 12 分钟
30 天内合并 PR
31

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jetify-com/devbox 的其他 Issue

查看 jetify-com/devbox 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。