Error including Kernel Header files in C, compiled using clang - bpf

I am writing an eBPF Code.
I need to use the function bpf_obj_pin, declared in kernel files:
tools/lib/bpf/bpf.c
tools/lib/bpf/bpf.h
Refer from here: https://elixir.bootlin.com/linux/latest/ident/bpf_obj_pin
So from the same files, I found out that I had to include this in my header.
#include <bpf/bpf.h>
But I get the following ERROR:
clang -O2 -target bpf -I/usr/include/x86_64-linux-gnu -c bpf1.c -o bpf1.o
bpf1.c:10:10: fatal error: 'bpf/bpf.h' file not found
#include <bpf/bpf.h>
^~~~~~~~~~~
1 error generated.
makefile:21: recipe for target 'bpf1.o' failed
make: *** [bpf1.o] Error 1
This is somewhat similar but doesn't solve my problem.

Related

Simulink: fatal error: MQTTAsync.h: No such file or directory

I am trying to build an MQTT system on a raspberry pi. I was studying about MQTT and read about it a lot. I found a set of MQTT blocks in the Simulink Raspberry Pi Hardware Support Package that I assumed I could directly use. I configured an MQTT server and got all the right credentials and everything but I am now stuck on one part that has left me stumped.
I keep getting this error saying that "fatal error: MQTTAsync.h: No such file or directory". I have looked a lot trying to find anything that might help me but I couldn't. I don't know where to get the necessary files that I need or if there is any solution to sort this. I'm sharing the entire snippet of the error if that is of any help. Thanks in advance.
I apologize I'm not able to get to the whole error into a code block
Error executing command "touch -c /home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw/*.*;make -f Project_RPi.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2022a" -C /home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw LC_ALL=C". Details:
STDERR: In file included from /home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/src/MW_MQTT.c:5:
/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/include/MW_MQTT.h:49:10: fatal error: MQTTAsync.h: No such file or directory
#include <MQTTAsync.h>
^~~~~~~~~~~~~
compilation terminated.
make: *** [Project_RPi.mk:411: MW_MQTT.c.o] Error 1
STDOUT: make: Entering directory '/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw'
gcc -c -MMD -MP -MF"MW_MQTT.c.dep" -MT"MW_MQTT.c.o" -O2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DMW_NUM_MQTT_SUBSCRIBE=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Project_RPi -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/include -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/target/shared/svd/include -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/raspi/include -I/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/extern/include -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/simulink/include -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/src -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/src/ext_mode/common -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/ert -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/toolbox/target/codertarget/rtos/inc -o "MW_MQTT.c.o" "/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/src/MW_MQTT.c"
make: Leaving directory '/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw'

Error in ./configure step in installation of libpqxx

this is a bit of a long shot but:
I'm following this guide: https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
But when running ./configure I get the following error:
(previous checking lines omitted for brevity)
checking for main in -lpq... yes
checking for PQexec in -lpq... yes
checking for correct C++ linkage of basic libpq functions...
sed: character class syntax is [[:space:]], not [:space:]
configure: error:
Linking a call to libpq failed in C++, even though it succeeded in C. If your
C and C++ compilers are very different beasts, this may mean that we do not have
the right options for linking with it after all.
Read the config.log file for more detailed information. Look for the last error
message, which may be several pages up from the end of the file.
And the configure.log file looks like this:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpqxx configure 4.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
(some lines omitted)
configure:3039: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:3050: $? = 1
configure:3039: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
(some lines omitted)
configure:7629: gcc -E conftest.c
conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
(some lines omitted)
configure:8319: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
(some lines omitted)
configure:16424: g++ -o conftest -g -O2 -L/usr/lib/x86_64-linux-gnu conftest.cpp >&5
/tmp/ccfFBf4K.o: In function `main':
/home/peter/libpqxx-4.0/conftest.cpp:44: undefined reference to `PQexec'
collect2: error: ld returned 1 exit status
(some liens omitted)
I don't believe I have any packages missing. I have the newest version of g++, psql and libpqxx installed.
I have updated and upgraded all packages on my system.
I have crawled the web for solutions to this error, but I have no clue what is wrong.
Do you have an idea where I can go from here?
There hasn't been a tarball release of libpqxx at the old spot in a long time, so the tutorial you used with its wget command to download the tarball is very outdated.
The issue you encountered looks related to this issue and appears to have been fixed in this commit:
commit 85e9336740475be25ed19924cca0961f7d844c4b
Author: Jeroen Vermeulen <jtvjtv#gmail.com>
Date: Thu Jun 1 11:39:08 2017 +0700
Fix #13: not linking to libpq.
This was that annoying interaction between autoconf, m4, GNU sed syntax,
and the shell which broke the "remove redundant -lpq options" code in
the configure script.
Solution: forget about GNU sed's "[[:space:]]" syntax, and just look for
a literal space. There aren't going to be any tabs, newlines,
non-breaking spaces, etc. there in even a moderately sane world.

Boost on eclipse on windows

I am using eclipse luna on win 7.
Here is my program.
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main(int argc, char* argv[]){
// All programs that use asio need to have at least one io_service object
boost::asio::io_service io;
// sets the timer to expire 5 seconds from now
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
t.wait();
std::cout << "Hello, world!\n";
return 0;
}
Here is my command line code
g++ -I"C:\Users\Documents\Lib\boost_1_57_0\boost_1_57_0" -O0 -g3 -Wall -c -fmessage-length=0 -lboost_filesystem -lboost_system -lboost_libraryname -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Invoking: Cross G++ Linker
g++ -o "002_TimerSynchronously" ./main.o
Error
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
Anyone knows how to fix it?
Thank you very much
Reference:
undefined reference to boost::system::system_category() when compiling
How do I troubleshoot boost library/header inclusion via autoconf/automake?
The libraries should be present in the second command line when the linking takes place. Please be also careful and list the libraries after the object file.

Error installing MEAD, no such file or directory: 'prank.o'

I am not quite sure why I am getting this error when installing MEAD. Does anyone have a idea how I can fix this? I need to install MEAD for a school homework and I don't have much experience with Perl.
Fixing perl directives:
bin/default-classifier.pl
bin/default-reranker.pl
bin/driver.pl
bin/extract-to-summary.pl
bin/feature-scripts/Centroid.pl
bin/feature-scripts/IsLongestSentence.pl
bin/feature-scripts/Length.pl
bin/feature-scripts/Position.pl
bin/feature-scripts/QueryCosine.pl
bin/feature-scripts/QueryCosineNoIDF.pl
bin/feature-scripts/QueryWordOverlap.pl
bin/feature-scripts/SimWithFirst.pl
bin/feature-scripts/Skeleton.pl
bin/identity-reranker.pl
bin/leadbased-classifier.pl
bin/make-CHIN-docsent.pl
bin/mead.pl
bin/meadeval.pl
bin/novelty-reranker.pl
bin/random-classifier.pl
bin/read-idf.pl
bin/relative-utility.pl
bin/sentjudge-to-extract.pl
bin/write-idf.pl
Fixing $MEADDIR in MEAD::MEAD
Building English IDF DBM:
Wd: 65300
Building Chinese IDF DBM:
Wd: 54700
******** Compiling LexRank ********
In file included from prank.cpp:10:
./prmain.h:80:8: error: unknown type name 'pthread_mutex_t'; did you mean
'pthread_attr_t'?
extern pthread_mutex_t *mu; /* For general use */
^~~~~~~~~~~~~~~
pthread_attr_t
/usr/include/sys/_types/_pthread_attr_t.h:30:34: note: 'pthread_attr_t' declared
here
typedef __darwin_pthread_attr_t pthread_attr_t;
^
1 error generated.
clang: error: no such file or directory: 'prank.o'
******** Compiling tf2gen ********
MEAD Installation successful.
Add #include <pthread.h> to prmain.h on a line by itself just before the extern pthread_mutex_t *mu; line

Perl IPTables Module Installation Error

I've been trying to install the IPTables module for perl http://metacpan.org/pod/IPTables::IPv4 and I've been running into errors during installation.
I've tried installing using the CPAN in shell as well as downloading the tarball form the link above. Both installation give me errors. I am not sure how to get the dump from CPAN but what I can get is a dump of my shell when I run the MAKE file from the tarball:
[root#localhost IPTables-IPv4-0.98]# make
make -C libiptc/ all
make[1]: Entering directory `/home/student/Downloads/IPTables-IPv4-0.98/libiptc'
gcc -o libip6tc.o -c libip6tc.c -I../include -I/usr/src/linux/include -DIPTABLES_VERSION=\"1.2.8\" -O2 -Wall
In file included from libip6tc.c:111:0:
libiptc.c: In function ‘ip6tc_init’:
libiptc.c:312:10: warning: pointer targets in passing argument 5 of ‘getsockopt’ differ in signedness
/usr/include/sys/socket.h:190:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘int *’
libiptc.c: In function ‘target_name’:
libiptc.c:727:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
libip6tc.c: In function ‘ipv6_prefix_length’:
libip6tc.c:121:7: error: ‘const struct in6_addr’ has no member named ‘in6_u’
libip6tc.c:125:7: error: ‘const struct in6_addr’ has no member named ‘in6_u’
libip6tc.c: In function ‘dump_entry’:
libip6tc.c:201:3: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[1]: *** [libip6tc.o] Error 1
make[1]: Leaving directory `/home/student/Downloads/IPTables-IPv4-0.98/libiptc'
make: *** [libiptc/libiptc.a] Error 2
[root#localhost IPTables-IPv4-0.98]#
I would like to know what do I need to do so that I can install the module. Are there some dependencies that I need to install?
Your help is greatly appreciated.
The cpanratings and CPAN testers reports for this module make me think that you're wasting your time here.