mantil-io / mantil

Build your AWS Lambda-based Go backends quicker than ever
https://www.mantil.com
MIT License
109 stars 3 forks source link

Force CGO_ENABLED=0 env when cross-compiling project binaries #116

Closed djelusic closed 2 years ago

djelusic commented 2 years ago

While analyzing user logs we discovered an instance of builds failing with the following error:

# 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'?
/Library/Developer/CommandLineTools/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'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:595:6: note: 'setreuid' declared here

Full logs: 9a0cfd14-5344-418f-871d-660115756bd4.csv

We were able to reproduce this by explicitly setting CGO_ENABLED=1 when building project binaries so there is likely an override somewhere in the user's environment. We can fix this by always forcing CGO_ENABLED=0 in when mantil is building binaries.