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
os/user: building fails on Solaris 11.3 #14967
Comments
CC @zombiezen |
Solaris does not seem to follow the POSIX spec. Seems like overkill to me to have to have a Solaris-specific file just to make an int cast, but I don't see another way. @ianlancetaylor thoughts? |
According to the Solaris man page (https://docs.oracle.com/cd/E19455-01/806-0627/6j9vhfmt1/index.html) you can get the POSIX version by using |
Odd. |
CL https://golang.org/cl/21385 mentions this issue. |
You're missing something; Solaris does provide the POSIX-compliant definition if the right defines are set. Let me find the right combination for you. |
So, the issue is that the Solaris grp.h header checks to see if the current compilers supports symbol renaming and if so, uses that:
Refer to: Both gcc and Solaris Studio support this extension, and presumably, clang/llvm does as well.
So Go appears to be looking at the wrong symbol; it should be looking at __posix_getgrnam_r, but is looking at getgrnam_r instead. The following should workaround Go's lack of support for the symbol rename:
|
I can confirm that this patch from @binarycrusader does resolve the issue on my end.
|
@binarycrusader Would you like to submit a CL with this change? If not I can do it for you. |
I think we should just add mygetgrnam_r to os/user/lookup_unix.go, just as we do for the other functions. I do not think we should define the |
No opinion on supporting the symbol renaming? Regardlees, either approach works. |
Forgot to add, just wanted to be clear that bug summary and the putback should reflect actual issue correctly. Solaris provides posix compliant interfaces here, so whatever fix is applied please be accurate about cause to make sure right fix is applied in the future if this happens again. |
The cgo command does not contain a C parser. Instead, it passes code to the C compiler and sees what happens. The C compiler does support the symbol renaming. My guess is that the symbol renaming is not expressed in the debug info where the cgo command would look for it. If it is there, then, yes, we should teach cgo about that. |
Let's go the mygetgrnam_r route for now. |
I've checked, gcc doesn't include any of this in the dwarf output -- only the pre-processor output. The Solaris Studio compilers do include references to the symbols in their dwarf output. I did a search through the Solaris headers to see how many things use symbol renaming, and it's more than a few -- (262 instances), so we should probably open a separate bug and add support for this somehow. The mygetgrnam_r route will work for the moment for this particular case. The symbol renaming is used to guarantee backwards compatibility for older source code and older programs. |
If we're okay with the |
go version
)?go version devel +ba333a3 Fri Mar 25 01:09:28 2016 +0000 solaris/amd64
go env
)?SunOS solaris 5.11 11.3 i86pc i386 i86pc
GCC:
Bootstrapping with Go 1.4.3
The text was updated successfully, but these errors were encountered: