Closed smadurange closed 4 years ago
This is telling you that pkg-config
is passing in flags the linker doesn't understand. This is likely something specific to Arch or how the package was installed.
I don't know enough to help you diagnose but I can say that -O1
seems misplaced as that's an optimization flag and should probably be emitted from --cflags
, not --libs
. I don't know what the -z
related flags are.
I think I have a similar problem, when I run this under an Ubuntu-based distro (20.04, Regolith) I get:
❯ go get github.com/rthornton128/goncurses
go build github.com/rthornton128/goncurses: invalid flag in pkg-config --libs: -Wl,-Bsymbolic-functions
@amireldor
If yo do the following settings, the problem may be solved.
$ export CGO_LDFLAGS_ALLOW="-Wl,-Bsymbolic-functions"
$ go get github.com/rthornton128/goncurses
The following is the reference URL. https://github.com/golang/go/wiki/InvalidFlag
@n-hachi Doesn't work for me.
Like op, I'm running Linux archlinux 5.8.14-arch1-1 #1 SMP PREEMPT Wed, 07 Oct 2020 23:59:46 +0000 x86_64 GNU/Linux
Thanks for any help in advance.
Further to what @n-hachi suggested, the "fix" is the *_ALLOW family of environment variables. See #55 for more details. Potentially, if it were to work, the #cgo
directives might be used to allow the flags (though I suspect this won't work) but I'm reluctant to do that, as every package uses different flags and I'm reluctant to open it up to everything.
If you don't want to dive into the depths of CGO compilation and that stuff here's a quick and insecure "workaround" using the fix mentioned above:
export CGO_CFLAGS_ALLOW=".*"
export CGO_LDFLAGS_ALLOW=".*"
go get github.com/rthornton128/goncurses
export CGO_CFLAGS_ALLOW=
export CGO_LDFLAGS_ALLOW=
It is important to reset the allowed flags again for security reasons.
When I run
go get github.com/rthornton128/goncurses
, I getgo build github.com/rthornton128/goncurses: invalid flag in pkg-config --libs: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
I'm on Arch Linux.