C source files not allowed when not using cgo or SWIG

Hello,

I am trying to compile “runc” on “mac” by following runc instructions. Every time I tried, I got error “C source files not allowed when not using cgo or SWIG: cloned_binary.c nsexec.c”.

Google result shows two cases for such error:

  1. Go1.5 and Go1.4.2 installed to same place.
  2. Cross compiling.

Neither is close to my case. Appreciate if anyone can give any suggestions. Stuck on this issue for long time. Below is the go version, environment, and errors.

lexli-mbp$ go version
go version go1.13.3 darwin/amd64
lexli-mbp$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/lexli/Library/Caches/go-build"
GOENV="/Users/lexli/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/lexli/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/v7/5f5dfb8173z185b2jdbkwh080000gn/T/go-build755493385=/tmp/go-build -gno-record-gcc-switches -fno-common"
lexli-mbp$ pwd
/Users/lexli/go/src/github.com/opencontainers/runc

lexli-mbp$ make
go build -buildmode=pie -ldflags "-X main.gitCommit="c4d8e1688c816a8cef632a3b44a38611511b7140" -X main.version=1.0.0-rc9+dev " -tags "seccomp" -o runc .
init.go:10:2: C source files not allowed when not using cgo or SWIG: cloned_binary.c nsexec.c
make: *** [runc] Error 1
2 Likes

Eric, thank you so much for pointing this out. I tried to build it on Linux today and build succeeded.

1 Like

I am new to Golang world and this is my first post in this forum (didn’t know how to mark topic as solved).
I use “go get” to download and install package and their dependencies.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.