JDAI-CV/dabnn

树莓派3B上编译失败

Closed this issue · 6 comments

w-zr commented

环境:

ubuntu@ubuntu:~$ uname -a
Linux ubuntu 4.15.0-1040-raspi2 #43-Ubuntu SMP PREEMPT Tue Jun 25 10:43:11 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
ubuntu@ubuntu:~$ lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               4
Model name:          Cortex-A53
Stepping:            r0p4
CPU max MHz:         1200.0000
CPU min MHz:         600.0000
BogoMIPS:            38.40
Flags:               fp asimd evtstrm crc32 cpuid
ubuntu@ubuntu:~$ cmake --version
cmake version 3.10.2
ubuntu@ubuntu:~$ gcc --version
gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ubuntu@ubuntu:~$ make --version
GNU Make 4.1
Built for aarch64-unknown-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

mkdir build_dabnn
cd build_dabnn
cmake ..
cmake --build .

时出现错误

cmake ..结果如下

-- The CXX compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMake Version: 3.10.2
-- No build type, set to Release
-- Build type: Release
-- Target architecture: aarch64
-- BNN_BUILD_MAIN_LIB: ON
-- Configureing glog...
-- The C compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for execinfo.h
-- Looking for execinfo.h - found
-- Looking for glob.h
-- Looking for glob.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for libunwind.h
-- Looking for libunwind.h - not found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for pwd.h
-- Looking for pwd.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/syscall.h
-- Looking for sys/syscall.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/utsname.h
-- Looking for sys/utsname.h - found
-- Looking for syscall.h
-- Looking for syscall.h - found
-- Looking for syslog.h
-- Looking for syslog.h - found
-- Looking for ucontext.h
-- Looking for ucontext.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for unwind.h
-- Looking for unwind.h - found
-- Looking for C++ include ext/hash_map
-- Looking for C++ include ext/hash_map - found
-- Looking for C++ include ext/hash_set
-- Looking for C++ include ext/hash_set - found
-- Looking for C++ include ext/slist
-- Looking for C++ include ext/slist - found
-- Looking for C++ include tr1/unordered_map
-- Looking for C++ include tr1/unordered_map - found
-- Looking for C++ include tr1/unordered_set
-- Looking for C++ include tr1/unordered_set - found
-- Looking for C++ include unordered_map
-- Looking for C++ include unordered_map - found
-- Looking for C++ include unordered_set
-- Looking for C++ include unordered_set - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned __int16
-- Check size of unsigned __int16 - failed
-- Check size of u_int16_t
-- Check size of u_int16_t - done
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Looking for dladdr
-- Looking for dladdr - not found
-- Looking for fcntl
-- Looking for fcntl - found
-- Looking for pread
-- Looking for pread - found
-- Looking for pwrite
-- Looking for pwrite - found
-- Looking for sigaction
-- Looking for sigaction - found
-- Looking for sigaltstack
-- Looking for sigaltstack - found
-- Performing Test HAVE_NO_DEPRECATED
-- Performing Test HAVE_NO_DEPRECATED - Success
-- Performing Test HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for get_static_proc_name in unwind
-- Looking for get_static_proc_name in unwind - not found
-- Looking for UnDecorateSymbolName in dbghelp
-- Looking for UnDecorateSymbolName in dbghelp - not found
-- Performing Test HAVE___ATTRIBUTE__
-- Performing Test HAVE___ATTRIBUTE__ - Success
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_DEFAULT
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_DEFAULT - Success
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_HIDDEN
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_HIDDEN - Success
-- Performing Test HAVE___BUILTIN_EXPECT
-- Performing Test HAVE___BUILTIN_EXPECT - Success
-- Performing Test HAVE___SYNC_VAL_COMPARE_AND_SWAP
-- Performing Test HAVE___SYNC_VAL_COMPARE_AND_SWAP - Success
-- Performing Test HAVE_RWLOCK
-- Performing Test HAVE_RWLOCK - Failed
-- Performing Test HAVE___DECLSPEC
-- Performing Test HAVE___DECLSPEC - Failed
-- Performing Test STL_NO_NAMESPACE
-- Performing Test STL_NO_NAMESPACE - Failed
-- Performing Test STL_STD_NAMESPACE
-- Performing Test STL_STD_NAMESPACE - Success
-- Performing Test HAVE_USING_OPERATOR
-- Performing Test HAVE_USING_OPERATOR - Success
-- Performing Test HAVE_NAMESPACES
-- Performing Test HAVE_NAMESPACES - Success
-- Performing Test HAVE_GCC_TLS
-- Performing Test HAVE_GCC_TLS - Success
-- Performing Test HAVE_MSVC_TLS
-- Performing Test HAVE_MSVC_TLS - Failed
-- Performing Test HAVE_CXX11_TLS
-- Performing Test HAVE_CXX11_TLS - Success
-- Performing Test HAVE_LOCALTIME_R
-- Performing Test HAVE_LOCALTIME_R - Success
-- Configuring gtest...
-- Found PythonInterp: /usr/bin/python (found version "2.7.15")
-- Found Git: /usr/bin/git (found version "2.17.1")
-- git Version: v1.4.0-f0901417
-- Version: 1.4.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_CXX_FLAG_NOSTDINCXX
-- Performing Test HAVE_CXX_FLAG_NOSTDINCXX - Success
libc++ header path must be manually specified using CMAKE_CXX_FLAGS
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/dabnn/build_dabnn

cmake --build .出错

[ 25%] Building CXX object dabnn/CMakeFiles/dabnn.dir/layers/BinConv.cpp.o
In file included from /home/ubuntu/dabnn/common/baseline.h:9:0,
                 from /home/ubuntu/dabnn/dabnn/layers/BinConv.cpp:5:
/home/ubuntu/dabnn/dabnn/bitpack.h: In function ‘void pack_mat_128_opt(const bnn::Mat&, bnn::Mat&)’:
/home/ubuntu/dabnn/dabnn/bitpack.h:217:5: error: ‘assert’ was not declared in this scope
     assert(!binary_mat.empty());
     ^~~~~~
/home/ubuntu/dabnn/dabnn/bitpack.h:217:5: note: suggested alternative: ‘iszero’
     assert(!binary_mat.empty());
     ^~~~~~
     iszero
/home/ubuntu/dabnn/dabnn/bitpack.h: In function ‘void pack_mat_128_baseline(const bnn::Mat&, bnn::Mat&)’:
/home/ubuntu/dabnn/dabnn/bitpack.h:225:5: error: ‘assert’ was not declared in this scope
     assert(!binary_mat.empty());
     ^~~~~~
/home/ubuntu/dabnn/dabnn/bitpack.h:225:5: note: suggested alternative: ‘iszero’
     assert(!binary_mat.empty());
     ^~~~~~
     iszero
dabnn/CMakeFiles/dabnn.dir/build.make:134: recipe for target 'dabnn/CMakeFiles/dabnn.dir/layers/BinConv.cpp.o' failed
make[2]: *** [dabnn/CMakeFiles/dabnn.dir/layers/BinConv.cpp.o] Error 1
CMakeFiles/Makefile2:252: recipe for target 'dabnn/CMakeFiles/dabnn.dir/all' failed
make[1]: *** [dabnn/CMakeFiles/dabnn.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

想请教应当如何修改?

Thanks for your report! I think it is easy to fix by replacing "assert" by "iszero". I will fix it soon.

w-zr commented

@daquexian 谢谢回复

我改过了,但是还是有问题。

[ 69%] Building CXX object third_party/benchmark/src/CMakeFiles/benchmark.dir/benchmark.cc.o
In file included from /home/ubuntu/dabnn/third_party/benchmark/src/benchmark.cc:15:0:
/home/ubuntu/dabnn/third_party/benchmark/include/benchmark/benchmark.h:174:10: fatal error: algorithm: No such file or directory
 #include <algorithm>
          ^~~~~~~~~~~
compilation terminated.
third_party/benchmark/src/CMakeFiles/benchmark.dir/build.make:62: recipe for target 'third_party/benchmark/src/CMakeFiles/benchmark.dir/benchmark.cc.o' failed
make[2]: *** [third_part/benchmark/src/CMakeFiles/benchmark.dir/benchmark.cc.o] Error 1
CMakeFiles/Makefile2:688: recipe for target 'third_party/benchmark/src/CMakeFiles/benchmark.dir/all' failed```
make[1]: *** [third_party/benchmark/src/CMakeFiles/benchmark.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

我觉得是找不到c++库,因为在cmake的输出中有一句:

libc++ header path must be manually specified using CMAKE_CXX_FLAGS

我尝试添加CMAKE_CXX_FLAGS设置,输出message(STATUS "cmake_cxx_flags ${CMAKE_CXX_FLAGS}")

-- cmake_cxx_flags -std=c++11 -march=armv8-a -fopenmp

依然找不到<algorithm>,但该文件确实存在。

ubuntu@ubuntu:/usr/include$ find /usr/include -name algorithm
/usr/include/c++/7/experimental/algorithm
/usr/include/c++/7/parallel/algorithm
/usr/include/c++/7/ext/algorithm
/usr/include/c++/7/algorithm
/usr/include/boost/fusion/algorithm
/usr/include/boost/compute/algorithm
/usr/include/boost/range/algorithm
/usr/include/boost/spirit/home/support/algorithm
/usr/include/boost/phoenix/stl/algorithm
/usr/include/boost/algorithm

我明天也看一下这个问题

w-zr commented

谢谢回复。

我用clang编译,解决了这个问题。
需要将assert改为iszero
安装clang后使用

mkdir build_dabnn
cd build_dabnn
env CC=clang CXX=clang++ cmake ..

另:
我想知道iszero()在哪里定义过。

谢谢回复。

我用clang编译,解决了这个问题。
需要将assert改为iszero
安装clang后使用

mkdir build_dabnn
cd build_dabnn
env CC=clang CXX=clang++ cmake ..

另:
我想知道iszero()在哪里定义过。

Congratulations! BTW, Could you please join the QQ group(1021964010, nndab)?

The issue has been solved by using clang instead of gcc. closing