arm/tensorflow编译问题汇总

1.undecl ared inclusion(s) in rule '@protobuf_archive//:python/google/protobuf/internal/_api_implementation.so':

missing dependency declarations for the following files included by 'external/protobuf/python/google/protobuf/internal/api_implementation.cc'

undeclared inclusion(s) in rule '@com_google_protobuf//:protoc_lib' 

undeclared inclusion(s) in rule '@protobuf_archive//:python/google/protobuf/internal/_api_implementation.so'

C++ compilation of rule '@boringssl//:crypto' failed (Exit 1): gcc failed: er

tensorflow use option -std=c99 or -std=gnu99 to compile your code

答:1、 bazel build --conlyopt=-std=c99

  2、升级gcc/g++参考https://www.jianshu.com/p/8ac4e50d182dhttps://blog.youkuaiyun.com/u011181989/article/details/91334478

 

2./lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found 

答:参考https://www.jianshu.com/p/28a0c98027a8

https://blog.youkuaiyun.com/GUI1259802368/article/details/84934075

3.python 导入包时报错 ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found 的解决办法

答:参考https://blog.youkuaiyun.com/zerow__/article/details/88845192

4. error: ‘dynamic_init_dummy_src_2fproto_2fgrpc_2fcore_2fstats_2eproto’ defined but not used [-Werror=unused-variable

答:

遇到错误如下:

/grpc/gens/src/proto/grpc/core/stats.pb.cc:187:13: error: ‘dynamic_init_dummy_src_2fproto_2fgrpc_2fcore_2fstats_2eproto’ defined but not used [-Werror=unused-variable]
 static bool dynamic_init_dummy_src_2fproto_2fgrpc_2fcore_2fstats_2eproto = []()
             ^
cc1plus: all warnings being treated as errors
找到Makefile,去掉其中-Werror ,重新编译。

5.centos python 源码安装opencv 2.4.5

答:参考https://blog.youkuaiyun.com/10km/article/details/52815957

6.error: 'for' loop initial declarations are only allowed in C99 mode;

tensorflow use option -std=c99 or -std=gnu99 to compile your code

答:1、升级gcc/g++为高版本参考https://www.jianshu.com/p/8ac4e50d182dhttps://blog.youkuaiyun.com/u011181989/article/details/91334478

2、或者进行如下操作:

使用gcc编译代码是报出

error: 'for' loop initial declarations are only allowed in C99 mode

note: use option -std=c99 or -std=gnu99 to compile your code

错误,这是因为在gcc中直接在for循环中初始化了增量:

    for(int i=0; i<len; i++) {
    }
这语法在gcc中是错误的,必须先先定义i变量:

int i;
for(i=0;i<len;i++){
 
}

这是因为gcc基于c89标准,换成C99标准就可以在for循环内定义i变量了:

gcc src.c -std=c99 -o src

7.linux which: no javac in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

答:安装jdk,安装步骤参考

https://www.cnblogs.com/Warren-Zheng/p/8609214.html

8.Linux下OpenSSL的安装

参考https://blog.youkuaiyun.com/u013898698/article/details/79174029/

9.Bazel安装

bazel网址:

https://github.com/bazelbuild/bazel/releases/tag

10.centos安装libgflags

答:

安装glog和gflags
1.下载

git clone https://github.com/google/glog

2.配置

sudo apt-get install autoconf automake libtool

3.编译&安装

进入源码根目录(glog文件夹) 
./autogen.sh 
./configure 
make -j 24 
sudo make install

4..下载gflags

git clone https://github.com/gflags/gflags

编译&安装
进入源码目录(即gflags文件夹) 
cmake . 
make -j 24 
sudo make install

6.简单示例

#include <glog/logging.h>  
//#include<gflags/flags.h>  
int main(int argc,char* argv[]) {  
    // 要使用下面的api,需要安装额外的gflags,以及添加上面注释的头文件   
    // google::ParseCommandLineFlags(&argc, &argv, true);  

    // Initialize Google's logging library.  
    google::InitGoogleLogging(argv[0]);  

  //需要先在本目录下先建立有个名为“log”的文件夹,否则会报错
    FLAGS_log_dir = "./log";
    //or  google::SetLogDestination(google::GLOG_INFO, "./log_");  

    LOG(INFO) << "hello world";  

    return 0;  


编译时加上glog的动态库

如:g++ test.cc -lglog -lgflags -lpthread -o test

注意,再次提醒,log目录要事先创建好再在程序中指定才行。

然后,运行该程序,可以在log文件夹中找到一个文件,记录“hello world”的相关日志信息。
11.修改KERN_DIR路径

答:查看当前liunx内核命令:uname -r
KERN_DIR=/usr/src/kernels/`uname -r`

12.kernel-devel.aarch64 安装指定版本

13.centos included by 'external/grpc/src/core/lib/gpr/string_w

答:安装grpc参考https://www.jianshu.com/p/efc9167e7044

14.linux 中的编译指令make 和make clean

答:

在make的时候,会重新生成objects, 也就说新的object覆盖就得objects

make clean 是删除旧的objects。

所以应该是make已经含有了make clean的功能。

但是实际用的时候,比如多次编译调试运行, 有时候必须make clean一下,直接make,上次留下来的错误似乎不能清干净。
 15.undeclared inclusion(s) in rule '@grpc//:alts_proto':

this rule is missing dependency declarations for the following files included by 'external/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.c'

答:参考:https://stackoverflow.com/questions/35256110/tensorflow-build-fails-with-missing-dependency-error

Bazel complaints of system header files because compiler uses -MD (as opposed to -MMD) flag when generating dependences. While using -MD is reasonable for an environment that changes often, listing dependency on system header files causes the 'missing dependency declarations' errors.

What helped me was converting the '-MD' flag into '-MMD' flag in the compiler wrapper files third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl just before 'subprocess.call([CPU_COMPILER]...)':

cpu_compiler_flags = ['-MMD' if flag == '-MD' else flag for flag in cpu_compiler_flags]

and third_party/sycl/crosstool/computecpp.tpl, similar place:

computecpp_device_compiler_flags = ['-MMD' if flag == '-MD' else flag for flag in computecpp_device_compiler_flags]

16.ndeclared inclusion(s) in rule '@jpeg//:jpeg'

…1 在编译的目标文件(e.g. libtensorflow_cc.so)的BUILD文件中对应的模块定义(e.g. cc_library...)中,deps字段中添加依赖,上例bug应在cc_librarydeps中添加:

@jpeg//:simd_armv7a

…2 同时添加一个新字段visibility,用来提供全局可见性:

visibility = ["//visibility:public"],

…3 然后修改这个@jpeg第三方库BUILD下的simd_armv7a模块。

注意Tensorflow的第三方库都放在tensorflow/bazel-tensorflow/external/中。

所以在tensorflow/bazel-tensorflow/external/jpeg下找到BUILD.bazel文件,修改simd_armv7a模块。

上述error log的意思就是在这个simd_armv7a字段中,缺少'external/jpeg/jpegint.h''external/jpeg/jerror.h'两个源码依赖。因此需要在name字段为simd_armv7acc_library模块中的srcs字段中添加:

"jpegint.h",
"jerror.h",

这里因为jpegint.hjerror.h两个文件和BUILD在一个目录下,故没有前面的路径(external/jpeg/)。

…4 然后给这个cc_library模块添加新字段visibility,用来提供全局可见

visibility = ["//visibility:public"],

17. error in grpcio setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers

error in grpcio setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers

答:pip install setuptools -U

18.ERROR: ipapython 4.6.4 has requirement dnspython>=1.15

ERROR: ipapython 4.6.4 has requirement python-ldap>=3.0.0b1, but you'll have python-ldap 2.4.15 which is incompatible.

答:参考https://www.cnblogs.com/caowenhao/p/7807871.html

19.安装TensorFlow问题 解决Cannot uninstall 'wrapt'. It is a distutils installed project

1.遇到了

ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

办法1:输入 pip install -U --ignore-installed wrapt enum34 simplejson netaddr

参考:https://www.cnblogs.com/xiaowei2092/p/11025155.html

 

2.遇到了

ERROR: tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you'll have setuptools 39.1.0 which is incompatible.

原因: setuptools 版本太低

办法:更新setuptools版本 输入 pip install --upgrade setuptools

20.安装pydot、protobuf、graphviz并查看版本(包括libprotoc)

答:参考https://blog.youkuaiyun.com/ShuqiaoS/article/details/83382590

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值