链接 OpenCV 时对 SGILL 进行编程
Program SGILL's when linking OpenCV
我知道这个问题与其他问题类似,但 none 似乎解决了我的问题。
症状
- 使用 gdb 简单构建和 运行
gdb_test
。
- 计划
SIGILL
的:
~/projects/gdb_test/build> gdb gdb_test
GNU gdb (GDB; openSUSE Tumbleweed) 8.3.1
(...)
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gdb_test...
(gdb) r
Starting program: /home/jaques/projects/gdb_test/build/gdb_test
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.31-5.9.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffebae8700 (LWP 1210)]
[New Thread 0x7fffeb2e7700 (LWP 1211)]
[New Thread 0x7fffe6ae6700 (LWP 1212)]
Thread 1 "gdb_test" received signal SIGILL, Illegal instruction.
0x00007ffff7d90617 in ?? () from /usr/lib64/libopencv_gapi.so.4.2
(gdb)
示例项目:
"main.cpp"
#include <iostream>
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
return 0;
}
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
project(gdb_test)
find_package( OpenCV REQUIRED ) # Works fine if this line is removed.
add_executable(gdb_test main.cpp)
install(TARGETS gdb_test RUNTIME DESTINATION bin)
环境
- Linux box 运行正在更新 OpenSuse:
NAME="openSUSE Tumbleweed"
VERSION="20200622"
- G++ 10.1.1
- GDB 8.3.1
- opencv-devel 4.2.0-4.1
- 拱门x86_64
- 未剥离,调试信息可执行:
gdb_test/build> file gdb_test gdb_test: ELF 64-bit LSB executable,
x86-64, version 1 (SYSV), dynamically linked, interpreter
/lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=28f8c835686d92c15cb8b0cfb201c5f45a8a89c7, for GNU/Linux
3.2.0, with debug_info, not stripped
有什么问题吗?
如何解决?
有什么想法吗?
谢谢。
根据您的评论:
I downgraded from opencv-devel-4.2.0-4.1.x86_64 to opencv3-3.4.9-2.4.x86_64 and it is not crashing anymore..
我只能断定包裹坏了。
如果您确实需要 OpenCV 4,我建议您从源代码构建。
我知道这个问题与其他问题类似,但 none 似乎解决了我的问题。
症状
- 使用 gdb 简单构建和 运行
gdb_test
。 - 计划
SIGILL
的:
~/projects/gdb_test/build> gdb gdb_test
GNU gdb (GDB; openSUSE Tumbleweed) 8.3.1
(...)
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gdb_test...
(gdb) r
Starting program: /home/jaques/projects/gdb_test/build/gdb_test
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.31-5.9.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffebae8700 (LWP 1210)]
[New Thread 0x7fffeb2e7700 (LWP 1211)]
[New Thread 0x7fffe6ae6700 (LWP 1212)]
Thread 1 "gdb_test" received signal SIGILL, Illegal instruction.
0x00007ffff7d90617 in ?? () from /usr/lib64/libopencv_gapi.so.4.2
(gdb)
示例项目:
"main.cpp"
#include <iostream>
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
return 0;
}
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
project(gdb_test)
find_package( OpenCV REQUIRED ) # Works fine if this line is removed.
add_executable(gdb_test main.cpp)
install(TARGETS gdb_test RUNTIME DESTINATION bin)
环境
- Linux box 运行正在更新 OpenSuse:
NAME="openSUSE Tumbleweed" VERSION="20200622"
- G++ 10.1.1
- GDB 8.3.1
- opencv-devel 4.2.0-4.1
- 拱门x86_64
- 未剥离,调试信息可执行:
gdb_test/build> file gdb_test gdb_test: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=28f8c835686d92c15cb8b0cfb201c5f45a8a89c7, for GNU/Linux 3.2.0, with debug_info, not stripped
有什么问题吗?
如何解决?
有什么想法吗?
谢谢。
根据您的评论:
I downgraded from opencv-devel-4.2.0-4.1.x86_64 to opencv3-3.4.9-2.4.x86_64 and it is not crashing anymore..
我只能断定包裹坏了。
如果您确实需要 OpenCV 4,我建议您从源代码构建。