2017-09-28 28 views
0

bazel.but을 사용하여 교차 컴파일을 시도했지만 platform.h에서 실패했습니다. 'mutex'파일을 찾을 수 없습니다. 빌드 할 수 있습니다. 크로스 컴파일 설정없이 bazel, 그리고 호스트에서 바이너리를 실행할 수 있습니다.bazel build a platform.h에서 실패한 교차 도구로 실패했습니다. 'mutex'파일을 찾을 수 없습니다.

내 환경이

  • - 64 ubuntu14.04
  • 목표 아래 : 팔 리눅스 gnueabihf
  • tensorflow : 헤드 maste의 cd5f3b67fca88217776522182481b0c128db5af9의
  • 는 bazel : 0.5.4 APT 설치 -get install

내 테스트 코드는 다음과 같습니다.

#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; 
} 

일부 파일을 수정했습니다.

  1. 추가 크로스

    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", ])

    아래

빌드입니다 BUILD// tensorflow/컴파일러/AOT/테스트에서 설정 작업 영역 파일

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",)

  • 추가 빌드 설정을 컴파일 나는 명령했다.

    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

    마침내 아래 오류가 발생합니다.

    (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

    오류 " 'nsync_cpp @nsync //'실패 (1 번 출구) : 규칙의 C++ 컴파일"에 occures. Befause의

    "./external/nsync//platform/c++11/platform.h:29:10 : 치명적인 오류 : '뮤텍스'파일을 찾을 수 없습니다 사용법 #include "

    파일 뮤텍스 .compilers/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/4.9.4/mutex에 존재합니다.

    나는 위의 빌드 출력 라인에서 잘 살고있다 경로 나 경로를 설정 할 수

    가 뮤텍스하는 방법 "linaroLinuxGcc49Repo// C++/4.9.4 포함/외부 -isystem"생각? nsync를 크로스 컴파일하고 싶습니까?

  • 답변