Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software using OpenCV doesn't work. #1194

Closed
zingmars opened this issue Oct 11, 2016 · 4 comments
Closed

Software using OpenCV doesn't work. #1194

zingmars opened this issue Oct 11, 2016 · 4 comments

Comments

@zingmars
Copy link

zingmars commented Oct 11, 2016

Please use the following bug reporting template to help produce actionable and reproducible issues. Please try to ensure that the reproduction is minimal so that the team can go through more bugs!

  • A brief description

When trying to run any program compiled against opencv it will fail to run with an error message.

  • Expected results

Program executes correctly.

  • Actual results (with terminal output if applicable)

./opencv_test: error while loading shared libraries: libopencv_imgproc.so.3.1: cannot enable executable stack as shared object requires: Invalid argument

  • Your Windows build number

Microsoft Windows [Version 10.0.14393]

  • Steps / All commands required to reproduce the error from a brand new installation
  1. Download and install opencv
    git clone https://github.com/opencv/opencv.git
    git clone https://github.com/opencv/opencv_contrib.git
    cd opencv
    mkdir bin
    cd bin
    cmake -DCMAKE_BUILD_TYPE=Release -DOPENCV_EXTRA_MODULES_PATH="../../opencv_contrib/modules" -DBUILD_TESTS=NO -DBUILD_PERF_TESTS=NO ..
    make -j$(nproc)
    sudo make install
    sudo ldconfig

  2. Compile and run any program that requires opencv. To recreate the examples from OpenCV's website can be used. (I.e. http://docs.opencv.org/3.1.0/d0/d2a/contours2_8cpp-example.html)
    `g++ -o opencv_test contours2.cpppkg-config opencv --cflags --libs

./opencv_test

  • Strace of the failing command

execve("./opencv_test", ["./opencv_test"], [/* 19 vars */]) = 0
brk(0) = 0x1998000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fccacd30000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("tls/x86_64/libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/x86_64/libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib/tls/x86_64", 0x7fffce0e2f40) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib/tls", 0x7fffce0e2f40) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/x86_64/libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib/x86_64", 0x7fffce0e2f40) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libopencv_highgui.so.3.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320@\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=63635, ...}) = 0
mmap(NULL, 2144008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fccac7f0000
mprotect(0x7fccac7fb000, 2093056, PROT_NONE) = 0
mmap(0x7fccac9fa000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7fccac9fa000
close(3) = 0
open("tls/x86_64/libopencv_imgproc.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libopencv_imgproc.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libopencv_imgproc.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libopencv_imgproc.so.3.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libopencv_imgproc.so.3.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \222\r\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=24103817, ...}) = 0
mmap(NULL, 25281328, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fccaafd0000
mprotect(0x7fccac52a000, 2093056, PROT_NONE) = 0
mmap(0x7fccac729000, 184320, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1559000) = 0x7fccac729000
mmap(0x7fccac756000, 615216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fccac756000
mprotect(0x7fffce0e3000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) = -1 EINVAL (Invalid argument)
close(3) = 0
writev(2, [{"./opencv_test", 13}, {": ", 2}, {"error while loading shared libra"..., 36}, {": ", 2}, {"libopencv_imgproc.so.3.1", 24}, {": ", 2}, {"cannot enable executable stack a"..., 56}, {": ", 2}, {"Invalid argument", 16}, {"\n", 1}], 10./opencv_test: error while loading shared libraries: libopencv_imgproc.so.3.1: cannot enable executable stack as shared object requires: Invalid argument
) = 154
exit_group(127) = ?
+++ exited with 127 +++

  • Required packages and commands to install

OpenCV, g++, git, cmake, make

  • Notes

Also seems to be reported here, although not by me.

@imkow
Copy link

imkow commented Oct 11, 2016

Hi,
Your build is 14393, can you test on latest insider b14942, as it got a lot of fix since 14393.
If I got enough free disk space, I'd test it.

Jack

@benhillis
Copy link
Member

This is the same issue as #286.

@thorsteneb
Copy link

@zingmars Are you familiar with the OpenCV source? I looked into it a bit yesterday and I'm stumped. I see the shared libraries flagged for execstack (use scanelf -qeR . in the cmake build directory), but I don't see any .o files that are. Nor do I have system libraries (scanelf -lqe) such as zlib that might cause it. Which leaves linker options, maybe?
The right way to solve this is upstream. OpenCV should build without flagging shared libraries for execstack. This will solve three issues: Remove a security vulnerability, solve SELinux support, solve WSL support.

@tara-raj
Copy link

Closing as this is marked as duplicated. Please refer to #286 for future comments/reports on this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants