ryan4yin / nix-config

❄️ My nix config for both desktops(NixOS+macOS) and homelab servers(NixOS).
https://nixos-and-flakes.thiscute.world
MIT License
863 stars 52 forks source link

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

Closed shelken closed 3 months ago

shelken commented 4 months ago

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

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

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

ryan4yin commented 4 months ago

+1 成功复现...

ryan4yin commented 4 months ago

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

imxyy1soope1 commented 4 months ago

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

ryan4yin commented 4 months ago

@imxyy1soope1 嗯应该是这样

ryan4yin commented 3 months ago

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