pybind11.h: No such file or directory - c

I am trying to compile Deepstream 6.0 Python bindings. My guess it that the issue not related to Deepstream, but to general C/C++ compiling issues:
sudo apt install -y git python-dev python3 python3-pip python3.6-dev python3.8-dev cmake g++ build-essential \
libglib2.0-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
sudo apt-get -y install pybind11-dev
git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git
cd deepstream_python_apps
git checkout v1.1.0
cd bindings
mkdir build
cd build
cmake ..
make
I encounter the error:
ubuntu#ip-x-x-x-x:~/pycharm/libs/deepstream_python_apps/bindings/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/pycharm/libs/deepstream_python_apps/bindings/build
ubuntu#ip-x-x-x-x:~/pycharm/libs/deepstream_python_apps/bindings/build$ make
Scanning dependencies of target pyds
[ 6%] Building CXX object CMakeFiles/pyds.dir/src/pyds.cpp.o
In file included from /home/ubuntu/pycharm/libs/deepstream_python_apps/bindings/include/bind/bindanalyticsmeta.hpp:23:0,
from /home/ubuntu/pycharm/libs/deepstream_python_apps/bindings/src/pyds.cpp:19:
/home/ubuntu/pycharm/libs/deepstream_python_apps/bindings/include/pyds.hpp:22:10: fatal error: pybind11.h: No such file or directory
#include <pybind11.h>
^~~~~~~~~~~~
compilation terminated.
CMakeFiles/pyds.dir/build.make:62: recipe for target 'CMakeFiles/pyds.dir/src/pyds.cpp.o' failed
make[2]: *** [CMakeFiles/pyds.dir/src/pyds.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pyds.dir/all' failed
make[1]: *** [CMakeFiles/pyds.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
If I look for pybind11.h I can find it in:
/usr/include/pybind11/pybind11.h

you need to install the gst-python dependency as stated in the README.
make sure to pull all the git submodules beforehand, otherwise the 3rdparty/gst-python folder might be empty for you.

Related

CMake on GitHub Action with Googletest

Introduction
Currently, I'm working on a C project with CMake and Googletest.
My project is on a GitHub repo.
Why I execute the test on my local machine I use this command: cmake -B ./build -DCMAKE_BUILD_TYPE=Release. It works.
#MathieuSoysal ➜ /workspaces/Piscine-42 (main) $cmake -B ./build -DCMAKE_BUILD_TYPE=Release
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/Piscine-42/build
Problem
And I'm trying to execute it on GitHub Actions. But it does not work.
The Log
Run cmake -B /home/runner/work/Piscine-42/Piscine-42/build -DCMAKE_BUILD_TYPE=Release
cmake -B /home/runner/work/Piscine-42/Piscine-42/build -DCMAKE_BUILD_TYPE=Release
shell: /usr/bin/bash -e {0}
env:
BUILD_TYPE: Release
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:9 (add_subdirectory):
The source directory
/home/runner/work/Piscine-42/Piscine-42/googletest
does not contain a CMakeLists.txt file.
-- Configuring incomplete, errors occurred!
See also "/home/runner/work/Piscine-42/Piscine-42/build/CMakeFiles/CMakeOutput.log".
Error: Process completed with exit code 1.
Question
Does someone know how we can execute this command cmake -B /home/runner/work/Piscine-42/Piscine-42/build -DCMAKE_BUILD_TYPE=Release on GitHub Actions with a linked GitHub repo?

Error with CLion (The C compiler identification is unknown) MacOS Ventura

Today I updated my laptop to Mac OS Ventura and CLion with it. When I opened the project I saw this :
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/Applications/CLion.app/Contents/bin/ninja/mac/ninja -G Ninja -S /Users/nikita/Documents/CLion/untitled -B /Users/nikita/Documents/CLion/untitled/cmake-build-debug
-- The C compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/Applications/CLion.app/Contents/bin/ninja/mac/ninja cmTC_6cb20 && [1/2] Building C object CMakeFiles/cmTC_6cb20.dir/testCCompiler.c.o
FAILED: CMakeFiles/cmTC_6cb20.dir/testCCompiler.c.o
/usr/bin/cc -arch arm64 -o CMakeFiles/cmTC_6cb20.dir/testCCompiler.c.o -c /Users/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeError.log".
[Finished]
**Guys, how can I fix it ? **
I don't know how to do this.
I am a beginner in programming with C (
I faced the same issue and it was solved by installing xcode-select and reinstalling cmake with the following commands in the terminal:
xcode-select --install
brew reinstall cmake

Making local C package widely available

I'm using this C package for numerical integration in several implementations. So far, what I do is copy the associated folder (after downloading the cubature-master in Github) into the same directory of my scripts, include the package as
#include "cubature-master/cubature.h"
and add the corresponding flag when compiling my code. I'm doing all of this locally on my Mac arm64. As suggested in the comments, I compiled the package via CMake and I got these results:
Sebastians-Macbook-Pro:cubature-master surrutiaquir$ cd build Sebastians-Macbook-Pro:build surrutiaquir$ cmake ..
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/surrutiaquir/Software/cubature-master/build Sebastians-Macbook-Pro:build surrutiaquir$ make Scanning dependencies of target cubature [ 33%] Building C object CMakeFiles/cubature.dir/hcubature.c.o [ 66%] Building C object CMakeFiles/cubature.dir/pcubature.c.o [100%] Linking C shared library libcubature.dylib ld: warning: ignoring file CMakeFiles/cubature.dir/pcubature.c.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64 ld: warning: ignoring file CMakeFiles/cubature.dir/hcubature.c.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64 [100%] Built target cubature Sebastians-Macbook-Pro:build surrutiaquir$ make install [100%] Built target cubature Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libcubature.dylib
-- Installing: /usr/local/include/cubature.h
I would like to have the package in a single location but I'm not skilled enough to reference that path during the compiling process. My goal is to create a Makefile to deal with all of this. Any guidance would be highly appreciated.

I installed vcpkg-master for visual studio code and install their package and after that only my Clion stopped working

/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/kushthakker/CLionProjects/dog_age
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/kushthakker/CLionProjects/dog_age/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_dced2/fast && xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

How to build libonion?

I have tried to build onionlib from sources. I cannot use git on my Debian 8 workstation so I downloaded zip from the github. CMake fails at main CMakeLists.txt:28, 29, 30, etc. with error string sub-command REGEX, mode REPLACE needs at least 6 arguments total to command.
It seems that ONION_VERSION variable is empty. Tried to do git clone on other PC and then copied the whole folder including .git to the target workstation with the same result. Tried to execute .git-version-gen and got output '0.8.123.f6b9d' I also get an empty -- Onion version is during compilation so the version is undefined.
npa#NPA:~/workspace/TMOIP/onion$ sudo sh ./git-version-gen
0.8.123.f6b9d
npa#NPA:~/workspace/TMOIP/onion$ mkdir build
npa#NPA:~/workspace/TMOIP/onion$ cd build
npa#NPA:~/workspace/TMOIP/onion/build$ cmake ..
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:28 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.
CMake Error at CMakeLists.txt:29 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.
CMake Error at CMakeLists.txt:30 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.
-- Onion version is
-- Using epoll as poller
-- Could NOT find GnuTLS (missing: GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
-- Could NOT find GCrypt, try to set the path to GCrypt root folder in the system variable GCRYPT_ROOT_DIR (missing: GCRYPT_INCLUDE_DIR GCRYPT_LIBRARIES)
Gnutls or gcrypt not found. SSL support is not compiled in.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
SQLite session support is not compiled in.
-- hiredis client library not found.
Hiredis not found. Redis session support is not compiled in.
-- pthreads found. Threading support is compiled in.
-- Found LibXml2: /usr/lib/i386-linux-gnu/libxml2.so (found version "2.9.1")
-- WebDAV support is compiled in.
No PAM support.
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
libpng not found. No png support.
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
libjpeg not found. No jpeg support.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found GC library: BOEHM_GC_LIBRARIES-NOTFOUND
-- Could NOT find Boehm_GC (missing: BOEHM_GC_LIBRARIES BOEHM_GC_INCLUDE_DIR)
-- NOT compiling Boehm GC examples
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
curl not found. Some examples wil not be built.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find SYSTEMD (missing: SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES)
Systemd support is not compiled in. Install libsystemd-dev | systemd-devel
md2man-roff NOT found, NOT compiling manpages. Install it via 'gem install md2man'
-- Prepared for packaging
-- Compiling WebDAV support
-- Found include files
CMake Error at src/onion/CMakeLists.txt:107 (SET_TARGET_PROPERTIES):
set_target_properties called with incorrect number of arguments.
-- Found include files onion.hpp;dict.hpp;request.hpp;response.hpp;url.hpp;handler.hpp;extrahandlers.hpp;shortcuts.hpp;exceptions.hpp;listen_point.hpp;http.hpp;https.hpp;mime.hpp
CMake Error at src/bindings/cpp/CMakeLists.txt:10 (SET_TARGET_PROPERTIES):
set_target_properties called with incorrect number of arguments.
CMake Warning at examples/CMakeLists.txt:9 (message):
Oterm without authentication support! May be very unsecure.
CMake Warning at examples/CMakeLists.txt:14 (message):
Some examples are disabled as you dont have PAM: otop, basic, fileserver.
-- jQuery at /usr/share/javascript/jquery/jquery.min.js
-- Using system provided jquery for oterm
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Warning at examples/CMakeLists.txt:37 (message):
Some examples are disabled as you dont have libpng: mandelbrot
-- Configuring incomplete, errors occurred!
See also "/home/npa/workspace/TMOIP/onion/build/CMakeFiles/CMakeOutput.log".
I figured out that the problem was in CMake call of git-version-gen script. I was able to run it manually but it was not running correctly from the CMake because of some permissions setup of my workstation. The problem gone after it was corrected.

Resources