在引入 clang-unwrapped 情况下,go运行错误 #37

Closed
opened 2025-12-29 04:20:57 +01:00 by adam · 5 comments
Owner

Originally created by @shelken on GitHub (Apr 18, 2024).

虽然我跟您的配置不完全一致,但是在只引入该包的情况下,在我的电脑上(darwin),直接运行 go run . 发现以下错误:

# runtime/cgo
cgo-builtin-prolog:1:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
1 error generated

去掉就正常了。不知道你是否能复现?

Originally created by @shelken on GitHub (Apr 18, 2024). - 本项目 https://github.com/ryan4yin/nix-config/blob/21d85d41efed3bd6f1640efdf6f6d6f8ae5d8af2/home/base/tui/editors/packages.nix#L18 - 我的配置 https://github.com/shelken/nix-config/blob/c6269a6919fc378ed4854fa72b4da1b2ddbbf0b8/home/apps/neovim/packages.nix#L7 虽然我跟您的配置不完全一致,但是在只引入该包的情况下,在我的电脑上(darwin),直接运行 `go run .` 发现以下错误: ```log # runtime/cgo cgo-builtin-prolog:1:10: fatal error: 'stddef.h' file not found #include <stddef.h> ^~~~~~~~~~ 1 error generated ``` 去掉就正常了。不知道你是否能复现?
adam closed this issue 2025-12-29 04:20:58 +01:00
Author
Owner

@ryan4yin commented on GitHub (Apr 18, 2024):

+1 成功复现...

@ryan4yin commented on GitHub (Apr 18, 2024): +1 成功复现...
Author
Owner

@ryan4yin commented on GitHub (Apr 18, 2024):

有可能是 unstable 的 clang 有不兼容变更,然后我 darwin 用的是 nixpkgs-23.11-darwin 不是 unstable 从而导致问题。
但 unstable + darwin 坏掉的东西太多了,只能先注释掉,然后等 24.05 发布后再试试了

@ryan4yin commented on GitHub (Apr 18, 2024): 有可能是 unstable 的 clang 有不兼容变更,然后我 darwin 用的是 nixpkgs-23.11-darwin 不是 unstable 从而导致问题。 但 unstable + darwin 坏掉的东西太多了,只能先注释掉,然后等 24.05 发布后再试试了
Author
Owner

@imxyy1soope1 commented on GitHub (Apr 26, 2024):

大概是因为llvmPackages.clang-unwrapped,并且clang-unwrapped把原本的cc覆盖掉了,导致编译时找不到include path,可以换用clang-tools

@imxyy1soope1 commented on GitHub (Apr 26, 2024): 大概是因为`llvmPackages.clang-unwrapped`,并且`clang-unwrapped`把原本的cc覆盖掉了,导致编译时找不到include path,可以换用`clang-tools`
Author
Owner

@ryan4yin commented on GitHub (Apr 28, 2024):

@imxyy1soope1 嗯应该是这样

@ryan4yin commented on GitHub (Apr 28, 2024): @imxyy1soope1 嗯应该是这样
Author
Owner

@ryan4yin commented on GitHub (Jun 3, 2024):

升级到 24.05 后问题仍旧存在,已经根据 @imxyy1soope1 的建议做了修改。

@ryan4yin commented on GitHub (Jun 3, 2024): 升级到 24.05 后问题仍旧存在,已经根据 @imxyy1soope1 的建议做了修改。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/nix-config-ryan4yin#37