OpenCV.js安装错误:

时间:2018-08-28 06:39:03

标签: javascript opencv protobuf.js

我正在尝试安装opencv.js,并且遵循以下说明: OpenCV Build

我已按照其说明安装了emsdk,并从Github克隆了OpenCV。

python ./platforms/js/build_js.py build_js

此命令不起作用。它引发此错误:

ERROR:root:compiler frontend failed to generate LLVM bitcode, halting

您可以找到所有错误:

=====
===== Building OpenCV.js in asm.js
=====
Executing: ['make', '-j', '8', 'opencv.js']
Scanning dependencies of target zlib
Scanning dependencies of target libprotobuf
[  0%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzclose.c.o
[  0%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/crc32.c.o
[  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/adler32.c.o
[  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/deflate.c.o
[  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/compress.c.o
[  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzread.c.o
[  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzlib.c.o
[  3%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.o
[  4%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arenastring.cc.o
[  4%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzwrite.c.o
[  4%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inflate.c.o
[  5%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/infback.c.o
[  5%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/extension_set.cc.o
[  5%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inftrees.c.o
[  5%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inffast.c.o
[  6%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/trees.c.o
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:31:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.h:54:
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomic_sequence_num.h:44:12: error: 
      no matching function for call to 'NoBarrier_AtomicIncrement'
    return NoBarrier_AtomicIncrement(&word_, 1) - 1;
           ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:51:17: note: 
      candidate function not viable: no known conversion from
      'google::protobuf::internal::AtomicWord *' (aka 'long *') to 'volatile
      google::protobuf::internal::Atomic32 *' (aka 'volatile int *') for 1st
      argument
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
                ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:154:81: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'google::protobuf::internal::AtomicWord *'
      (aka 'long *')
  ...&blocks_));
     ^~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:93:57: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
                                                        ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:155:45: error: 
      cannot initialize a parameter of type 'volatile
      google::protobuf::internal::Atomic32 *' (aka 'volatile int *') with an
      rvalue of type 'google::protobuf::internal::AtomicWord *' (aka 'long *')
  google::protobuf::internal::Release_Store(&blocks_, reinterpret_cast<g...
                                            ^~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:89:46: note: 
      passing argument to parameter 'ptr' here
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
                                             ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:158:47: error: 
      cannot initialize a parameter of type 'volatile
      google::protobuf::internal::Atomic32 *' (aka 'volatile int *') with an
      rvalue of type 'google::protobuf::internal::AtomicWord *' (aka 'long *')
    google::protobuf::internal::Release_Store(&hint_, reinterpret_cast<g...
                                              ^~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:89:46: note: 
      passing argument to parameter 'ptr' here
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
                                             ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:167:60: error: 
      cannot initialize a parameter of type 'volatile
      google::protobuf::internal::Atomic32 *' (aka 'volatile int *') with an
      rvalue of type 'google::protobuf::internal::AtomicWord *' (aka 'long *')
      google::protobuf::internal::NoBarrier_AtomicExchange(&cleanup_list_,
                                                           ^~~~~~~~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:46:61: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
                                                            ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:196:80: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'google::protobuf::internal::AtomicWord *'
      (aka 'long *')
  ...reinterpret_cast<Block*>(google::protobuf::internal::Acquire_Load(&hint_));
                                                                       ^~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:97:55: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
                                                      ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:218:49: error: 
      cannot initialize a parameter of type 'volatile
      google::protobuf::internal::Atomic32 *' (aka 'volatile int *') with an
      rvalue of type 'google::protobuf::internal::AtomicWord *' (aka 'long *')
    google::protobuf::internal::NoBarrier_Store(&hint_, reinterpret_cast...
                                                ^~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:77:48: note: 
      passing argument to parameter 'ptr' here
inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
                                               ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:229:82: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'const google::protobuf::internal::AtomicWord *'
      (aka 'const long *')
  ...&blocks_));
     ^~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:93:57: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
                                                        ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:239:82: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'const google::protobuf::internal::AtomicWord *'
      (aka 'const long *')
  ...&blocks_));
     ^~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:93:57: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
                                                        ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:251:82: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'const google::protobuf::internal::AtomicWord *'
      (aka 'const long *')
  ...&blocks_));
     ^~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:93:57: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
                                                        ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:262:82: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'google::protobuf::internal::AtomicWord *'
      (aka 'long *')
  ...&blocks_));
     ^~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:93:57: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
                                                        ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:297:74: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'google::protobuf::internal::AtomicWord *'
      (aka 'long *')
  ...&cleanup_list_));
     ^~~~~~~~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:93:57: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
                                                        ^
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.cc:308:80: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an rvalue of type 'google::protobuf::internal::AtomicWord *'
      (aka 'long *')
  ...&blocks_));
     ^~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:97:55: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
                                                      ^
13 errors generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
[  6%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/uncompr.c.o
3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build.make:63: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.o' failed
make[3]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.o] Error 1
make[3]: *** Waiting for unfinished jobs....
[  6%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/zutil.c.o
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arenastring.cc:34:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arenastring.h:39:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.h:54:
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomic_sequence_num.h:44:12: error: 
      no matching function for call to 'NoBarrier_AtomicIncrement'
    return NoBarrier_AtomicIncrement(&word_, 1) - 1;
           ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:51:17: note: 
      candidate function not viable: no known conversion from
      'google::protobuf::internal::AtomicWord *' (aka 'long *') to 'volatile
      google::protobuf::internal::Atomic32 *' (aka 'volatile int *') for 1st
      argument
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
                ^
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arenastring.cc:34:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arenastring.h:40:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/generated_message_util.h:45:
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/once.h:126:30: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an lvalue of type 'google::protobuf::ProtobufOnceType *' (aka 'long *')
  if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
                             ^~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:97:55: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
                                                      ^
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arenastring.cc:34:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arenastring.h:40:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/generated_message_util.h:45:
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/once.h:135:30: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an lvalue of type 'google::protobuf::ProtobufOnceType *' (aka 'long *')
  if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
                             ^~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:97:55: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
                                                      ^
3 errors generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build.make:88: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arenastring.cc.o' failed
make[3]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arenastring.cc.o] Error 1
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/extension_set.cc:37:
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/once.h:126:30: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an lvalue of type 'google::protobuf::ProtobufOnceType *' (aka 'long *')
  if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
                             ^~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:97:55: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
                                                      ^
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/extension_set.cc:37:
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/once.h:135:30: error: 
      cannot initialize a parameter of type 'const volatile
      google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with
      an lvalue of type 'google::protobuf::ProtobufOnceType *' (aka 'long *')
  if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
                             ^~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:97:55: note: 
      passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
                                                      ^
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/extension_set.cc:38:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/extension_set.h:51:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/repeated_field.h:60:
In file included from /home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/arena.h:54:
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomic_sequence_num.h:44:12: error: 
      no matching function for call to 'NoBarrier_AtomicIncrement'
    return NoBarrier_AtomicIncrement(&word_, 1) - 1;
           ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/tugba/opencv/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h:51:17: note: 
      candidate function not viable: no known conversion from
      'google::protobuf::internal::AtomicWord *' (aka 'long *') to 'volatile
      google::protobuf::internal::Atomic32 *' (aka 'volatile int *') for 1st
      argument
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
                ^
[  7%] Linking C static library ../lib/libzlib.a
3 errors generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build.make:113: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/extension_set.cc.o' failed
make[3]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/extension_set.cc.o] Error 1
CMakeFiles/Makefile2:706: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all' failed
make[2]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[  7%] Built target zlib
CMakeFiles/Makefile2:1517: recipe for target 'modules/js/CMakeFiles/opencv.js.dir/rule' failed
make[1]: *** [modules/js/CMakeFiles/opencv.js.dir/rule] Error 2
Makefile:351: recipe for target 'opencv.js' failed
make: *** [opencv.js] Error 2
Traceback (most recent call last):
  File "./platforms/js/build_js.py", line 247, in <module>
    builder.build_opencvjs()
  File "./platforms/js/build_js.py", line 182, in build_opencvjs
    execute(["make", "-j", str(multiprocessing.cpu_count()), "opencv.js"])
  File "./platforms/js/build_js.py", line 19, in execute
    raise Fail("Child returned: %s" % retcode)
__main__.Fail: Child returned: 2

还有使用OpenCV和Javascript的另一种方法吗?

1 个答案:

答案 0 :(得分:0)

可以使用npmyarn代替OpenCV来安装Javascript

npm install opencv.js

yarn add opencv.js