2017-09-28 7 views
0

Je suis en train d'essayer la compilation croisée avec bazel.But a échoué dans platform.h erreur fatale 'mutex' fichier introuvable.Je peux construire avec bazel sans réglage de compilation croisée, et je peux exec le binaire dans l'hôte.bazel build aot avec l'outil de croix échoué dans platform.h erreur fatale 'mutex' fichier non trouvé

Mon environnement est inférieure à

  • x86-64 ubuntu14.04
  • cible: bras-linux-gnueabihf
  • tensorflow: Chef de maste cd5f3b67fca88217776522182481b0c128db5af9
  • Bazel: 0.5.4 installé par apt -get installer

Mon code de test est ci-dessous.

#define EIGEN_USE_THREADS 
#define EIGEN_USE_CUSTOM_THREAD_POOL 

#include <iostream> 
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" 
#include "tensorflow/compiler/aot/tests/test_graph_tfmatmul.h" // generated 

int main(int argc, char** argv) { 
    Eigen::ThreadPool tp(2); // Size the thread pool as appropriate. 
    Eigen::ThreadPoolDevice device(&tp, tp.NumThreads()); 

    foo::bar::MatMulComp matmul; 
    matmul.set_thread_pool(&device); 

    // Set up args and run the computation. 
    const float args[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; 
    std::copy(args + 0, args + 6, matmul.arg0_data()); 
    std::copy(args + 6, args + 12, matmul.arg1_data()); 
    matmul.Run(); 

    // Check result 
    if (matmul.result0(0, 0) == 58) { 
    std::cout << "Success" << std::endl; 
    } else { 
    std::cout << "Failed. Expected value 58 at 0,0. Got:" 
       << matmul.result0(0, 0) << std::endl; 
    } 

    return 0; 
} 

J'ai modifié les fichiers à compiler.

  1. ajouter une compilation croisée paramètres dans un fichier WORKSPACE

    new_local_repository( name = "linaroLinuxGcc49Repo", build_file = "compilers/linaro_linux_gcc_4.9.BUILD", path = "compilers/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf",)

  2. build Ajouter un paramètre dans/tensorflow/compilateur/AOT/tests/CONSTRUIRE

    cc_binary( name = "my_binary", srcs = [ "my_code.cc", # include test_graph_tfmatmul.h to access the generated header ], deps = [ ":test_graph_tfmatmul", # link in the generated object file "//third_party/eigen3", ], linkopts = [ "-lpthread", ])

Ci-dessous la construction commande que j'ai fait.

bazel build --copt=-Wno-c++11-narrowing --cxxopt='-std=c++11' //tensorflow/compiler/aot/tests:my_binary [email protected]_tools//tools/cpp:toolchain --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a --verbose_failures

Enfin, j'obtiens l'erreur ci-dessous.

(root) [email protected]:repo [master]$ bazel build --copt=-Wno-c++11-narrowing --cxxopt='-std=c++11' //tensorflow/compiler/aot/tests:my_binary [email protected]_tools//tools/cpp:toolchain --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a --verbose_failures WARNING: /home/user-name/tensorflow/repo/tensorflow/core/BUILD:1772:1: in includes attribute of cc_library rule //tensorflow/core:framework_headers_lib: '../../external/nsync/public' resolves to 'external/nsync/public' not below the relative path of its package 'tensorflow/core'. This will be an error in the future. Since this rule was created by the macro 'cc_header_only_library', the error might have been caused by the macro implementation in /home/user-name/tensorflow/repo/tensorflow/tensorflow.bzl:1029:30 WARNING: /home/user-name/tensorflow/repo/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': No longer supported. Switch to SavedModel immediately. WARNING: /home/user-name/tensorflow/repo/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:gc': No longer supported. Switch to SavedModel immediately. INFO: Analysed target //tensorflow/compiler/aot/tests:my_binary (0 packages loaded). INFO: Found 1 target... ERROR: /home/user-name/.cache/bazel/_bazel_user-name/6d2eb697f6f4dfadad89ea8a861fded5/external/nsync/BUILD:397:1: C++ compilation of rule '@nsync//:nsync_cpp' failed (Exit 1): clang failed: error executing command (cd /home/user-name/.cache/bazel/_bazel_user-name/6d2eb697f6f4dfadad89ea8a861fded5/execroot/org_tensorflow && \ exec env - \ PWD=/proc/self/cwd \ PYTHON_BIN_PATH=/home/user-name/.pyenv/versions/anaconda3-4.4.0/bin/python \ PYTHON_LIB_PATH=/home/user-name/.pyenv/versions/anaconda3-4.4.0/lib/python3.6/site-packages \ TF_NEED_CUDA=0 \ TF_NEED_OPENCL=0 \ tools/arm_compiler/linaro_linux_gcc/clang_bin/clang -target armv7a-arm-linux-gnueabif '--sysroot=external/linaroLinuxGcc49Repo/arm-linux-gnueabihf/libc' '-mfloat-abi=hard' -nostdinc -isystem /usr/lib/clang/3.6/include -isystem external/linaroLinuxGcc49Repo/lib/gcc/arm-linux-gnueabihf/4.9.4/include -isystem external/linaroLinuxGcc49Repo/arm-linux-gnueabihf/libc/usr/include -isystem external/linaroLinuxGcc49Repo/lib/gcc/arm-linux-gnueabihf/4.9.4/include-fixed -isystem external/linaroLinuxGcc49Repo/arm-linux-gnueabihf/libc/usr/include -isystem external/linaroLinuxGcc49Repo/include/c++/4.9.4 -U_FORTIFY_SOURCE -fstack-protector -fPIE '-fdiagnostics-color=always' -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -Wno-c++11-narrowing -MD -MF bazel-out/clang_linux_armhf-py3-opt/bin/external/nsync/_objs/nsync_cpp/external/nsync/internal/sem_wait.d -iquote external/nsync -iquote bazel-out/clang_linux_armhf-py3-opt/genfiles/external/nsync -iquote external/bazel_tools -iquote bazel-out/clang_linux_armhf-py3-opt/genfiles/external/bazel_tools -isystem external/nsync/public -isystem bazel-out/clang_linux_armhf-py3-opt/genfiles/external/nsync/public -isystem external/bazel_tools/tools/cpp/gcc3 -x c++ '-std=c++11' -DNSYNC_ATOMIC_CPP11 -DNSYNC_USE_CPP11_TIMEPOINT -I./external/nsync//platform/c++11 -I./external/nsync//platform/gcc -I./external/nsync//platform/arm -I./external/nsync//public -I./external/nsync//internal -I./external/nsync//platform/posix '-D_POSIX_C_SOURCE=200809L' -pthread -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/nsync/internal/sem_wait.c -o bazel-out/clang_linux_armhf-py3-opt/bin/external/nsync/_objs/nsync_cpp/external/nsync/internal/sem_wait.o) warning: unknown warning option '-Wunused-but-set-parameter'; did you mean '-Wunused-parameter'? [-Wunknown-warning-option] warning: unknown warning option '-Wno-free-nonheap-object'; did you mean '-Wno-sequence-point'? [-Wunknown-warning-option] In file included from external/nsync/internal/sem_wait.c:16: ./external/nsync//platform/c++11/platform.h:29:10: fatal error: 'mutex' file not found #include ^2 warnings and 1 error generated. Target //tensorflow/compiler/aot/tests:my_binary failed to build INFO: Elapsed time: 0.917s, Critical Path: 0.15s FAILED: Build did NOT complete successfully

Erreur dans occures "C++ compilation de règles '@nsync //: nsync_cpp' a échoué (sortie 1):".

Befause de "./external/nsync//platform/c++11/platform.h:29:10: erreur fatale: fichier 'mutex' not found #include "

Le fichier mutex existe dans ./compilers/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/4.9.4/mutex.

Je pense chemin ci-dessus est dans la ligne setted de sortie de construction "-isystem externe/linaroLinuxGcc49Repo/include/C++/4.9.4"

Comment pourrais-je définir le chemin de Mutex? pour la compilation croisée nsync?

Répondre