limeidan
(limeidan)
November 2, 2020, 2:42am
1
Hi,
I need to compile docker which depends on golang/sys, but there is an argument s.Rdev that comes from golang/sys I must force converse it to uint64 otherwise the compilation can’t go on.
error information: “cannot use s.Rdev (type uint32) as type uint64 in field value”
I have read the part source code of golang/sys, found that argument defined as type uint32 in mips arch but uint64 in others. my machine is based on mips64 arch, so I want to know why it implemented as uint32 in mips.
mips64: https://github.com/golang/sys/blob/master/unix/ztypes_linux_mips64.go#L92
amd64: https://github.com/golang/sys/blob/master/unix/ztypes_linux_amd64.go#L92
Thanks, best regards.
petrus
(petrus)
November 2, 2020, 10:36am
2
On the mips64 platform for which you are compiling Docker, what is your output?
$ cat dev.c
#include <sys/stat.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("%lu\n", sizeof(dev_t));
struct stat s;
printf("%lu\n", sizeof(s.st_dev));
printf("%lu\n", sizeof(s.st_rdev));
}
$ gcc --version
$ gcc dev.c -o dev && ./dev
$
ncw
(Nick Craig-Wood)
November 2, 2020, 10:54am
3
limeidan:
I have read the part source code of golang/sys, found that argument defined as type uint32 in mips arch but uint64 in others. my machine is based on mips64 arch, so I want to know why it implemented as uint32 in mips.
Those headers are automatically generated from the kernel C headers I seem to remember.
At least that is what was stated in this issue which I made about some of those fields being renamed
opened 03:36PM - 23 Dec 18 UTC
closed 02:41PM - 28 Dec 18 UTC
Testing
NeedsInvestigation
FrozenDueToAge
As of go1.11.4 (1.11.2 and 1.11.4 tested), TestFstatat fails on Debian buildd ma… chines:
```
--- FAIL: TestFstatat (0.00s)
syscall_unix_test.go:516: Fstatat: returned stat does not match Stat
syscall_unix_test.go:535: Fstatat: returned stat does not match Lstat
FAIL
FAIL cmd/vendor/golang.org/x/sys/unix 0.405s
```
See https://buildd.debian.org/status/logs.php?pkg=golang-1.11&arch=mips64el for build logs.
Sorry, I haven't found time to try to study this in depth by logging into Debian's remote mips64el (mips64le) machine yet, but thought I should try my luck here first. :-) Many thanks!
If s.Rdev
can be uint32 then the fact it doesn’t compile is probably a bug in docker.
limeidan
(limeidan)
November 3, 2020, 9:14am
4
Thanks for your reply, this is the output on mips64:
[root@node001 git]# gcc --version
gcc (GCC) 7.3.1 20180303 (Loongson 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@node001 git]# gcc dev.c -o dev && ./dev
8
8
8
limeidan
(limeidan)
November 3, 2020, 11:22am
5
Thanks. I am not familiar with the kernel. You mean that the field rdev in my OS kernel is of u32 type. If it is, could the problem be with docker?
ncw
(Nick Craig-Wood)
November 3, 2020, 2:30pm
6
It looks like from the output of the C program that the size of rdev in your OS is 8 bytes so it is of uint64 type.
This means the bug is in the go standard library…
It would be worth making an issue on the main Go repo about this I think.
limeidan
(limeidan)
November 4, 2020, 1:52am
7
Thanks a lot, I have made an issue on the golang repo
opened 01:50AM - 04 Nov 20 UTC
What version of Go are you using (go version)?
$ go version
go version go1.13.9 linux/mips64le
What operating system and processor architecture are you...
1 Like
ncw
(Nick Craig-Wood)
November 6, 2020, 10:11pm
8
I see cherrymui’s response that Go uses the kernel layout. That is unexpected that the kernel is 32 bit but what he says makes sense.
So if it isn’t a Go bug it must be a Docker bug…
system
(system)
Closed
February 4, 2021, 10:11pm
9
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.