[英]How to compile tensorflow c_api using Makefile in linux
I'm trying to compile tensorflow c_api using Makefile. 我正在尝试使用Makefile编译tensorflow c_api。 I need help to add the tensorflow libraries in the makefile. 我需要帮助以将tensorflow库添加到makefile中。 I'm running it on Ubuntu. 我在Ubuntu上运行它。
Here I have attached the folder structure of the project, folder structure 在这里我附上了项目的文件夹结构 , 文件夹结构
I have also added the Makefile below. 我还在下面添加了Makefile。
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 ++ -c -Wall simple.cpp
g++ -o exec simple.o -I "tensorflow/c" -L "lib" -ltensorflow -ltensorflow_framework 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时,出现以下错误,
./exec: error while loading shared libraries: libtensorflow.so.1: cannot open shared object file: No such file or directory ./exec:加载共享库时出错:libtensorflow.so.1:无法打开共享库文件:没有这样的文件或目录
You have to make sure that lib
is on LD_LIBRARY_PATH
. 您必须确保lib
在LD_LIBRARY_PATH
。
export LD_LIBRARY_PATH=`pwd`/lib:${LD_LIBRARY_PATH}
./exec
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.