Unable to use cgo CFLAGS

I manually cloned the go directory from shadoworflow (the library I'm working on) in /home/arafat/go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go , you can see here . I made changes to lib.go as

 // #cgo LDFLAGS: -ltensorflow // #cgo CFLAGS: -I /home/arafat/go/src/github.com/tensorflow/tensorflow // #cgo CXXFLAGS: -I /home/arafat/go/src/github.com/tensorflow/tensorflow -std=c++11 

But I get an error

 # github.com/tensorflow/tensorflow/tensorflow/contrib/go In file included from go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go/tf_session_helper.cc:20:0: go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go/tf_session_helper.h:22:49: fatal error: tensorflow/core/public/tensor_c_api.h: No such file or directory #include "tensorflow/core/public/tensor_c_api.h" ^ compilation terminated. 

by doing

 go get github.com/tensorflow/tensorflow/tensorflow/contrib/go 

I can’t understand why this is not working.

+6
source share
1 answer

Probably an error with the path included, one tensor flow too much? Maybe you should do

 // #cgo CFLAGS: -I /home/arafat/go/src/github.com/tensorflow 

or

 #include "core/public/tensor_c_api.h" 
0
source

All Articles