Complie riscv-gnu-toolchain on MacOS Error - riscv

I compile gnu-tool-chain on my Mac, and get some error message
I'm in the riscv-gnu-toolchain root directory, and
./configure --prefix=/usr/local/opt/riscv-gnu-toolchain
make
I get
...
/Volumes/CaseSensitive/riscv-gnu-toolchain/riscv-gdb/readline/rltty.c:83:7: error:
implicit declaration of function 'ioctl' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
^
/Volumes/CaseSensitive/riscv-gnu-toolchain/riscv-gdb/readline/rltty.c:720:3: error:
implicit declaration of function 'ioctl' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
ioctl (fildes, TIOCSTART, 0);
^
/Volumes/CaseSensitive/riscv-gnu-toolchain/riscv-gdb/readline/rltty.c:759:3: error:
implicit declaration of function 'ioctl' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
ioctl (fildes, TIOCSTOP, 0);
^
3 errors generated.
make[3]: *** [rltty.o] Error 1
make[2]: *** [all-readline] Error 2
make[1]: *** [all] Error 2
make: *** [stamps/build-gdb-newlib] Error 2
My MacOS version is 10.15.7.
Should I add some headers file in somewhere?

Related

Cannot build RTL8192EU driver on Kali Linux for TP-Link WN821N

I cannot build RTL8192EU driver on Kali Linux 5.2 for TP-Link WN821N. After running make in cd rtl8192eu-linux-driver (downloaded from https://github.com/jeremyb31/rtl8192eu-linux-driver):
# sudo apt update
Hit:1 http://kali.download/kali kali-rolling InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
511 packages can be upgraded. Run 'apt list --upgradable' to see them.
# git clone https://github.com/jeremyb31/rtl8192eu-linux-driver
fatal: destination path 'rtl8192eu-linux-driver' already exists and is not an empty directory.
# cd rtl8192eu-linux-driver
# make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/5.2.0-kali2-amd64/build M=/root/rtl8192eu-linux-driver modules
make[1]: Entering directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
CC [M] /root/rtl8192eu-linux-driver/os_dep/osdep_service.o
In file included from /root/rtl8192eu-linux-driver/include/drv_types.h:35,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/root/rtl8192eu-linux-driver/include/wifi.h:1019: warning: "IEEE80211_MAX_AMPDU_BUF" redefined
#define IEEE80211_MAX_AMPDU_BUF 0x40
In file included from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:84,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/include/linux/ieee80211.h:1441: note: this is the location of the previous definition
#define IEEE80211_MAX_AMPDU_BUF 0x100
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c: In function ‘isFileReadable’:
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:1970:28: error: implicit declaration of function ‘get_ds’; did you mean ‘get_da’? [-Werror=implicit-function-declaration]
oldfs = get_fs(); set_fs(get_ds());
^~~~~~
get_da
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:1970:28: error: incompatible type for argument 1 of ‘set_fs’
oldfs = get_fs(); set_fs(get_ds());
^~~~~~~~
In file included from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uaccess.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/crypto.h:21,
from /usr/src/linux-headers-5.2.0-kali2-common/include/crypto/hash.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uio.h:10,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/socket.h:8,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/compat.h:15,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/ethtool.h:17,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/netdevice.h:37,
from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:35,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/arch/x86/include/asm/uaccess.h:29:40: note: expected ‘mm_segment_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
static inline void set_fs(mm_segment_t fs)
~~~~~~~~~~~~~^~
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c: In function ‘retriveFromFile’:
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:1998:29: error: incompatible type for argument 1 of ‘set_fs’
oldfs = get_fs(); set_fs(get_ds());
^~~~~~~~
In file included from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uaccess.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/crypto.h:21,
from /usr/src/linux-headers-5.2.0-kali2-common/include/crypto/hash.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uio.h:10,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/socket.h:8,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/compat.h:15,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/ethtool.h:17,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/netdevice.h:37,
from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:35,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/arch/x86/include/asm/uaccess.h:29:40: note: expected ‘mm_segment_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
static inline void set_fs(mm_segment_t fs)
~~~~~~~~~~~~~^~
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c: In function ‘storeToFile’:
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:2032:29: error: incompatible type for argument 1 of ‘set_fs’
oldfs = get_fs(); set_fs(get_ds());
^~~~~~~~
In file included from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uaccess.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/crypto.h:21,
from /usr/src/linux-headers-5.2.0-kali2-common/include/crypto/hash.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uio.h:10,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/socket.h:8,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/compat.h:15,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/ethtool.h:17,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/netdevice.h:37,
from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:35,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/arch/x86/include/asm/uaccess.h:29:40: note: expected ‘mm_segment_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
static inline void set_fs(mm_segment_t fs)
~~~~~~~~~~~~~^~
cc1: some warnings being treated as errors
make[4]: *** [/usr/src/linux-headers-5.2.0-kali2-common/scripts/Makefile.build:284: /root/rtl8192eu-linux-driver/os_dep/osdep_service.o] Error 1
make[3]: *** [/usr/src/linux-headers-5.2.0-kali2-common/Makefile:1610: _module_/root/rtl8192eu-linux-driver] Error 2
make[2]: *** [Makefile:179: sub-make] Error 2
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
make: *** [Makefile:1700: modules] Error 2
How do I fix the compile errors?
go to mange:
download and install the only working drivers. It worked with default drivers for me but with extremely low "power" and dropping/poor connection. Now it works great, just as it should...
I am just a simple/new linux user so I can't offer any further support. But the mentioned site has detailed instructions. I was referred there by multiple other forums.

I get build error while building OpenCV and OpenCV_Contrib from the source on Linux

I'm building OpenCV on Linux with OpenCV_contrib and I can't make it work.
OpenCV alone can build with no errors.
While compliling OpenCV alone It works find .
cmake -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4/modules
..
$ make j5
During make process , it fails at 100% ,😔😔😔😔😔😔😔😔
Scanning dependencies of target opencv_python2
[100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
[100%] Linking CXX executable ../../bin/opencv_perf_stitching
[100%] Built target opencv_perf_stitching
In file included from /home/habib/Documents/Projects/Packages/opencv-3.4.3/build/modules/python_bindings_generator/pyopencv_custom_headers.h:8:0,
from /home/habib/Documents/Projects/Packages/opencv-3.4.3/modules/python/src2/cv2.cpp:1816:
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:40: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverter<linemod::Match>
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:54: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<linemod::Match>
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:40: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverter<linemod::Template>
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:57: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<linemod::Template>
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:40: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverter<linemod::Feature>
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:56: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<linemod::Feature>
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:44: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverter<Ptr<linemod::Modality> >
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:61: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<Ptr<linemod::Modality> >
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:63: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<Ptr<linemod::Modality> >
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:56:21: error: ‘linemod’ was not declared in this scope
typedef std::vector<linemod::Match> vector_Match;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:56:35: error: template argument 1 is invalid
typedef std::vector<linemod::Match> vector_Match;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:56:35: error: template argument 2 is invalid
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:57:21: error: ‘linemod’ was not declared in this scope
typedef std::vector<linemod::Template> vector_Template;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:57:38: error: template argument 1 is invalid
typedef std::vector<linemod::Template> vector_Template;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:57:38: error: template argument 2 is invalid
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:58:21: error: ‘linemod’ was not declared in this scope
typedef std::vector<linemod::Feature> vector_Feature;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:58:37: error: template argument 1 is invalid
typedef std::vector<linemod::Feature> vector_Feature;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:58:37: error: template argument 2 is invalid
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:25: error: ‘linemod’ was not declared in this scope
typedef std::vector<Ptr<linemod::Modality> > vector_Ptr_Modality;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:42: error: template argument 1 is invalid
typedef std::vector<Ptr<linemod::Modality> > vector_Ptr_Modality;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:44: error: template argument 1 is invalid
typedef std::vector<Ptr<linemod::Modality> > vector_Ptr_Modality;
^
/home/habib/Documents/Projects/Packages/opencv_contrib-3.4/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:44: error: template argument 2 is invalid
[100%] Linking CXX executable ../../bin/opencv_perf_tracking
[100%] Built target opencv_perf_tracking
modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:15272: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I downloaded the opencv Source code from the official website and cloned the opencv_contrib from Github. And this was not a good idea and I ran into problems.
I cloned the exact same version for both opencv and opencv_contrib from Github and this time it worked perfectly.
git clone -b 3.4 https://github.com/opencv/opencv
git clone -b 3.4 https://github.com/opencv/opencv_contrib
Run make clean before cmake and make, should solve the problem.

What is "Recipe for target 'gconfig' failed" mean when I do "make xconfig" in Linux terminal?

I am really new on Linux drivers and I am trying to Compile Linux kernel 2.6,
I did these steps so far on my Linux 4.0
1)
I got Latest Linux kernel code for 2.x.y.z and Extract tar (.tar.bz3) file
2) Installed gcc,
apt-get install gcc
3)Try to make below but all of them occurred with error:
make menuconfig
make xconfig
make gconfig
Error:
root#kiarash-VirtualBox:~/Desktop/linux-2.6.9# make gconfig
HOSTCC scripts/basic/fixdep
scripts/basic/fixdep.c: In function ‘traps’:
scripts/basic/fixdep.c:368:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
if (*(int *)test != INT_CONF) {
^
scripts/basic/fixdep.c:370:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(int *)test);
^
HOSTCC scripts/basic/split-include
scripts/basic/split-include.c: In function ‘main’:
scripts/basic/split-include.c:133:6: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(old_line, buffer_size, fp_target);
^
HOSTCC scripts/basic/docproc
*
* Unable to find the GTK+ installation. Please make sure that
* the GTK+ 2.0 development package is correctly installed...
* You need gtk+-2.0, glib-2.0 and libglade-2.0.
*
HOSTCC scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘conf_string’:
scripts/kconfig/conf.c:164:20: warning: variable ‘help’ set but not used [-Wunused-but-set-variable]
const char *def, *help;
^
scripts/kconfig/conf.c: In function ‘conf_sym’:
scripts/kconfig/conf.c:198:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
int type;
^
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:273:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
int type;
^
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:94:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(line, 128, stdin);
^
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:350:4: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(line, 128, stdin);
^
make[1]: *** No rule to make target 'scripts/kconfig/.tmp_gtkcheck', needed by 'scripts/kconfig/gconf.o'. Stop.
Makefile:429: recipe for target 'gconfig' failed
make: *** [gconfig] Error 2
Please help me to undrestand!
write below in your terminal in order to install gtk2.0 and libgtk2.0-dev
sudo apt-get install gtk2.0
sudo apt-get install build-essential libgtk2.0-dev

error: implicit declaration of function ‘create_proc_entry’

Kernel version : 3.13.0-32-generic
When i am building the module getting the error
make -C /lib/modules/3.13.0-32-generic/build
M=/home/wipro/Downloads/proc modules make[1]: Entering directory
/usr/src/linux-headers-3.13.0-32-generic' CC [M]
/home/wipro/Downloads/proc/proc.o /home/wipro/Downloads/proc/proc.c:
In function ‘proc_win_init’: /home/wipro/Downloads/proc/proc.c:21:5:
error: implicit declaration of function ‘create_proc_entry’
[-Werror=implicit-function-declaration]
if ((file = create_proc_entry("rel_time", 0666, parent)) == NULL) {
^ /home/wipro/Downloads/proc/proc.c:21:15: warning: assignment makes pointer from integer without a cast [enabled by default]
if ((file = create_proc_entry("rel_time", 0666, parent)) == NULL) {
^ /home/wipro/Downloads/proc/proc.c:25:9: error: dereferencing pointer to incomplete type
file->read_proc = time_read;
^ /home/wipro/Downloads/proc/proc.c:26:9: error: dereferencing pointer to incomplete type
file->write_proc = time_write;
^ /home/wipro/Downloads/proc/proc.c:32:9: error: dereferencing pointer to incomplete type
link->uid = 0;
^ /home/wipro/Downloads/proc/proc.c:33:9: error: dereferencing pointer to incomplete type
link->gid = 100;
^ cc1: some warnings being treated as errors make[2]: *** [/home/wipro/Downloads/proc/proc.o] Error 1 make[1]: ***
[_module_/home/wipro/Downloads/proc] Error 2 make[1]: Leaving
directory/usr/src/linux-headers-3.13.0-32-generic' make: ***
[default] Error 2
How to remove the error
create_proc_entry has been removed since 3.10 kernel version. Alternative is to use proc_create. See that question for more info.

Giving S_IWUGO permission to module parameter results in compilation error (while S_IRUGO or S_IXUGO doesn't) - why?

I wrote a simple kernel module to learn module_param feature of the kernel module. However, if I give the S_IWUGO, S_IRWXUGO or S_IALLUGO permissions for the perm field, I get the follwing compilation error:
[root#localhost param]# make -C $KDIR M=$PWD modules
make: Entering directory `/usr/src/kernels/3.11.10-301.fc20.i686+PAE'
CC [M] /root/ldd/misc/param/param/hello.o
/root/ldd/misc/param/param/hello.c:6:168: error: negative width in bit-field ‘<anonymous>’
module_param(a, int, S_IWUGO);
^
make[1]: *** [/root/ldd/misc/param/param/hello.o] Error 1
make: *** [_module_/root/ldd/misc/param/param] Error 2
make: Leaving directory `/usr/src/kernels/3.11.10-301.fc20.i686+PAE'
Compilation is successful for S_IRUGO or S_IXUGO (permission not containing Write permssion). I suppose I must be doing something wrong because from what I know, wrtie permission is legal. What am I doing wrong here?
The program:
#include<linux/module.h>
#include<linux/stat.h>
int a = 2;
module_param(a, int, S_IXUGO);
int f1(void){
return 0;
}
void f2(void){
}
module_init(f1);
module_exit(f2);
MODULE_AUTHOR("lavya");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("experiment with parameters");
Linux does not accept the S_IWOTH permission.
If you follow the macro chain behind module_param, you arrive to __module_param_call which includes:
BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2))
S_IWOTH == 2 so the test fails.
The negative width in bit-field error is merely is an artefact of the implementation of BUILD_BUG_ON_ZERO
Linux probably refuses to make module parameters world-writable for security reasons. You should be able to use narrower permissions such as S_IWUSR | S_IWGRP.

Resources