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

cmd/cgo: env CGO_LDFLAGS not working but config #cgo LDFLAGS works #33520

Closed
apptut opened this issue Aug 7, 2019 · 2 comments
Closed

cmd/cgo: env CGO_LDFLAGS not working but config #cgo LDFLAGS works #33520

apptut opened this issue Aug 7, 2019 · 2 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@apptut
Copy link

apptut commented Aug 7, 2019

Hi, When build go code with some c .so file code in go 1.11+ modules, I config the directives in cgo file like this:

// #cgo LDFLAGS: -L/abc/dir -lfoo

That's build successfull, but when I remove this line and then config env var CGO_LDFLAGS when build, it not working:

CGO_LDFLAGS="-L/abd/dir -lfoo" go build main.go
# or
export CGO_LDFLAGS="-L/abd/dir -lfoo" go build main.go
go build main.go

both above are failed find the c so inner func method, why. Anybody can help me?

@ianlancetaylor
Copy link
Contributor

Please show us your Go environment as requested by the issue template.

Please show us exactly what happens in the case that fails.

Are you running go build main.go in both cases?

@odeke-em odeke-em changed the title build with c with env CGO_LDFLAGS not working but config #cgo LDFLAGS work cmd/cgo: env CGO_LDFLAGS not working but config #cgo LDFLAGS works Aug 10, 2019
@odeke-em odeke-em added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 10, 2019
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Sep 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants