在Chromebook上构建OpenCV时,链接stdlib.h时出错

时间:2018-11-13 21:08:51

标签: c++ opencv cmake configure google-chrome-os

配置似乎已成功运行...

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
-- The CXX compiler identification is GNU 7.3.0

-- The C compiler identification is GNU 7.3.0
-- Check for working CXX compiler: /usr/local/bin/c++
-- Check for working CXX compiler: /usr/local/bin/c++ -- works

(等)

然后当我运行make install时,

chronos@localhost ~/Downloads/python/opencv-3.4.3/build $ sudo make install
Scanning dependencies of target gen-pkgconfig
[  0%] Generate opencv.pc
[  0%] Built target gen-pkgconfig
Scanning dependencies of target libjpeg-turbo
[  0%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcapimin.c.o
[  0%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcapistd.c.o`

(etc)

`[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_print.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_read.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_strip.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_swab.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_thunder.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_tile.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_version.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_warning.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_write.c.o
[  5%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_zip.c.o
[  5%] Building CXX object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_stream.cxx.o
In file included from /usr/local/include/c++/7.3.0/ext/string_conversions.h:41:0,
                 from /usr/local/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/include/c++/7.3.0/string:52,
                 from /usr/local/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/include/c++/7.3.0/ios:42,
                 from /usr/local/include/c++/7.3.0/ostream:38,
                 from /usr/local/include/c++/7.3.0/iostream:39,
                 from /home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/libtiff/tiffio.hxx:34,
                 from /home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/libtiff/tif_stream.cxx:31:
/usr/local/include/c++/7.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
make[2]: *** [3rdparty/libtiff/CMakeFiles/libtiff.dir/build.make:557: 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_stream.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:387: 3rdparty/libtiff/CMakeFiles/libtiff.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

我曾尝试禁用第三方库,但后来又失败了,但针对其他组件的错误相同。

chronos@localhost ~/Downloads/python/opencv-3.4.3/build $ sudo make install
[  0%] Generate opencv.pc
[  0%] Built target gen-pkgconfig
[  9%] Built target libwebp
[ 11%] Built target libjasper
[ 13%] Built target libpng
[ 13%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/Half/half.cpp.o
In file included from /usr/local/include/c++/7.3.0/ext/string_conversions.h:41:0,
                 from /usr/local/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/include/c++/7.3.0/string:52,
                 from /usr/local/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/include/c++/7.3.0/ios:42,
                 from /usr/local/include/c++/7.3.0/ostream:38,
                 from /usr/local/include/c++/7.3.0/iostream:39,
                 from /home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Half/half.h:88,
                 from /home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Half/half.cpp:48:
/usr/local/include/c++/7.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.

版本和库看起来不错...

chronos@localhost ~/Downloads/python/opencv-3.4.3/build $ gcc --version
gcc (GCC) 7.3.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.

chronos@localhost ~/Downloads/python/opencv-3.4.3/build $ sudo find / -type f -name "*stdlib.h"
/usr/local/include/stdlib.h
/usr/local/include/bits/stdlib.h
/usr/local/include/c++/7.3.0/stdlib.h
/usr/local/include/c++/7.3.0/tr1/stdlib.h
/mnt/stateful_partition/dev_image/include/stdlib.h
/mnt/stateful_partition/dev_image/include/bits/stdlib.h
/mnt/stateful_partition/dev_image/include/c++/7.3.0/stdlib.h
/mnt/stateful_partition/dev_image/include/c++/7.3.0/tr1/stdlib.h

VERBOSE = 1,

make -f 3rdparty/openexr/CMakeFiles/IlmImf.dir/build.make 3rdparty/openexr/CMakeFiles/IlmImf.dir/build
make[2]: Entering directory '/home/chronos/user/Downloads/python/opencv-3.4.3/build'
[ 12%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/Half/half.cpp.o
cd /home/chronos/user/Downloads/python/opencv-3.4.3/build/3rdparty/openexr && /usr/local/bin/c++   -I/home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/IlmImf -I/home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Imath -I/home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/IlmThread -I/home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Iex -I/home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Half -I/home/chronos/user/Downloads/python/opencv-3.4.3/build/3rdparty/openexr -I/home/chronos/user/Downloads/python/opencv-3.4.3/build -isystem /usr/local/include  -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security   -Winit-self -Wpointer-arith  -Wsign-promo  -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment  -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -Wno-shadow -Wno-unused -Wno-sign-compare -Wno-undef -Wno-missing-declarations -Wno-uninitialized -Wno-switch -Wno-parentheses -Wno-array-bounds -Wno-extra -Wno-deprecated-declarations -Wno-misleading-indentation -Wno-deprecated -Wno-suggest-override -Wno-implicit-fallthrough -O3 -DNDEBUG  -DNDEBUG -fPIC   -o CMakeFiles/IlmImf.dir/Half/half.cpp.o -c /home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Half/half.cpp
In file included from /usr/local/include/c++/7.3.0/ext/string_conversions.h:41:0,
                 from /usr/local/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/include/c++/7.3.0/string:52,
                 from /usr/local/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/include/c++/7.3.0/ios:42,
                 from /usr/local/include/c++/7.3.0/ostream:38,
                 from /usr/local/include/c++/7.3.0/iostream:39,
                 from /home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Half/half.h:88,
                 from /home/chronos/user/Downloads/python/opencv-3.4.3/3rdparty/openexr/Half/half.cpp:48:
/usr/local/include/c++/7.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
make[2]: *** [3rdparty/openexr/CMakeFiles/IlmImf.dir/build.make:63: 3rdparty/openexr/CMakeFiles/IlmImf.dir/Half/half.cpp.o] Error 1
make[2]: Leaving directory '/home/chronos/user/Downloads/python/opencv-3.4.3/build'
make[1]: *** [CMakeFiles/Makefile2:442: 3rdparty/openexr/CMakeFiles/IlmImf.dir/all] Error 2
make[1]: Leaving directory '/home/chronos/user/Downloads/python/opencv-3.4.3/build'
make: *** [Makefile:163: all] Error 2

0 个答案:

没有答案