程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何为外部存储库或外部目标指定 C++ 标准版本大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决如何为外部存储库或外部目标指定 C++ 标准版本?

开发过程中遇到如何为外部存储库或外部目标指定 C++ 标准版本的问题如何解决?下面主要结合日常开发的经验,给出你关于如何为外部存储库或外部目标指定 C++ 标准版本的解决方法建议,希望对你解决如何为外部存储库或外部目标指定 C++ 标准版本有所启发或帮助;

将 -std=c++14 应用到 tensorflow 2.4.0

我的项目使用bazel作为构建系统,并且依赖tensorflow 2.4.0,编译tensorflow 2.4.0需要std=c++14

我需要它,因为在 c++14 以下我不能使用大括号括起来的初始化列表,所以编译退出时​​出错。

我在构建命令行中使用 --cxxopt="-std=c++14" 但失败了,我注意到 -std=c++14 对我自己的项目和其他一些外部存储库有效,tensorflow 除外。那么如何使其对 tensorflow 有效?

环境

  1. 巴泽尔:3.7.2
  2. gcc:9.3
  3. Ubuntu 20.04

构建日志

external/org_tensorflow/tensorflow/core/platform/default/port.cc: In function 'tensorflow::port::MemoryInfo tensorflow::port::GetMemoryInfo()':
external/org_tensorflow/tensorflow/core/platform/default/port.cc:360:46: error: Could not convert '{9223372036854775807,9223372036854775807}' from '<brace-enclosed initializer List>' to 'tensorflow::port::MemoryInfo'
  360 |   MemoryInfo mem_info = {INT64_MAX,INT64_MAX};
      |                                              ^
      |                                              |
      |                                              <brace-enclosed initializer List>
1614486823.931353268: src/main/tools/linux-sandBox-pID1.cc:410: wait returned pID=2,status=0x100
1614486823.931377593: src/main/tools/linux-sandBox-pID1.cc:428: child exited normally with code 1
1614486823.931746550: src/main/tools/linux-sandBox.cc:233: child exited normally with code 1
Target //xxxx:xxxx_server Failed to build
Use --verbose_@R_560_4895@ to see the command lines of Failed build steps.
ERROR: /home/tiger/.cache/bazel/_bazel_tiger/54bd93647cbbbce4003ae8897789ed4d/external/org_tensorflow/tensorflow/core/framework/BUILD:1261:31 C++ compilation of rule '@org_tensorflow//tensorflow/core/platform/default:platform_port' Failed (Exit 1): linux-sandBox Failed: error execuTing command
  (cd /home/tiger/.cache/bazel/_bazel_tiger/54bd93647cbbbce4003ae8897789ed4d/sandBox/linux-sandBox/41/execroot/xxxx_server && \
  exec env - \
    PATH=/data/bin/jdk1.8.0_271/bin:/data/bin/jdk1.8.0_271/jre/bin:/data/software/emsdk-2.0.10:/data/software/emsdk-2.0.10/upstream/emscripten:/data/software/emsdk-2.0.10/node/12.18.1_64bit/bin:/data/bin/apache-ant-1.10.9/bin:/usr/local/Nginx/sbin:/home/tiger/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/data/bin/go/bin:/data/src/go/bin:/usr/local/ComputeCpp-CE-2.3.0-x86_64-linux-gnu/bin \
    PWD=/proc/self/cwd \
    TMPDIR=/tmp \
  /home/tiger/.cache/bazel/_bazel_tiger/install/ee52e2cf873c0f1bf0bf84982bf9e785/linux-sandBox -t 15 -w /home/tiger/.cache/bazel/_bazel_tiger/54bd93647cbbbce4003ae8897789ed4d/sandBox/linux-sandBox/41/execroot/xxxx_server -w /tmp -w /dev/shm -D -- /usr/bin/gcc -U_FORTIFY_sourcE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_sourcE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/external/org_tensorflow/tensorflow/core/platform/default/_obJs/platform_port/port.d '-frandom-seed=bazel-out/host/bin/external/org_tensorflow/tensorflow/core/platform/default/_obJs/platform_port/port.o' -DEIGEN_MPL2_ONLY '-DEIGEN_MAX_AliGN_BYTES=64' '-DEIGEN_HAS_TYPE_TraiTS=0' -DHAVE_SYS_UIO_H -DTF_USE_SNAPPY -iquote external/org_tensorflow -iquote bazel-out/host/bin/external/org_tensorflow -iquote external/com_Google_absl -iquote bazel-out/host/bin/external/com_Google_absl -iquote external/eigen_archive -iquote bazel-out/host/bin/external/eigen_archive -iquote external/snappy -iquote bazel-out/host/bin/external/snappy -isystem external/eigen_archive -isystem bazel-out/host/bin/external/eigen_archive -g0 -g0 -DEIGEN_AVOID_STL_ARRAY -IExternal/gemmlowp -Wno-sign-compare '-ftemplate-depth=900' -fno-exceptions -msse3 -DTENSORFLOW_MONOliTHIC_BUILD -pthread -fno-canonical-system-headers -Wno-builTin-macro-redefined '-D__DATE__="redacted"' '-D__timestAMP__="redacted"' '-D__TIME__="redacted"' -c external/org_tensorflow/tensorflow/core/platform/default/port.cc -o bazel-out/host/bin/external/org_tensorflow/tensorflow/core/platform/default/_obJs/platform_port/port.o

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的如何为外部存储库或外部目标指定 C++ 标准版本全部内容,希望文章能够帮你解决如何为外部存储库或外部目标指定 C++ 标准版本所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: