XiaoMi/mace

bash tools/bazel-build-standalone-lib.sh出错

Closed this issue · 6 comments

Before you open an issue, please make sure you have tried the following steps:

  1. Make sure your environment is the same with (https://mace.readthedocs.io/en/latest/installation/env_requirement.html).
  2. Have you ever read the document for your usage?
  3. Check if your issue appears in HOW-TO-DEBUG or FAQ.
  4. The form below must be filled.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):18.04
  • NDK version(e.g., 15c):r16b
  • GCC version(if compiling for host, e.g., 5.4.0):7.5.0
  • MACE version (Use the command: git describe --long --tags):0.12.0
  • Python version(2.7): 3.6
  • Bazel version (e.g., 0.13.0):0.13.0

Describe the problem

long@long-Ubuntu:~/soft/mace$ bash tools/bazel-build-standalone-lib.sh
1试过mace 0.10.0,试过ndk:r21,试过bazel:0.18.0,都一样错误.
2.我以为是opencl没装的问题,然后装了opencl.clinfo也有显示装上了.然而还是报错.
3.试过你们说的bazel clean --expunge,也是报错.

Error information / logs

Please include the full log and/or traceback here.

build shared lib for armeabi-v7a + cpu_gpu_dsp
ERROR: /home/long/soft/mace/mace/codegen/BUILD.bazel:26:1: no such target '@local_opencl_kernel_encrypt//:gen/encrypt_opencl_kernel.cc': target 'gen/encrypt_opencl_kernel.cc' not declared in package '' defined by /home/long/.cache/bazel/_bazel_long/ae50d3c8012672378180e1b246232fa2/external/local_opencl_kernel_encrypt/BUILD.bazel and referenced by '//mace/codegen:encrypt_opencl_kernel_gen'
ERROR: /home/long/soft/mace/mace/codegen/BUILD.bazel:26:1: no such target '@local_opencl_kernel_encrypt//:gen/encrypt_opencl_kernel.h': target 'gen/encrypt_opencl_kernel.h' not declared in package '' defined by /home/long/.cache/bazel/_bazel_long/ae50d3c8012672378180e1b246232fa2/external/local_opencl_kernel_encrypt/BUILD.bazel and referenced by '//mace/codegen:encrypt_opencl_kernel_gen'
ERROR: Analysis of target '//mace/libmace:libmace_dynamic' failed; build aborted: Loading failed
INFO: Elapsed time: 0.308s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

Additional context

Add any other context about the problem here, e.g., what you have modified about the code.

lu229 commented

@chenloveheimei try to clean the folder "/home/long/.cache/bazel/_bazel_long" and run again

@chenloveheimei try to clean the folder "/home/long/.cache/bazel/_bazel_long" and run again

long@long-Ubuntu:~/.cache/bazel/_bazel_long$ sudo rm -rf *

long@long-Ubuntu:/soft/mace-0.10.0$ pip install jinja2 --user
Collecting jinja2
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/27/24/4f35961e5c669e96f6559760042a55b9bcfcdb82b9bdb3c8753dbe042e35/Jinja2-2.11.1-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from jinja2)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b2/5f/23e0023be6bb885d00ffbefad2942bc51a620328ee910f64abe5a8d18dd1/MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: MarkupSafe, jinja2
Successfully installed MarkupSafe-1.1.1 jinja2-2.11.1
long@long-Ubuntu:
/soft/mace-0.10.0$ bash tools/build-standalone-lib.sh
build shared lib for armeabi-v7a + cpu_gpu_dsp
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
......
unknown-20200403
fatal: 不是一个 git 仓库:'/home/long/.cache/bazel/_bazel_long/d65372f8295f0fafab7cfaef781937e7/external/mace/.git'
Traceback (most recent call last):
File "/home/long/.cache/bazel/_bazel_long/d65372f8295f0fafab7cfaef781937e7/external/mace//mace/python/tools/encrypt_opencl_codegen.py", line 20, in
import jinja2
ImportError: No module named jinja2
ERROR: /home/long/soft/mace-0.10.0/mace/codegen/BUILD:33:1: no such target '@local_opencl_kernel_encrypt//:gen/encrypt_opencl_kernel': target 'gen/encrypt_opencl_kernel' not declared in package '' defined by /home/long/.cache/bazel/_bazel_long/d65372f8295f0fafab7cfaef781937e7/external/local_opencl_kernel_encrypt/BUILD and referenced by '//mace/codegen:encrypt_opencl_kernel_gen'
ERROR: Analysis of target '//mace/libmace:libmace_dynamic' failed; build aborted: Loading failed
INFO: Elapsed time: 11.198s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (26 packages loaded)

每次删除那个bazel_long文件夹,再次编译都会提示没有找到jinja2,然后错误还是一样

lu229 commented

@chenloveheimei 先按文档要求把jinja2装好,然后再删除'/home/long/.cache/bazel/_bazel_long/了重试

@chenloveheimei 先按文档要求把jinja2装好,然后再删除'/home/long/.cache/bazel/_bazel_long/了重试

找到问题了,我用pip install jinja2装了之后之后,总会出错.然后查百度,别人用的是sudo aptitude install python-jinja2这个去安装,或者apt哈.自己选择.就过了.谢谢

@chenloveheimei 先按文档要求把jinja2装好,然后再删除'/home/long/.cache/bazel/_bazel_long/了重试

ERROR: /home/long/soft/mace/mace/codegen/BUILD.bazel:59:1: C++ compilation of rule '//mace/codegen:generated_version' failed (Exit 1): clang failed: error executing command
(cd /home/long/.cache/bazel/bazel_long/ae50d3c8012672378180e1b246232fa2/execroot/mace &&
exec env -
LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:/usr/local/lib:/home/long/soft/qt5.13.2/5.13.2/gcc_64/lib:/usr/local/cuda-10.0/lib64:/usr/local/lib:/home/long/soft/qt5.13.2/5.13.2/gcc_64/lib:
PATH=/usr/local/cuda-10.0/bin:/usr/local/bin:/home/long/soft/qt5.13.2/5.13.2/gcc_64/bin:/home/long/soft/Android_Studio/android-ndk-r21:/home/long/bin:/home/long/.bazelrc:/usr/local/cuda-10.0/bin:/usr/local/bin:/home/long/soft/qt5.13.2/5.13.2/gcc_64/bin:/home/long/soft/Android_Studio/android-ndk-r16b:/home/long/bin:/home/long/.bazelrc:/home/long/.local/bin:/home/long/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD=/proc/self/cwd
external/androidndk/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang '-D__ANDROID_API
_=21' -isystemexternal/androidndk/ndk/sysroot/usr/include/arm-linux-androideabi -target armv7-none-linux-androideabi '-march=armv7-a' '-mfloat-abi=softfp' '-mfpu=vfpv3-d16' -gcc-toolchain external/androidndk/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -mthumb -Os -g -DNDEBUG -MD -MF bazel-out/armeabi-v7a-opt/bin/mace/codegen/_objs/generated_version/version.d '-frandom-seed=bazel-out/armeabi-v7a-opt/bin/mace/codegen/_objs/generated_version/version.o' -iquote . -iquote bazel-out/armeabi-v7a-opt/genfiles -iquote bazel-out/armeabi-v7a-opt/bin -iquote external/bazel_tools -iquote bazel-out/armeabi-v7a-opt/genfiles/external/bazel_tools -iquote bazel-out/armeabi-v7a-opt/bin/external/bazel_tools '-std=c++11' -fPIC -D_GLIBCXX_USE_C99_MATH_TR1 -DMACE_OBFUSCATE_LITERALS -DGEMMLOWP_USE_MACE_THREAD_POOL -DMACE_DEPTHWISE_U8_USE_MULTI_THREAD '-std=c++11' -fPIC -D_GLIBCXX_USE_C99_MATH_TR1 -DMACE_OBFUSCATE_LITERALS -DGEMMLOWP_USE_MACE_THREAD_POOL -DMACE_DEPTHWISE_U8_USE_MULTI_THREAD -Wall -Wno-mismatched-tags -Wno-missing-braces -Wall -Wno-mismatched-tags -Wno-missing-braces -O3 -ffunction-sections -fdata-sections -O3 -ffunction-sections -fdata-sections -Werror -Wextra -Wno-missing-field-initializers '--sysroot=external/androidndk/ndk/platforms/android-21/arch-arm' -isystem external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include -isystem external/androidndk/ndk/sources/cxx-stl/llvm-libc++abi/include -isystem external/androidndk/ndk/sources/android/support/include -isystemexternal/androidndk/ndk/sysroot/usr/include -c bazel-out/armeabi-v7a-opt/genfiles/mace/codegen/version/version.cc -o bazel-out/armeabi-v7a-opt/bin/mace/codegen/_objs/generated_version/version.o)

Use --sandbox_debug to see verbose messages from the sandbox
bazel-out/armeabi-v7a-opt/genfiles/mace/codegen/version/version.cc:21:65: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
const char *MaceVersion() { return "MACEVER-v0.12.0-0-ga610d50" + 8; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
bazel-out/armeabi-v7a-opt/genfiles/mace/codegen/version/version.cc:21:65: note: use array indexing to silence this warning
const char *MaceVersion() { return "MACEVER-v0.12.0-0-ga610d50" + 8; }
^
& [ ]

这是新的错误

lu229 commented

@chenloveheimei , 使用低于21的ndk版本,或者拉一下最新的mace代码,或者使用最新发布的v0.13.0,已经修复了这个问题。