geard をビルドしたいんだけど
こける。
ビルドしたい対象は https://github.com/openshift/geard
環境は Fedora 21 (一応サポートされてないけど、動くといいなと思った)
必要なパッケージをインストールして、 Golang 1.4 ビルドして、ビルドしたけどエラー
リポジトリに Dockerfile が含まれていて、 ( https://github.com/openshift/geard/blob/master/Dockerfile ) yum install している箇所がある。
ここを参考に、
$ yum install golang git hg bzr libselinux-devel glibc-static btrfs-progs-devel device-mapper-devel sqlite-devel libnetfilter_queue-devel gcc gcc-c++
して、
$ go get github.com/openshift/geard $ cd $GOPATH/src/github.com/openshift/geard $ contrib/build -s -i -l -n
するとこける。 (selinux のオプション無効にするとビルドできるけど、ね)
エラーは以下の感じ。
(git:master)[@localhost geard]$ cd $GOPATH/src/github.com/openshift/geard (git:master)[@localhost geard]$ contrib/build -s -i -l -n Building with GOPATH: /path/to/gopath/src/github.com/openshift/geard/contrib/../vendor:/path/to/gopath Version: version alpha3, build 99f3a87 ------------------------------------------ Building cmd/gear (target: linux)... ------------------------------------------ # github.com/openshift/geard/selinux/library selinux/library/selinux_impl.go:40: cannot use &con (type *C.security_context_t) as type **C.char in argument to _C2func_matchpathcon selinux/library/selinux_impl.go:56: cannot use &scon (type *C.security_context_t) as type **C.char in argument to _C2func_lgetfilecon selinux/library/selinux_impl.go:80: cannot use &scon (type *C.security_context_t) as type **C.char in argument to _C2func_getfscreatecon selinux/library/selinux_impl.go:91: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _Cfunc_getcon selinux/library/selinux_impl.go:100: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _C2func_getpidcon selinux/library/selinux_impl.go:112: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _C2func_getpeercon ===> FAILED ------------------------------------------ Building cmd/switchns (target: linux)... ------------------------------------------ # github.com/openshift/geard/selinux/library selinux/library/selinux_impl.go:40: cannot use &con (type *C.security_context_t) as type **C.char in argument to _C2func_matchpathcon selinux/library/selinux_impl.go:56: cannot use &scon (type *C.security_context_t) as type **C.char in argument to _C2func_lgetfilecon selinux/library/selinux_impl.go:80: cannot use &scon (type *C.security_context_t) as type **C.char in argument to _C2func_getfscreatecon selinux/library/selinux_impl.go:91: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _Cfunc_getcon selinux/library/selinux_impl.go:100: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _C2func_getpidcon selinux/library/selinux_impl.go:112: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _C2func_getpeercon ===> FAILED ------------------------------------------ Building ssh/cmd/gear-auth-keys-command (target: linux)... ------------------------------------------ # github.com/openshift/geard/selinux/library selinux/library/selinux_impl.go:40: cannot use &con (type *C.security_context_t) as type **C.char in argument to _C2func_matchpathcon selinux/library/selinux_impl.go:56: cannot use &scon (type *C.security_context_t) as type **C.char in argument to _C2func_lgetfilecon selinux/library/selinux_impl.go:80: cannot use &scon (type *C.security_context_t) as type **C.char in argument to _C2func_getfscreatecon selinux/library/selinux_impl.go:91: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _Cfunc_getcon selinux/library/selinux_impl.go:100: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _C2func_getpidcon selinux/library/selinux_impl.go:112: cannot use &pcon (type *C.security_context_t) as type **C.char in argument to _C2func_getpeercon ===> FAILED ------------------------------------------ Building cmd/sti (target: linux)... ------------------------------------------ ===> Success Exiting due to build failures.
selinux/library/selinux_impl.go の型が違うと思って直したけど、エラー
先ほどのエラーを見て、以下の修正かなと思って修正したけど、エラー。
diff --git a/selinux/library/selinux_impl.go b/selinux/library/selinux_impl.go index 17f2e0b..33fa694 100644 --- a/selinux/library/selinux_impl.go +++ b/selinux/library/selinux_impl.go @@ -35,7 +35,8 @@ var ( ) func Matchpathcon(path string, mode os.FileMode) (string, error) { - var con C.security_context_t + //var con C.security_context_t + var con *C.char var scon string rc, err := C.matchpathcon(C.CString(path), C.mode_t(mode), &con) if rc == 0 { @@ -51,7 +52,8 @@ func Setfilecon(path, scon string) (int, error) { } func Getfilecon(path string) (string, error) { - var scon C.security_context_t + //var scon C.security_context_t + var scon *C.char var fcon string rc, err := C.lgetfilecon(C.CString(path), &scon) if rc >= 0 { @@ -75,7 +77,8 @@ func Setfscreatecon(scon string) (int, error) { } func Getfscreatecon() (string, error) { - var scon C.security_context_t + //var scon C.security_context_t + var scon *C.char var fcon string rc, err := C.getfscreatecon(&scon) if rc >= 0 { @@ -87,7 +90,8 @@ func Getfscreatecon() (string, error) { } func Getcon() string { - var pcon C.security_context_t + //var pcon C.security_context_t + var pcon *C.char C.getcon(&pcon) scon := C.GoString(pcon) C.freecon(pcon) @@ -95,7 +99,8 @@ func Getcon() string { } func Getpidcon(pid int) (string, error) { - var pcon C.security_context_t + //var pcon C.security_context_t + var pcon *C.char var scon string rc, err := C.getpidcon(C.pid_t(pid), &pcon) if rc >= 0 { @@ -107,7 +112,8 @@ func Getpidcon(pid int) (string, error) { } func Getpeercon(socket int) (string, error) { - var pcon C.security_context_t + //var pcon C.security_context_t + var pcon *C.char var scon string rc, err := C.getpeercon(C.int(socket), &pcon) if rc >= 0 {
エラーは以下の感じ。
(git:master)[@localhost geard]$ contrib/build -s -i -l -n Building with GOPATH: /path/to/gopath/src/github.com/openshift/geard/contrib/../vendor:/path/to/gopath Version: version alpha3, build 99f3a87 ------------------------------------------ Building cmd/gear (target: linux)... ------------------------------------------ # github.com/openshift/geard/containers/cmd containers/cmd/cmd.go:79: cannot use &ctx.portPairs (type *PortPairs) as type pflag.Value in argument to installImageCmd.Flags().VarP: *PortPairs does not implement pflag.Value (missing Type method) containers/cmd/cmd.go:80: cannot use &ctx.networkLinks (type *NetworkLinks) as type pflag.Value in argument to installImageCmd.Flags().VarP: *NetworkLinks does not implement pflag.Value (missing Type method) containers/cmd/cmd.go:81: cannot use &ctx.volumeConfig (type *VolumeConfig) as type pflag.Value in argument to installImageCmd.Flags().VarP: *VolumeConfig does not implement pflag.Value (missing Type method) containers/cmd/cmd.go:141: cannot use &ctx.networkLinks (type *NetworkLinks) as type pflag.Value in argument to linkCmd.Flags().VarP: *NetworkLinks does not implement pflag.Value (missing Type method) # github.com/openshift/geard/containers/systemd/init containers/systemd/init/cmd.go:19: inconsistent definition for type pflag.Value during import interface { Set(string) error; String() string } (in "github.com/spf13/cobra") interface { Set(string) error; String() string; Type() string } (in "github.com/openshift/geard/cmd") containers/systemd/init/cmd.go:19: inconsistent definition for type cobra.Command during import struct { name string; Use string; Short string; Long string; flags *pflag.FlagSet; pflags *pflag.FlagSet; Run func(*cobra.Command, []string); commands []*cobra.Command; par ent *cobra.Command; commandsMaxUseLen int; commandsMaxCommandPathLen int; flagErrorBuf *bytes.Buffer; args []string; output *io.Writer; usageFunc func(*cobra.Command) error; usageT emplate string; helpTemplate string; helpFunc func(*cobra.Command, []string); helpCommand *cobra.Command } (in "github.com/spf13/cobra") struct { name string; Use string; Aliases []string; Short string; Long string; flags *pflag.FlagSet; pflags *pflag.FlagSet; Run func(*cobra.Command, []string); commands []* cobra.Command; parent *cobra.Command; commandsMaxUseLen int; commandsMaxCommandPathLen int; flagErrorBuf *bytes.Buffer; cmdErrorBuf *bytes.Buffer; args []string; output *io.Writer; usageFunc func(*cobra.Command) error; usageTemplate string; helpTemplate string; helpFunc func(*cobra.Command, []string); helpCommand *cobra.Command; helpFlagVal bool } (in "githu b.com/openshift/geard/cmd") ===> FAILED ------------------------------------------ Building cmd/switchns (target: linux)... ------------------------------------------ # github.com/openshift/geard/cmd/switchns cmd/switchns/main.go:48: cannot use &envs (type *Environment) as type pflag.Value in argument to switchnsCmd.Flags().VarP: *Environment does not implement pflag.Value (missing Type method) ===> FAILED ------------------------------------------ Building ssh/cmd/gear-auth-keys-command (target: linux)... ------------------------------------------ ===> Success ------------------------------------------ Building cmd/sti (target: linux)... ------------------------------------------ ===> Success Exiting due to build failures.
よくわからないね。