oto icon indicating copy to clipboard operation
oto copied to clipboard

Error: function 'setresgid' is invalid in C99

Open ramacatur opened this issue 3 years ago • 8 comments

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.

ramacatur avatar Jun 25 '21 11:06 ramacatur

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?

ramacatur avatar Jun 25 '21 12:06 ramacatur

~What about CGO_CFLAGS=-std=gnu99?~

What about the latest Go 1.17?

hajimehoshi avatar Aug 21 '21 17:08 hajimehoshi

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?

cryptojerp avatar Dec 07 '21 00:12 cryptojerp

If you encountered the error of alsa, have you installed alsa?

hajimehoshi avatar Dec 07 '21 03:12 hajimehoshi

disable CGO_ENABLED=0 may help but not fixed

aoxn avatar Mar 09 '22 14:03 aoxn

@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.

cryptojerp avatar Mar 09 '22 14:03 cryptojerp

No, I have not installed alsa. What is that? Would installing/uninstalling that help?

This is a dependency for Oto. Please install it.

hajimehoshi avatar Mar 09 '22 14:03 hajimehoshi

@ramacatur Same problem, Could you find any ways to resolve the issue?

MohsenSajadi avatar Apr 19 '22 16:04 MohsenSajadi