-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: error: pointer is missing a nullability type specifier when building on catalina #35247
Comments
Has clang really decided to enable the |
Note that these warnings are for /usr/local/include/stdlib.h, which does not come from Go. Is that the version of stdlib.h that corresponds to the C compiler that you are using? |
@ianlancetaylor I cannot really tell. I just did an upgrade to catalina and installed golang. So when I try to build I got the error. During the installation I did not get any errors that could have given a hint. |
Unless someone else is seeing this problem on catalina, I suspect this is a problem with the installation on your system. |
Sorry, I mean a problem with the XCode installation. I don't see a reason to think that there is anything wrong with the Go installation. |
Had the same problem. Upgraded to catalina and this appears: # runtime/cgo
In file included from _cgo_export.c:3:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:134:25: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
... Also tried using clang to compile some random source including ❯ clang a.c
In file included from a.c:1:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:134:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
double atof(const char *);
... |
I also have same problem after upgrade to catalina
Maybe it can be solved |
I don't understand how XCode could possibly be shipping a <stdlib.h> that cannot be compiled without warnings in the default compiler setting. Can somebody investigate that? What happens if you simply compile the C program #include <stdlib.h> ? Do you get warnings? |
Encounter same issue |
@yiyanwannian Please see my question in #35247 (comment) which has not yet been answered. Thanks. |
@ianlancetaylor Please see my comment above. And here's the content of #include <stdlib.h>
int main() {
return 0;
} It has the same problem when being compiled, however those were only warnings. When in cgo, those became errors. |
I'm sorry, somehow I missed that comment. If clang is emitting a lot of warnings for code that simply includes <stdlib.h>, I can't help but feel that that is a problem with the installation. I see this issue raised for C code on Stack Overflow at https://stackoverflow.com/questions/58429844/c-multiple-warnings-pointer-is-missing-a-nullability-type-specifier-when-com . This just seems to me like something that Apple has to fix. In the meantime see if https://golang.org/cl/205457 fixes the problems. |
A Catalina builder would've caught this (#34748). |
Change https://golang.org/cl/205457 mentions this issue: |
For what it's worth I don't see the issue with XCode 11.3 on Mojave using system's clang, but do get it if I use my clang built from source. |
you saved my day, thanks :) |
I just upgraded to Catalina and also had issues with clang throwing warnings. Turns out this was caused by having installed clang via homebrew. So perhaps https://go-review.googlesource.com/c/go/+/205457/ is only needed to support users who have installed their own version of clang? |
I'm facing the same issue 😞 |
@matiasinsaurralde this issue is closed. If the problem occurs for you with the latest version of Go please open a new issue including all the information someone who does not have access to your environment will need to reproduce the problem. |
Change https://golang.org/cl/368634 mentions this issue: |
The Clang documentation for From the doc comment for the actual implementation in the compiler, the warning enabled by the flag actually:
So this is indeed a configuration problem, caused by mixing a That seems to jibe with the theory in #35247 (comment) that this may be caused by mixing a Homebrew |
As as interesting data point, CL 368634 removes the |
CL 205457 added the flag -Wno-nullability-completeness to work around a user-reported build breakage on macOS Catalina. However, according to https://golang.org/issue/35247#issuecomment-589115489 the root cause of the breakage may be a toolchain misconfiguration on the host (perhaps compiling the XCode stdlib using a Homebrew build of the "clang" compiler?). Adding an obscure warning flag to enable building stdlib.h with an otherwise-broken toolchain seems clearly inappropriate to me. If need be we can instead provide guidance to users on how to unbreak their toolchain. Updates #35247 Fixes #49913 Change-Id: I84def34e101bed7911d8d78a991a29095b8791fa Reviewed-on: https://go-review.googlesource.com/c/go/+/368634 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go test -mod=vendor
What did you expect to see?
At least the test should run
What did you see instead?
runtime/cgo
In file included from _cgo_export.c:3:
/usr/local/include/stdlib.h:134:25: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:134:25: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:134:25: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:135:22: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:135:22: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:135:22: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:136:23: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:136:23: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:136:23: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:139:20: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:139:20: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:139:20: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:141:26: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:141:26: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:141:26: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:141:45: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:141:45: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:141:45: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:142:59: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:142:59: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:142:59: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:142:73: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:142:73: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:142:73: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:141:6: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:141:6: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:141:6: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:147:25: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:147:25: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:147:25: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:147:6: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:147:6: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:147:6: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:156:23: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:156:23: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:156:23: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:157:26: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:157:26: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:157:26: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:157:52: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:157:52: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:157:52: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:158:21: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:158:21: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:158:21: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:158:46: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:158:46: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:158:46: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:160:18: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:160:18: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:160:18: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:161:43: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:161:43: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:161:43: note: insert '_Nonnull' if the pointer should never be null
/usr/local/include/stdlib.h:161:57: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/usr/local/include/stdlib.h:161:57: note: insert '_Nullable' if the pointer may be null
/usr/local/include/stdlib.h:161:57: note: insert '_Nonnull' if the pointer should never be null
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Compilation finished with exit code 2
The text was updated successfully, but these errors were encountered: