运行runc碰到的坑
go build -o runc .
# github.com/seccomp/libseccomp-golang
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:298: invalid operation: in.toNative() == *_Cvar_C_ARCH_BAD (mismatched types C.uint32_t and C.uint)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:328: invalid case *_Cvar_C_ARCH_X86 in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:330: invalid case *_Cvar_C_ARCH_X86_64 in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:332: invalid case *_Cvar_C_ARCH_X32 in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:334: invalid case *_Cvar_C_ARCH_ARM in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:336: invalid case *_Cvar_C_ARCH_NATIVE in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:338: invalid case *_Cvar_C_ARCH_AARCH64 in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:340: invalid case *_Cvar_C_ARCH_MIPS in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:342: invalid case *_Cvar_C_ARCH_MIPS64 in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:344: invalid case *_Cvar_C_ARCH_MIPS64N32 in switch on a (mismatched types C.uint and C.uint32_t)
Godeps/_workspace/src/github.com/seccomp/libseccomp-golang/seccomp_internal.go:344: too many errors
make: *** [all] Error 2
编译runc时,报错,很明显,是runc的一个依赖库github.com/seccomp/libseccomp-golang的错误。
于是单独编译安装该库,同样抛出 mismatched types C.uint32_t and C.uint 这个错误。
查看源码 seccomp_internal.go:298 可以发现in.toNative()返回的是C.uint32_t类型的值
const uint32_t C_ARCH_BAD = ARCH_BAD;
从上面可以看出 C.C_ARCH_BAD 反射过来也应该是uint32_t 类型的值。不应该报错才对。
但是实践发现,在我的机器上C.C_ARCH_BAD被反射成uint类型的。
于是找到 golang/go 并提了个issue golang/go#12599 对方答复,是我的gcc版本太低了 -_-!
于是只好把gcc从4.6.3升级到了4.8.1,没问题了
runc上的原始的issue链接:
https://github.com/opencontainers/runc/issues/256