open-im-server icon indicating copy to clipboard operation
open-im-server copied to clipboard

我用macos编译出错了,error: implicit declaration of function 'setresgid' is invalid in C99

Open lixiaozhong opened this issue 2 years ago • 2 comments

环境 macos 10.15.7, idea 2021.3

build sdk报错了,大佬帮忙看看吧: Current directory: /Users/lixiaozhong/dev/gopath/src/Open-IM-Server/cmd/Open-IM-SDK-Core make build CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ws_wrapper/cmd/open_im_sdk_server ws_wrapper/cmd/open_im_sdk_server.go

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'? /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.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'? /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:595:6: note: 'setreuid' declared here make[1]: *** [build] Error 2 make: *** [install] Error 2

lixiaozhong avatar Mar 30 '22 08:03 lixiaozhong

I meet the same question with you. Just resolved follow this: https://www.baifachuan.com/posts/4862a3b1.html

marsoyang1 avatar May 15 '22 14:05 marsoyang1

I meet the same question with you. Just resolved follow this: https://www.baifachuan.com/posts/4862a3b1.html

有用,修改后编译通过了

qq727127158 avatar Jul 17 '22 09:07 qq727127158

Linux is recommended

skiffer-git avatar Nov 24 '22 02:11 skiffer-git

我和你遇到同样的问题。刚刚解决了这个:https ://www.baifachuan.com/posts/4862a3b1.html

有用,修改后编译通过了

你们到底怎么修改的啊,大佬们

alun1 avatar Mar 11 '23 07:03 alun1

我和你遇到同样的问题。刚刚解决了这个:https ://www.baifachuan.com/posts/4862a3b1.html

有用,修改后编译通过了

你们到底怎么修改的啊,大佬们

怎么修改啊?

hhxiaohei avatar Mar 15 '23 01:03 hhxiaohei

  1. Install musl-cross brew install FiloSottile/musl-cross/musl-cross

  2. Set build parameters CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ ./batch_build_all_service.sh

tlifeng avatar May 16 '23 09:05 tlifeng