Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile go project with cgo #52706

Closed
Chiiruno opened this issue Dec 22, 2018 · 8 comments
Closed

Can't compile go project with cgo #52706

Chiiruno opened this issue Dec 22, 2018 · 8 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@Chiiruno
Copy link
Contributor

Issue description

go get runtime/cgo: open /nix/store/yh6p6ky7w2nfa64r3r7vhr5d5s1p87bk-go-1.11.2/share/go/pkg/linux_amd64/runtime/cgo.a: read-only file system

Steps to reproduce

Install Go
Attempt to compile project that requires cgo. (Not with nix. just regularly)

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.18.0, NixOS, 19.03pre162671.44b02b52ea6 (Koi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.1.3
  • channels(root): "nixos-19.03pre162671.44b02b52ea6, nixpkgs-19.03pre155263.20c4986c4dd"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
@Chiiruno
Copy link
Contributor Author

Chiiruno commented Jan 1, 2019

CC @cstrahan @orivej @velovix @Mic92

@orivej
Copy link
Contributor

orivej commented Jan 2, 2019

I don't know the scope of the issue (I don't remember having encountered it) and whether we can/should fix it, but you can probably work around it by running go build or go install with -pkgdir /tmp (or any other writable directory).

@Mic92
Copy link
Member

Mic92 commented Jan 2, 2019

The same file already exists, so I don' know why tries to recompile it. Usually this happens when build systems are injecting -i into go builds.

@Mic92
Copy link
Member

Mic92 commented Jan 2, 2019

Also tracked here: golang/go#24674

@Mic92
Copy link
Member

Mic92 commented Jan 2, 2019

$ go list -f '{{.Stale}}' runtime/cgo
true
$ go list -f '{{.StaleReason}}' runtime/cgo
not installed but available in build cache

@Mic92
Copy link
Member

Mic92 commented Jan 2, 2019

It seems that there is not much we can do about that but stop using -i in go, which is not useful anymore anyway: golang/go#24674 (comment)

@stale
Copy link

stale bot commented Jun 3, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2020
@Mic92 Mic92 closed this as completed Jun 3, 2020
This was referenced Sep 24, 2020
@MasseGuillaume
Copy link
Contributor

The solution is to run go in a nix-shell: https://nixos.wiki/wiki/Go#Using_cgo_on_NixOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

4 participants