Skip to content
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

syscall: cannot use s.Rdev (type uint32) as type uint64 in field value on mips #16500

Closed
ka1em opened this issue Jul 26, 2016 · 4 comments
Closed
Assignees

Comments

@ka1em
Copy link

@ka1em ka1em commented Jul 26, 2016

  1. What version of Go are you using (go version)?
    go1.7.rc2

  2. What operating system and processor architecture are you using (go env)?
    [root@localhost ~]# go env
    GOARCH="mips64le"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="mips64le"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH=""
    GORACE=""
    GOROOT="/usr/lib/golang"
    GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_mips64le"
    CC="gcc"
    GOGCCFLAGS="-fPIC -mabi=64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build685506292=/tmp/go-build"
    CXX="g++"
    CGO_ENABLED="1"

  3. What did you do?
    My PC is a mips64le pc. When I compile the docker, I encountered a problem:

    this is the error message:
    docker/pkg/system/stat_linux.go:13: cannot use s.Rdev (type uint32) as type uint64 in field value

3.1 In go/src/syscall/syscall_linux_mips64x.go, I see that

type stat_t struct {
    Dev        uint32

3.2 On my pc RUN: man 2 stat, I see that

struct stat {
    dev_t     st_dev;

3.3 Then I wrote a test program.

#include <stdio.h>
#include <sys/types.h>

int main()
{
    printf("sizeof(dev_t) = %d\n", sizeof(dev_t));

    return 0;
}
---------------------------
sizeof(dev_t) = 8
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jul 26, 2016

Weird. @cherrymui, how did you generate that file?

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Jul 26, 2016

The kernel's layout is (e.g. https://github.com/torvalds/linux/blob/master/arch/mips/include/uapi/asm/stat.h#L92)

#if _MIPS_SIM == _MIPS_SIM_ABI64

/* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
struct stat {
    unsigned int        st_dev;

So I believe uint32 is correct. Go invokes syscalls directly to the kernel, so we should use kernel's layout instead of libc's.

@ka1em
Copy link
Author

@ka1em ka1em commented Jul 28, 2016

@cherrymui , thx, I see.

@ka1em ka1em closed this Jul 28, 2016
@vans88
Copy link

@vans88 vans88 commented Nov 3, 2016

@ka1em How did you fix the problem at last? Now I am building kubernetes os mips64el/Fedora 21 and getting the same error shown as follows. Any suggestions for me? Many thanks.

k8s.io/kubernetes/vendor/github.com/docker/docker/pkg/system
k8s.io/kubernetes/vendor/github.com/google/cadvisor/fs
k8s.io/kubernetes/vendor/github.com/google/certificate-transparency/go/x509
# k8s.io/kubernetes/vendor/github.com/docker/docker/pkg/system
vendor/github.com/docker/docker/pkg/system/stat_linux.go:13: _cannot use s.Rdev (type uint32) as type uint64 in field value_
# k8s.io/kubernetes/vendor/github.com/google/cadvisor/fs
vendor/github.com/google/cadvisor/fs/fs.go:422: cannot use buf.Dev (type uint32) as type uint64 in argument to major
vendor/github.com/google/cadvisor/fs/fs.go:423: cannot use buf.Dev (type uint32) as type uint64 in argument to minor
# k8s.io/kubernetes/vendor/github.com/google/certificate-transparency/go/x509
vendor/github.com/google/certificate-transparency/go/x509/x509.go:342: undefined: elliptic.P224
vendor/github.com/google/certificate-transparency/go/x509/x509.go:355: undefined: elliptic.P224
vendor/github.com/google/certificate-transparency/go/x509/x509.go:1461: undefined: elliptic.P224
Makefile:79: recipe for target 'all' failed
make: *** [all] Error 1

Platform info:

[root@dscn2 kubernetes]# uname -a
Linux dscn2 4.4.21+ #3 SMP PREEMPT Wed Oct 12 09:14:23 CST 2016 mips64 mips64 mips64 GNU/Linux
[root@dscn2 kubernetes]# go env
GOARCH="mips64le"
GOBIN=""
GOEXE=""
GOHOSTARCH="mips64le"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/mygo"
GORACE=""
GOROOT="/usr/lib/golang"
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_mips64le"
CC="gcc"
GOGCCFLAGS="-fPIC -mabi=64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build797767121=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

@golang golang locked and limited conversation to collaborators Nov 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.