简体   繁体   中英

libgtk error when trying to import pybind opencv module

I am trying to compile some C++ Code with OpenCv and Pybind with this header: https://github.com/patrikhuber/eos/blob/v0.12.2/python/pybind11_opencv.hpp

This has worked for me before, so I don't think the header file is the Problem.

I can compile the code without problems, but when i try to import the created file to Python I get the following error:

ImportError: /usr/lib/libgtk-3.so.0: undefined symbol: g_mount_operation_set_is_tcrypt_hidden_volume

Here is the C++ Code:

#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>

#include <pybind11/pybind11.h>
#include "pybind11_opencv.hpp"

using namespace std;

namespace py = pybind11;

cv::Mat func(cv::Mat Image1,cv::Mat Image2)
{
    return Image1;
}


PYBIND11_MODULE(pybind_module, m) 
{
    m.doc() = "Text";
    m.def("func", &func, "Function",
    py::arg("Image1"),
    py::arg("Image2"));
}


I am guessing it's a problem with my setup (arch linux) since I got something similar working before and not even this minimal example is working.

I was able to solve the problem myself using the following compiler settings.

c++ -msse4 -O3 -Wall -shared -std=c++11 -fPIC -lopencv_imgcodecs `python3 -m pybind11 --includes` main.cpp -o executable`python3-config --extension-suffix` /usr/local/include/ -L/usr/local/lib/ -march=native

I guess there was a mistake in the previous compilation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM