oto
oto copied to clipboard
Error: function 'setresgid' is invalid in C99
Hey, I use lib github.com/faiface/beep and I get error when I compile linux env from mac os.
This is my command:
env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -v
And return error :
runtime/cgo
# runtime/cgo
linux_syscall.c:67:13: error: implicit declaration of function 'setresgid' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
linux_syscall.c:67:13: note: did you mean 'setregid'?
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:593:6: note: 'setregid' declared here
linux_syscall.c:73:13: error: implicit declaration of function 'setresuid' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
linux_syscall.c:73:13: note: did you mean 'setreuid'?
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:595:6: note: 'setreuid' declared here
Thank you for your help.
I try new solution with set CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++
but before execute this must install
brew install FiloSottile/musl-cross/musl-cross
Then I try exceute
env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ go build -v
And get error :
github.com/hajimehoshi/oto
# pkg-config --cflags -- alsa
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
No package 'alsa' found
pkg-config: exit status 1
Any solution?
~What about CGO_CFLAGS=-std=gnu99
?~
What about the latest Go 1.17?
I have the same error.
Main differences:
- go version go1.17.4 darwin/amd64
- I'm using lib "github.com/miekg/pkcs11", not "github.com/faiface/beep".
- not using FiloSottile/musl-cross/musl-cross. I'm trying to avoid more variables to the issue.
Any ideas how to solve this?
If you encountered the error of alsa, have you installed alsa?
disable CGO_ENABLED=0 may help but not fixed
@hajimehoshi , No, I have not installed alsa. What is that? Would installing/uninstalling that help?
@aoxn Do you meant to set CGO_ENABLED=0 always? The projects I'm working on are using pkcs11 library, it requires CGO_ENABLED=1 during compilation.
No, I have not installed alsa. What is that? Would installing/uninstalling that help?
This is a dependency for Oto. Please install it.
@ramacatur Same problem, Could you find any ways to resolve the issue?