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

undefined reference to `github.com/segmentio/asm/cpu.X86' #81

Open
mettledrum opened this issue Dec 7, 2022 · 2 comments
Open

undefined reference to `github.com/segmentio/asm/cpu.X86' #81

mettledrum opened this issue Dec 7, 2022 · 2 comments

Comments

@mettledrum
Copy link

mettledrum commented Dec 7, 2022

When segmentio/asm v1.2.0 is vendored into a module, building a Docker image fails.

build layer in Dockerfile:

RUN CGO_ENABLED=1 GO111MODULE=off go install /cmd/main.go

error logs:

[2022-12-06 16:56:34]  INFO docker build: #10 37.51 # github.com/segmentio/<REPO>/cmd/<BINARY>
  | [2022-12-06 16:56:34]  INFO docker build: #10 37.51 /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
  | [2022-12-06 16:56:34]  INFO docker build: #10 37.51 /usr/bin/ld: /tmp/go-link-506352844/go.o: in function `github.com/segmentio/<REPO>/vendor/github.com/segmentio/asm/bswap.swap64.abi0':
  | [2022-12-06 16:56:34]  INFO docker build: #10 37.51 /go/src/github.com/segmentio/<REPO>/vendor/github.com/segmentio/asm/bswap/swap64_amd64.s:14: undefined reference to `github.com/segmentio/asm/cpu.X86'
  | [2022-12-06 16:56:34]  INFO docker build: #10 37.51 collect2: error: ld returned 1 exit status
  | [2022-12-06 16:56:34]  INFO docker build: #10 37.51
  | [2022-12-06 16:56:35]  INFO docker build: #10 37.83 # github.com/segmentio/<REPO>/cmd/<BINARY>
  | [2022-12-06 16:56:35]  INFO docker build: #10 37.83 /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
  | [2022-12-06 16:56:35]  INFO docker build: #10 37.83 /usr/bin/ld: /tmp/go-link-65482911/go.o: in function `github.com/segmentio/<REPO>/vendor/github.com/segmentio/asm/bswap.swap64.abi0':
  | [2022-12-06 16:56:35]  INFO docker build: #10 37.83 /go/src/github.com/segmentio/<REPO>/vendor/github.com/segmentio/asm/bswap/swap64_amd64.s:14: undefined reference to `github.com/segmentio/asm/cpu.X86'
  | [2022-12-06 16:56:35]  INFO docker build: #10 37.83 collect2: error: ld returned 1 exit status
  | [2022-12-06 16:56:35]  INFO docker build: #10 37.83

It seems like this is the line of code within segmentio/asm that's missing a reference but I'm unsure how to fix this.

@achille-roussel
Copy link
Contributor

Hello @mettledrum, thanks for reporting!

This looks like a duplicate of #73 maybe? TLDR this might be caused by GO111MODULE=off.

@mettledrum
Copy link
Author

yes, taking out GO111MODULE=off avoided the error, thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants