i'm trying to make new system calls in kernel 2.6.21
and one of the new system calls use 'sys_write' function,
but to use this function, i realized that i must install kernel header file according to 2.6.21 version.
but i can't find kernel header file(2.6.21)
i tried apt-get install linux-headers-'uname -r' , apt-cache search linux-headers-$(uname -r)
but i can't find anything..
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
#include <asm/uaccess.h>
int main(){
int fd;
int old_fs;
old_fs = get_fs();
set_fs(KERNEL_DS);
fd = sys_open("config.txt", O_RDONLY, 0);
if(fd >= 0)
sys_close(fd);
set_fs(old_fs);
return 0;
}
vv.c:2:24: error: linux/init.h: No such file or directory
vv.c:3:26: error: linux/module.h: No such file or directory
vv.c:4:28: error: linux/syscalls.h: No such file or directory
In file included from /usr/include/asm/fcntl.h:1,
from /usr/include/linux/fcntl.h:4,
from vv.c:5:
/usr/include/asm-generic/fcntl.h:120: error: expected specifier-qualifier-list before ‘off_t’
/usr/include/asm-generic/fcntl.h:143: error: expected specifier-qualifier-list before ‘loff_t’
vv.c:6:25: error: asm/uaccess.h: No such file or directory
vv.c: In function ‘main’:
vv.c:12: error: ‘KERNEL_DS’ undeclared (first use in this function)
vv.c:12: error: (Each undeclared identifier is reported only once
vv.c:12: error: for each function it appears in.)
additionally, above header files is what i want to.
how can i get the kernel header file?
please help me..
Did installing the headers complete? If so then they should be installed in /usr/include and the include directives you gave should just work.
Edit:
First run:
sudo apt-get update
To make sure you have the latest packages, then:
sudo apt-get install linux-headers-$(uname -r)
This is the one package that should contain all the kernel header files in Ubuntu.
Related
Kept getting the following error when trying to install Apache Airflow by
pip install apache-airflow
I removed command line tools, upgraded OS from Mojave to Catalina, re installed xcode using xcode-select --install even then the following errors failed to get resolved :-
---many similar lines---
In file included from /usr/local/include/stdint.h:59:
In file included from /usr/local/include/stdint.h:59:
In file included from /usr/local/include/stdint.h:59:
/usr/local/include/stdint.h:2:10: error: #include nested too deeply
#include <stddef.h>
^
/usr/local/include/stdint.h:72:11: error: #include nested too deeply
# include <sys/types.h>
^
/usr/local/include/stdint.h:82:11: error: #include nested too deeply
# include <inttypes.h>
^
In file included from src/setproctitle.c:14:
In file included from src/spt.h:15:
In file included from src/spt_python.h:14:
---many similar lines---
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/resource.h:216:2: error: unknown type name 'uint64_t'
uint64_t ri_wired_size;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'clang' failed with exit status 1
Read these issues on Github https://github.com/giampaolo/psutil/issues/1388 and https://github.com/cython/cython/issues/2009
Renamed my folder /usr/local/include to /usr/local/include_old for keeping it as backup in case even this doesn't work
mv /usr/local/include /usr/local/include_old
and then ran same installation command again:-
pip install apache-airflow
which worked flawlessly this time.
Platform: Macos Catalina 10.15.2
Xcode version: Xcode 11
I have tried many times to make-all gcc to build my source code. However, I have encountered a problem:
In file included from ../.././gcc/c/c-objc-common.c:33:
In file included from /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:85:
/Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:181:5: error:
no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
_VSTD::abort();
^~~~~~~ /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:873:15: note:
expanded from macro '_VSTD' # _VSTD std::_LIBCPP_ABI_NAMESPACE
^ ../.././gcc/system.h:685:13: note: 'fancy_abort' declared here extern void fancy_abort (const char *, int, const char
*) ATTRIBUTE_NORETURN;
^
1 error generated.
make[1]: *** [c/c-objc-common.o] Error 1
make: *** [all-gcc] Error 2
I have tried to install another version of Xcode. I have installed Xcode6 but it still did not work, and I found a solution of this issue. But when I download Xcode8.3.3, it is not compatible with Catalina 10.15.2.
I ran in to this issue while using crosstools-ng on mac (mojave 10.14) to compile cross-platform toolchain with gcc 4.9.
Solution: Edit .build/src/gcc-4.9.4/gcc/system.h to add #include <map> in #ifdef __cplusplus block where other include statements are.
The problem is that is included (via ) after abort has been
defined as a macro to fancy_abort. And thus when the C++ standard headers try
to call std::abort, they end up calling std::fancy_abort, which of course
doesn't exist.
Source: https://gcc.gnu.org/legacy-ml/gcc-bugs/2017-09/msg00154.html
I'm trying to gem install t(a command line tool for Twitter) in my OSX High Sierra. My Ruby version is ruby 2.3.7p456.
But I am getting the error below:
~> gem install t
Building native extensions. This could take a while...
ERROR: Error installing t:
ERROR: Failed to build gem native extension.
/Users/akira/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20181213-96401-3tpab1.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling ryah_http_parser.c
In file included from ryah_http_parser.c:24:
In file included from ./ryah_http_parser.h:44:
In file included from /usr/local/include/stdint.h:59:
In file included from /usr/local/include/stdint.h:59:
....
/usr/local/include/stdint.h:2:10: error: #include nested too deeply
#include <stddef.h>
^
/usr/local/include/stdint.h:59:11: error: #include nested too deeply
# include <stdint.h>
^
/usr/local/include/stdint.h:72:11: error: #include nested too deeply
# include <sys/types.h>
^
In file included from ryah_http_parser.c:24:
./ryah_http_parser.h:210:3: error: unknown type name 'uint64_t'
uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */
^
In file included from ryah_http_parser.c:28:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
uint64_t ri_user_time;
^
/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
uint64_t ri_system_time;
^
/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
uint64_t ri_pkg_idle_wkups;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [ryah_http_parser.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/akira/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /Users/akira/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/http_parser.rb-0.6.0/gem_make.out
Does anyone have any idea what the problem is here?
Looks like you need to install the command line dev tools on osx.
Run xcode-select --install and try again.
When I include in my native C extension for a gem that I am writing, I get the following error:
../../../../ext/my_file/my_file.c:4:42: error: unknown type name 'RUBY_T_FIXNUM'
Here is where I use it in my code:
#include <stdlib.h>
#include <ruby-2.3.0/ruby.h>
void my_file_init(const T_STRING prog, T_FIXNUM verbose) {}
I added a link in /usr/local/include to ~/.rvm/rubies/default/include/ruby-2.3.0, which is where I have the version of ruby that I want to use installed. The only definition I could find for the T_FIXNUM constant in the ruby header files was within an enum in ruby/ruby.h:
enum ruby_value_type {
...
RUBY_T_FIXNUM = 0x15
};
Here is where the ruby/ruby.h file defines the T_FIXNUM type:
#define T_FIXNUM RUBY_T_FIXNUM
Am I including files incorrectly? Do I have the wrong version of Ruby? I'm working on OSX and I use RVM to manage my rubies. I have added symbolic links for config.h in the x86_64-darwin16/ruby dir, as well as a link from the ruby dir to itself.
I was trying to compile Asterisk 1.6 on Windows using Cygwin
1- I have installed Cygwin and included (Debug, Devel and Libs )while installing Cygwin.
2- ./Configure passed successfully
3- while running make command I got this
In file included from /home/Administrator/asterisk-1.6.2.24/include/asterisk.h:27:0,
from smsq.c:20:
/home/Administrator/asterisk-1.6.2.24/include/asterisk/compat.h:205:28: error: conflicting types for ‘uint64_t’
typedef unsigned long long uint64_t;
^
In file included from /usr/include/stdint.h:14:0,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/stdint.h:9,
from /usr/include/inttypes.h:19,
from /home/Administrator/asterisk-1.6.2.24/include/asterisk/compat.h:29,
from /home/Administrator/asterisk-1.6.2.24/include/asterisk.h:27,
from smsq.c:20:
/usr/include/sys/_stdint.h:60:20: note: previous declaration of ‘uint64_t’ was here
typedef __uint64_t uint64_t ;
^
make[1]: *** [/home/Administrator/asterisk-1.6.2.24/Makefile.rules:91: smsq.o] Error 1
make: *** [Makefile:422: utils] Error 2
I need to know what is the cause and how can I fix this issue?
Thanks in advance
The type named uint64_t is defined in <stdint.h> where it should be, but asterisk is (wrongly, all identifiers ending in _t are reserved names) trying to provide its own definition.
Remove the improper definition in "compat.h".