OpenVino Inference Engine C API not found - openvino

I installed the OpenVino on my Ubuntu 20.04 using the apt command.
sudo apt install intel-openvino-dev-ubuntu20-2021.3.394
I am trying to compile this simple program using gcc 1.c -linference_engine_c_api.
#include <stdio.h>
#include <c_api/ie_c_api.h>
int main() {
printf("C API Successfully Loaded!");
}
But the compilation fails with the following error:
1.c:2:10: fatal error: c_api/ie_c_api.h: No such file or directory
2 | #include <c_api/ie_c_api.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
How do I solve this?

You cannot directly call gcc for the 1.c file. You need to create a script to compile necessary dependencies (like CMake).
For example, in \opt\intel\openvino_2021.3.394\deployment_tools\inference_engine\samples\c there is build_sample.h script. This script is used to perform all compilation and it uses CMake. Same goes for gcc, to run the inference lib you need to compile the script first before calling ie_c_api.h. 1.c file cannot be run directly when gcc compiler does not support the operation.
Please go to Integrate the Inference Engine with Your Application - OpenVINO™ Toolkit (openvinotoolkit.org) for reference.

Related

Included standard libraries not found by ARM cross-compiler

I'm trying to do cross-compilation for an ARM a8 processor. I'm moving the code base to a new system, and therefore it should be installed using the same compiler and makefiles as the original system.
I know that I'm using a arm-linux-gnueabihf-gcc compiler.
I've installed the following packages:
> sudo apt install gcc-arm-linux-gnueabihf
> sudo apt install binutils-arm-linux-gnueabi
When I compile the following code block:
#include <stdio.h>
// filename: simple.c
int main(void)
{
printf("I'm printing!\n");
return;
}
with this command:
> arm-linux-gnueabihf-gcc simple.c
I expect it to compile at this step. I instead get:
In file included from simple.c:1:0:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Any help would be appreciated! Thank you!
I think what you are missing is the multilib packets, if I'm right, this should do the trick for you.
sudo apt install gcc-multilib g++-multilib

Error trying to compile simple "hello world" with OpenMPI on OpenSUSE

I am learning MPA using OpenMPI on my classes, but I cannot seem to make it work on my laptop using OpenSUSE.
I got OpenMPI from https://software.opensuse.org/package/openmpi and when trying to compile using:
mpicc hello.c -o hello
I get the following error msg saying that it cannot find mpi.h:
hello.c:3:17: fatal error: mpi.h: No such file or directory
#include "mpi.h"
^
compilation terminated
Is there something that I am missing? If so, what exactly do I need to do to make this work out?
You also need to install openmpi-devel package:
zypper install openmpi-devel

Installing SDL2 on Linux

I try to run simple test.cpp from Twinklebar SDL tutorial, I get this error:
test.cpp:2:10: fatal error: 'SDL2/SDL.h' file not found
So I look up the sdl development package in Ubuntu/Mint:
aptitude search sdl | grep 2
All I can find is this:
libsdl1.2-dev
Does this mean my only option is to install from sources?
It depends which Ubuntu version you are running but yes, there is a libsdl2 package for Ubuntu: http://packages.ubuntu.com/search?keywords=sdl2
The package you want is called libsdl2-dev.
Also, about the #include <SDL/SDL.h> line, it seems the recommended way doing it is by adjusting your compiler flags to add SDL's include pah and use #include "SDL.h". See https://forums.libsdl.org/viewtopic.php?t=5997 for more details on that.

Can't Access sys/socket.h using Cygwin

I need to compile C/C++ pthread and socket code in windows 8 where I've installed MicGW GCC and G++ 4.7.
When I compile my test code using g++ test.cpp -o test
Code is:
#include<iostream>
#include<sys/socket.h>
#include<sys/types.h>
using namespace std;
int main() {
cout<<"Got Socket";
}
This gives error fatal error: sys/socket.h not found and the
same occur with types.h
The error I found is that cygwin is using MicGW GCC and g++ but I want it to use its own instead of MinGW's so that I can include Linux libraries.
I have not been able to reproduce your problem on my Cygwin.
Are the headers present in /usr/include/sys?
Search the sys folder in [installed directory]/usr/include if the socket.h was not there download one Copy it there manually.
don't afraid of manual works ;-)

Setting up G++ or ICC for mpi.h on Ubuntu

I have never done any major programing outside of VS08.
I am trying to compile a program called LAMMPS with either of the two relevant make files. One calls g++ and the other calls icc (Intel's compiler).
icc produces this error:
icc -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M write_restart.cpp > write_restart.d
write_restart.cpp(15): catastrophic error: cannot open source file "mpi.h"
#include "mpi.h"
and g++ throws this error
g++ -g -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M verlet.cpp > verlet.d
pointers.h:25: fatal error: mpi.h: No such file or directory
compilation terminated.
The mpi.h file is located in /usr/lib/openmpi/include
It is my understanding that I need to set that $PATH variable which reads
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/intel/bin:/usr/lib/openmpi/include:
and $LD_LIBRARY_PATH which currently reads
/usr/lib/openmpi/lib:
SO, how does one include the mpi.h file? So that either icc or g++ find it?
mpi.h is a header for MPI library. That would be included if you use mpic++ MPI compiler wrapper instead of g++ in your makefile. mpic++ will call the appropriate compiler. From what you describe you have openmpi package installed on your ubuntu machine.
For more info, you need to consult the manual, e.g.
http://lammps.sandia.gov/doc/Section_start.html#2_2 (for LAMMPS)
and perhaps you need to see openmpi manual as to how to set up additional compiler. Not sure if this can be done after openmpi itself has been built. By default I think in Ubuntu openmpi compiler wrappers would only call g++. CMIIW.
Okay, so I got it to work with g++ when setting up cc as "mpic++.mpich2" instead of "mpic++"
you can try compile using openmpi make file in /src/MAKE
make openmpi
in my case, this option was successful

Resources