Reputation: 3
I'm trying to compile tensorflow c_api using Makefile. I need help to add the tensorflow libraries in the makefile. I'm running it on Ubuntu.
Here I have attached the folder structure of the project, folder structure
I have also added the Makefile below.
CC = g++
CFLAGS = -c -Wall
INCLUDES = -I "tensorflow/c"
LIBS =-L "lib" -ltensorflow -ltensorflow_framework
all : exec
exec : simple.o
$(CC) -o exec simple.o $(INCLUDES) $(LIBS)
.cpp.o:
$(CC) $(CFLAGS) $<
clean:
rm -rf *.
The program compiles without error,
g++ -c -Wall simple.cpp
g++ -o exec simple.o -I "tensorflow/c" -L "lib" -ltensorflow -ltensorflow_framework
but when i run the exec I get the following error,
./exec: error while loading shared libraries: libtensorflow.so.1: cannot open shared object file: No such file or directory
Upvotes: 0
Views: 212
Reputation: 13405
You have to make sure that lib
is on LD_LIBRARY_PATH
.
export LD_LIBRARY_PATH=`pwd`/lib:${LD_LIBRARY_PATH}
./exec
Upvotes: 2