Node_exporter: go 1.5.2 C source files not allowed when not using cgo or SWIG:

Created on 2 Jan 2016  Â·  4Comments  Â·  Source: prometheus/node_exporter

Hi

i try to build the node_exporter master branch and get this error, any hints?
go build node_exporter.go

package runtime: C source files not allowed when not using cgo or SWIG: atomic_amd64x.c defs.c float.c heapdump.c lfstack.c malloc.c mcache.c mcentral.c mem_linux.c mfixalloc.c mgc0.c mheap.c msize.c os_linux.c panic.c parfor.c proc.c runtime.c signal.c signal_amd64x.c signal_unix.c stack.c string.c sys_x86.c vdso_linux_amd64.c

also with make

mkdir -p /home/fk/work/src/go/src/github.com/prometheus/node_exporter/.build/gopath/src/github.com/prometheus/
ln -s /home/fk/work/src/go/src/github.com/prometheus/node_exporter /home/fk/work/src/go/src/github.com/prometheus/node_exporter/.build/gopath/src/github.com/prometheus/node_exporter
GOPATH=/home/fk/work/src/go/src/github.com/prometheus/node_exporter/.build/gopath /usr/local/go/bin/go get -d
package .
    imports runtime: C source files not allowed when not using cgo or SWIG: atomic_amd64x.c defs.c float.c heapdump.c lfstack.c malloc.c mcache.c mcentral.c mem_linux.c mfixalloc.c mgc0.c mheap.c msize.c os_linux.c panic.c parfor.c proc.c runtime.c signal.c signal_amd64x.c signal_unix.c stack.c string.c sys_x86.c vdso_linux_amd64.c
Makefile.COMMON:93: recipe for target 'dependencies-stamp' failed
make: *** [dependencies-stamp] Error 1

regards f0

Most helpful comment

In case anyone else comes across this (Hi!), I ran into the same problem – it turned out that I had installed Go 1.5 into the same GOROOT but old files from 1.4 were still there – and these are what it complains about. When upgrading from Go 1.4 to 1.5, make sure to remove 1.4 completely.

All 4 comments

Try adding CGO_ENABLED=1 to your environment.

same error

env | grep -i cgo
CGO_ENABLED=1
/work/src/go/src/github.com/prometheus/node_exporter> make
GOPATH=/home/fk/work/src/go/src/github.com/prometheus/node_exporter/.build/gopath /usr/local/go/bin/go get -d
package .
    imports runtime: C source files not allowed when not using cgo or SWIG: atomic_amd64x.c defs.c float.c heapdump.c lfstack.c malloc.c mcache.c mcentral.c mem_linux.c mfixalloc.c mgc0.c mheap.c msize.c os_linux.c panic.c parfor.c proc.c runtime.c signal.c signal_amd64x.c signal_unix.c stack.c string.c sys_x86.c vdso_linux_amd64.c
Makefile.COMMON:93: recipe for target 'dependencies-stamp' failed
make: *** [dependencies-stamp] Error 1
/work/src/go/src/github.com/prometheus/node_exporter> 

ok fixed .... i need to change the goroot as go 1.5 installs in go15 subdirectory ..... but thx anyway

In case anyone else comes across this (Hi!), I ran into the same problem – it turned out that I had installed Go 1.5 into the same GOROOT but old files from 1.4 were still there – and these are what it complains about. When upgrading from Go 1.4 to 1.5, make sure to remove 1.4 completely.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fchiorascu picture fchiorascu  Â·  3Comments

shamimgeek picture shamimgeek  Â·  3Comments

cjroebuck picture cjroebuck  Â·  3Comments

hryamzik picture hryamzik  Â·  5Comments

ridvankaratas picture ridvankaratas  Â·  3Comments