Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22113

pybind11 & dlib: CMake alternative for gcc command

$
0
0

I'm trying to build a *.whl python package from C++ source using pybind11 and dlib.

This GCC works great for me:

gcc -O3 -Wall -shared -I /home/user/dlib /home/user/dlib/dlib/all/source.cpp -lpthread -lX11 -ljpeg -lpng -DDLIB_JPEG_SUPPORT -DDLIB_PNG_SUPPORT -std=c++11 -fPIC `python3 -m pybind11 --includes` age_and_gender.cpp -o age_and_gender`python3-config --extension-suffix`

Now i'm trying to build *.whl python package from this example:https://github.com/pybind/cmake_example

My CMakeLists.txt file:

cmake_minimum_required(VERSION 2.8.12)if (CMAKE_VERSION VERSION_LESS 3.0)  PROJECT(example_app CXX)else()  cmake_policy(SET CMP0048 NEW)  PROJECT(example_app VERSION "1.0.0" LANGUAGES CXX)endif()add_compile_options(    -O3    -Wall    -shared    -fPIC    -lpthread    -lX11    -ljpeg    -lpng    -DDLIB_JPEG_SUPPORT    -DDLIB_PNG_SUPPORT    -std=c++11)add_executable(dlib_source "/home/user/dlib/dlib/all/source.cpp")include_directories("/home/user/dlib")add_subdirectory(pybind11)pybind11_add_module(example_app "src/main.cpp")

I think this is not the correct version of CMakeLists.txt. Help compose the correct CMakeLists.txt file given my "gcc" command that works.

When I try to import the *.whl package, I got this error:

from example_app import *Segmentation fault (core dumped)

Viewing all articles
Browse latest Browse all 22113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>