Unable to use cgo CFLAGS
Asked Answered
B

1

7

I have manually cloned the go directory of tensorflow(a library I am working on ) in /home/arafat/go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go you can take a look here. I have 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 am getting the 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.

on doing

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

I am not able to understand why this is not working.

Brokerage answered 11/6, 2016 at 7:58 Comment(1)
If you have to edit the CFLAGS, it's likely because you're using an outdated version of GoOdessaodetta
S
1

Likely a mistake with the include path, one tensorflow too many? Perhaps you should do

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

or

#include "core/public/tensor_c_api.h"
Shark answered 13/9, 2016 at 23:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.