Je travaille avec tensorflow 1.1.0 avec gcc 5.2.0 et 0.4.5 Bazel Quand je fais:tensorflow linker_flag dans crosstool
./configure bazel build --verbose_failures --config=opt //tensorflow/tools/pip_package:build_pip_package
J'ai les messages d'erreur suivants:
ERROR: /remote/us03home4/rogerlo/.cache/bazel/_bazel_rogerlo/c6e718933b1d81ab029d890c5eecbc01/external/protobuf/BUILD:67 9:1: null failed: protoc failed: error executing command (cd /remote/us03home4/rogerlo/.cache/bazel/_bazel_rogerlo/c6e718933b1d81ab029d890c5eecbc01/execroot/tensorflow && \ exec env - \ bazel-out/host/bin/external/protobuf/protoc '--python_out=bazel-out/local-opt/genfiles/external/protobuf/python' -Iexternal/protobuf/python -Ibazel-out/local-opt/genfiles/external/protobuf/python bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/any.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/api.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/compiler/plugin.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/descriptor.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/duration.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/empty.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/field_mask.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/source_context.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/struct.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/timestamp.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/type.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/wrappers.proto): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by bazel-out/host/bin/external/protobuf/protoc) bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by bazel-out/host/bin/external/protobuf/protoc) bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by bazel-out/host/bin/external/protobuf/protoc) bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by bazel-out/host/bin/external/protobuf/protoc) ____Building complete. Target //tensorflow/tools/pip_package:build_pip_package failed to build ____Elapsed time: 101.992s, Critical Path: 54.24s make: *** [tensorflow] Error 1
Mais si j'ajouté cette ligne:
linker_flag: "-Wl,-rpath,/depot/gcc-5.2.0/lib64"
au fichier
$TENSORFLOW_ROOT/bazel-tensorflow/external/local_config_cc/CROSSTOOL
La construction passera.
Je me demande si je peux configurer ce linker_flag à partir du fichier de configuration ou ailleurs? Je l'ai ajouté à l'option de construction mais cela ne fonctionne pas.
bazel build --verbose_failures --config=opt --linkopt="-Wl,-rpath,/depot/gcc-5.2.0/lib6 4" //tensorflow/tools/pip_package:build_pip_package
EDIT: Bazel ajouté la version
SOLUTION:
- Ajouter l'option de liaison à la configuration de Bazel.
- Recompiler Bazel.
- Compiler Tensorflow avec le Bazel recompilé passera.
enquête
La cible est construit par crosstool externe, de sorte que le --linkopt ne fonctionnera pas. Selon l'officiel blog de Bazel, la configuration de crosstool externe (C++) est détectée automatiquement. Il pointe vers le C++ configuration file.
linker_flag rpath est calculé par $ LD_LIBRARY_PATH. Autrement dit, si vous avez défini des chemins de bibliothèque dans $ LD_LIBRARY_PATH, Bazel générera leur chemin dans le linker_flag.
Mais cette dépendance est supprimée à cause de [numéro # 2099] (github.com/bazelbuild/bazel/issues/2099)
réglage Donc $ LD_LIBRARY_PATH ne fonctionne pas dans [v0.4.5] (GitHub. com/bazelbuild/bazel/blob/0.4.5/tools/cpp/cc_configure.bzl # L250)
Cependant, je n'ai pas compris comment le faire correctement (en définissant env_action ou quelque chose). La solution rapide est donc de le coder en dur dans le fichier de configuration.
(Pardonne-moi des liens hypertexte laids dessus de ma réputation ne suffit pas d'avoir plus de 2 liens dans un poste..)
Ajout du drapeau comme --linkopt ne fonctionne pas? Il devrait (et c'est le cas dans mon petit test). L'indicateur est-il ajouté aux lignes de commande de liaison? Vous pouvez inspecter les lignes de commande individuelles que Bazel émet en utilisant l'option -s. – mhlopko
@mhlopko, non --linkopt ne fonctionne pas pour moi car la cible est construite par crosstool externe. Je mettrai à jour ma solution dans le message original. –