I use Ubuntu 10.10 - 2.6.35.23-generic
I want to compile the lincan-module (http://sourceforge.net/projects/ocera/), but it doesn't work like I want... That's my first compilation of a kernel module. I did this:
First unzipped the lincan-sources to my home directory. Then excecuted "make" with this output:
make -C /home/x/can/lincan-0.3.4/src SOURCES_DIR=/home/x/can/lincan-0.3.4/src default ; make -C /home/x/can/lincan-0.3.4/utils SOURCES_DIR=/home/x/can/lincan-0.3.4/utils default ;
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory)
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory)
grep: /lib/modules/2.6.35-23-generic/build/include/linux/utsrelease.h: No such file or directory
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/src'
Makefile:216: /lib/modules/2.6.35-23-generic/build/Rules.make: No such file or directory
make[1]: *** Keine Regel, um »/lib/modules/2.6.35-23-generic/build/Rules.make« zu erstellen. Schluss.
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/src'
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/utils'
cc -I../include -O2 -Wall -c -o rxtx.o rxtx.c
rxtx.c: In function ‘main’:
rxtx.c:49: warning: format not a string literal and no format arguments
rxtx.c:73: warning: format not a string literal and no format arguments
rxtx.c:51: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
rxtx.c:58: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
rxtx.c:62: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
rxtx.c:67: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
rxtx.c:75: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
rxtx.c:81: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
cc rxtx.o -o rxtx
cc -I../include -O2 -Wall -c -o sendburst.o sendburst.c
cc sendburst.o -o sendburst
cc -I../include -O2 -Wall -c -o readburst.o readburst.c
cc readburst.o -o readburst
cc -I../include -O2 -Wall -c -o send.o send.c
send.c: In function ‘main’:
send.c:25: warning: format not a string literal and no format arguments
send.c:27: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
send.c:33: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
send.c:35: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
send.c:40: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
cc send.o -o send
cc -I../include -O2 -Wall can-proxy.c -o can-proxy
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/utils'
Then I type "make install":
make -C /home/x/can/lincan-0.3.4/src SOURCES_DIR=/home/x/can/lincan-0.3.4/src install ; make -C /home/x/can/lincan-0.3.4/utils SOURCES_DIR=/home/x/can/lincan-0.3.4/utils install ;
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory)
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory)
grep: /lib/modules/2.6.35-23-generic/build/include/linux/utsrelease.h: No such file or directory
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/src'
Makefile:216: /lib/modules/2.6.35-23-generic/build/Rules.make: No such file or directory
make[1]: *** Keine Regel, um »/lib/modules/2.6.35-23-generic/build/Rules.make« zu erstellen. Schluss.
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/src'
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/utils'
echo Nothing to install
Nothing to install
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/utils'
And it happend nothing. I find no kernel module. What did I wrong? Why is there no autoconf.h and the other files? Have you any hints for me? Thanks!
Now I created hardlinks for the missing files (autoconf.h and utsrelease.h). They are in /usr/src/linux-headers-2.6.35.23-generic/include/generated/
Now it compile much more. This is the first error that appears:
In file included from /home/x/can/lincan-0.3.4/src/../include/main.h:38,
from /home/x/can/lincan-0.3.4/src/proc.c:37:
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h: In function ‘canque_edge_decref’:
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h:652: error: invalid initializer
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h:652: error: invalid initializer
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h:652: error: incompatible types when assigning to type ‘int’ from type ‘atomic_t’
make[3]: *** [/home/x/can/lincan-0.3.4/src/proc.o] Fehler 1
make[2]: *** [_module_/home/x/can/lincan-0.3.4/src] Fehler 2
make[2]: Verlasse Verzeichnis '/usr/src/linux-headers-2.6.35-23-generic'
make[1]: *** [make_this_module] Fehler 2
Now I created hardlinks for the missing files (autoconf.h and utsrelease.h).
You have to install the package that contains the build environment as created when the kernel you are running was built. Source is generally pointless (what do you want with, say, 8139too.c anyway when you are going to build an external module), save for the kernel headers. I can't say where the build environment is located in Debian or its offsprings, but in openSUSE there would be a "kernel-default-devel" package for example to contain utsrelease.h and autoconf.h, as well as - via dependencies - the static header files required. Thus, look for an preexisting deb package that contains this.
Please install kernel build prerequisites given here. This would install necessary tools for building/compiling the kernel modules.
Related
I'm trying to implement calling octave from C, as per the example shown in this answer Call GNU Octave functions in C?
I'm trying this in Nebeans on Linux.
I've created the files calloctave.cc, calloctave.h, main.c and myfunction.m as per the example. Pointed the links and includes to the correct places (in my case /usr/include/octave-5.2.0/octave/ and /usr/lib64/octave/5.2.0 ). I've chosen C++11 as the standard. In the code, there are no errors highlighted and it seems to find everything it needs, and nothing is highlighted as missing.
When I try to compile it, I just get a series of errors as follows....
cd '/home/arwel/NetBeansProjects/callOctave_new'
/bin/gmake -f Makefile CONF=Debug
"/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
gmake[1]: Entering directory `/home/arwel/NetBeansProjects/callOctave_new'
"/bin/gmake" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/libcallOctave_new.so
gmake[2]: Entering directory `/home/arwel/NetBeansProjects/callOctave_new'
mkdir -p build/Debug/GNU-Linux
rm -f "build/Debug/GNU-Linux/calloctave.o.d"
g++ -c -g -I/usr/include/octave-5.2.0/octave -include /usr/include/octave-5.2.0/octave/mex.h -std=c++11 -fPIC -MMD -MP -MF "build/Debug/GNU-Linux/calloctave.o.d" -o build/Debug/GNU-Linux/calloctave.o calloctave.cc
In file included from /usr/include/octave-5.2.0/octave/Cell.h:33:0,
from /usr/include/octave-5.2.0/octave/gtk-manager.h:32,
from /usr/include/octave-5.2.0/octave/interpreter.h:36,
from calloctave.cc:7:
/usr/include/octave-5.2.0/octave/ov.h:52:7: error: using typedef-name ‘mxArray’ after ‘class’
class mxArray;
^
In file included from <command-line>:0:0:
/usr/include/octave-5.2.0/octave/mex.h:55:14: note: ‘mxArray’ has a previous declaration here
typedef void mxArray;
^
In file included from /usr/include/octave-5.2.0/octave/ov.h:62:0,
from /usr/include/octave-5.2.0/octave/Cell.h:33,
from /usr/include/octave-5.2.0/octave/gtk-manager.h:32,
from /usr/include/octave-5.2.0/octave/interpreter.h:36,
from calloctave.cc:7:
/usr/include/octave-5.2.0/octave/ov-base.h:57:7: error: using typedef-name ‘mxArray’ after ‘class’
class mxArray;
^
In file included from <command-line>:0:0:
/usr/include/octave-5.2.0/octave/mex.h:55:14: note: ‘mxArray’ has a previous declaration here
typedef void mxArray;
^
calloctave.cc: In function ‘int mexCallOctave(int, mxArray**, int, mxArray**, const char*)’:
calloctave.cc:26:15: error: ‘mxArray’ is not a class, namespace, or enumeration
args(i) = mxArray::as_octave_value (argin[i]);
^
calloctave.cc:42:41: error: invalid use of ‘mxArray {aka void}’
argout[i] = new mxArray (retval(i));
^
calloctave.cc: In function ‘void free_arg_list(int, mxArray**)’:
calloctave.cc:56:29: warning: deleting ‘mxArray* {aka void*}’ is undefined [enabled by default]
delete arglist[i];
^
gmake[2]: *** [build/Debug/GNU-Linux/calloctave.o] Error 1
gmake[2]: Leaving directory `/home/arwel/NetBeansProjects/callOctave_new'
gmake[1]: *** [.build-conf] Error 2
gmake[1]: Leaving directory `/home/arwel/NetBeansProjects/callOctave_new'
gmake: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
It seems to be not understanding the mex interface in some way. I'm not very knowledgeable about C/C++, so am at a loss as to how to proceed here. What could be causing these errors and how might I resolve them?
Downloaded 5.0.5 from Redis
cd to src directory
make
Surely this must work for someone else out there. Any idea/ hintg about how to fix this?
Short version:
In net.c ...
make[3]: Entering directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
net.c:270:21: error: storage size of ‘hints’ isn’t known
struct addrinfo hints, *servinfo, *bservinfo, *p, *b;
^~~~~
and later
net.c:337:40: error: dereferencing pointer to incomplete type ‘struct addrinfo’
for (p = servinfo; p != NULL; p = p->ai_next) {
^~
then
make[3]: *** [Makefile:156: net.o] Error 1
make[3]: Leaving directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/deps/hiredis'
make[2]: *** [Makefile:46: hiredis] Error 2
make[2]: Leaving directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/deps'
and finally
cc: error: ../deps/hiredis/libhiredis.a: No such file or directory
cc: error: ../deps/lua/src/liblua.a: No such file or directory
make[1]: *** [Makefile:219: redis-server] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/src'
make: *** [Makefile:6: all] Error 2
I had the same exact problem and I found the best solution was to use an older version of redis. Redis 3.2.13 was updated recently (March 2019) so it has all the functionality I need. If you use it, you do have to add the following to redis-3.2.13/deps/hiredis/net.c after the 'include' statements:
#ifdef __CYGWIN__
#define TCP_KEEPCNT 8
#define TCP_KEEPINTVL 150
#define TCP_KEEPIDLE 14400
#endif
After that I was able to run make from the root directory:
make distclean
make
This is based on this github conversation.
Hope this helps!
You can have a try.
Step 1:
Remove segment '-std=c99' from line
$(CC) -std=c99 -pedantic -c $(REAL_CFLAGS) $<
in file Makefile under .\redis-5.0.5\deps\hiredis
Ste 2:
Add the following segment after includes deps/hiredis/net.c after the 'include' statements:
#ifndef TCP_KEEPCNT
#define TCP_KEEPCNT 8
#endif
#ifndef TCP_KEEPINTVL
#define TCP_KEEPINTVL 150
#endif
#ifndef TCP_KEEPIDLE
#define TCP_KEEPIDLE 14400
#endif
I followed these instructions. Download lmbench3.tar.gz from lmbench3
and Unpack LMbench to create a tree like so:
lmbench/
Results/
doc/
scripts/
src/
And Go to the lmbench directory, and type make results see
But the result is wrong:
7 warnings generated.
gcc -O -DRUSAGE -DHAVE_uint=1 -DHAVE_uint64_t=1 -DHAVE_int64_t=1 -DHAVE_DRAND48 -c getopt.c -o ../bin/i686-apple-darwin15.6.0/getopt.o
gcc -O -DRUSAGE -DHAVE_uint=1 -DHAVE_uint64_t=1 -DHAVE_int64_t=1 -DHAVE_DRAND48 -c lib_sched.c -o ../bin/i686-apple-darwin15.6.0/lib_sched.o
lib_sched.c:94:3: error: non-void function 'handle_scheduler' should return a
value [-Wreturn-type]
return;
^
1 error generated.
make[2]: *** [../bin/i686-apple-darwin15.6.0/lib_sched.o] Error 1
make[1]: *** [lmbench] Error 2
make: *** [build] Error 2
How to solve it?
You can change the statement
return;
into
return 0;
at line 94 of lib_sched.c
Then this file should compile without this error.
I have followed the directions at https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit for installation on Windows 7. I have uninstalled Qt and reinstalled and tried to do this many times, and I can't get it to work.
I added to qmake.conf the line
QMAKE_LFLAGS = -static-libgcc -static-libstdc++
The other line in the directions for QMAKE_RCC was already there.
When I do this command in the directions...
C:\development\Ruby193\capybara-webkit>bundle exec rake build
I get errors - starting with:
c:/Qt/qt-4.8.5-x64-mingw/bin/qmake.exe -spec ../../../Qt/qt-4.8.5-x64-mingw/mksp
WARNING: (internal):1: Unescaped backslashes are deprecated.
cd src/ && c:/Qt/qt-4.8.5-x64-mingw/bin/qmake.exe c:/development/Ruby193/capybar
/mkspecs/win32-g++ CONFIG+\=test -o Makefile.webkit_server
WARNING: (internal):1: Unescaped backslashes are deprecated.
cd src/ && make -f Makefile.webkit_server
make[1]: Entering directory /c/development/Ruby193/capybara-webkit/src'
make -f Makefile.webkit_server.Debug
make[2]: Entering directory/c/development/Ruby193/capybara-webkit/src'
g++ -static-libgcc -static-libstdc++ -Wl,-subsystem,console -mthreads -o debug/w
x64-mingw/lib' -lQtWebKitd4 -lQtGuid4 -lQtNetworkd4 -lQtCored4
g++.exe: unrecognized option '-static-libstdc++'
./build/BlockUrl.o: In function ZNK5QListI7QStringEixEi':
c:\development\Ruby193\capybara-webkit\src/../../../../Qt/qt-4.8.5-x64-mingw/inc
PKcS0_S0_i'
./build/SetUnknownUrlMode.o: In functionZN7QStringpLERKS_':
c:\development\Ruby193\capybara-webkit\src/../../../../Qt/qt-4.8.5-x64-mingw/inc
ppendERKS_'
...
ending with the following lines:
./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x20): undefined reference to QObject::ev
entFilter(QObject*, QEvent*)'
./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x24): undefined reference toQObject::ti
merEvent(QTimerEvent*)'
./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x28): undefined reference to QObject::ch
ildEvent(QChildEvent*)'
./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x2c): undefined reference toQObject::cu
stomEvent(QEvent*)'
./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x30): undefined reference to QObject::co
nnectNotify(char const*)'
./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x34): undefined reference toQObject::di
sconnectNotify(char const*)'
./build/moc_RequestHandler.o: In function ~RequestHandler':
c:\development\Ruby193\capybara-webkit\src/build/../RequestHandler.h:11: undefined reference to_imp___ZN7QObjectD2Ev'
./build/qrc_webkit_server.o: In function Z28qInitResources_webkit_serverv':
c:\development\Ruby193\capybara-webkit\src/debug/qrc_webkit_server.cpp:479: undefined reference to_imp___Z21qRegisterResourceDataiPKhS0_S0_'
./build/qrc_webkit_server.o: In function Z31qCleanupResources_webkit_serverv':
c:\development\Ruby193\capybara-webkit\src/debug/qrc_webkit_server.cpp:488: undefined reference to_imp___Z23qUnregisterResourceDataiPKhS0_S0_'
collect2: ld returned 1 exit status
make[2]: * [debug/webkit_server.exe] Error 1
make[2]: Leaving directory /c/development/Ruby193/capybara-webkit/src'
make[1]: *** [debug] Error 2
make[1]: Leaving directory/c/development/Ruby193/capybara-webkit/src'
make: * [sub-src-webkit_server-pro-make_default-ordered] Error 2
Command 'make' failed
I am trying to install glibc-2.15 on my system over an existing glibc-2.10.2. The steps I followed are:
1. In the directory where the glibc sources are unpacked, created a directory glibc-build.
2. Ran configure from the glibc-build directory like so:
./../glibc-2.15/configure --prefix=/usr
3. Make to build the libraries, like so:
make
I get the following error on the compilation rule given below:
gcc ../sysdeps/i386/i686/fpu/e_logl.S -c -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES -I../include -I/home/sriram/glibc/glibc-build/math -I/home/sriram/glibc/glibc-build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/unix/sysv/linux/i386/i686 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu -I../sysdeps/i386/i686/multiarch -I../nptl/sysdeps/i386/i686 -I../sysdeps/i386/i686 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I.. -I../libio -I. -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DNOT_IN_libc=1 -DIS_IN_libm=1 -DASSEMBLER -DGAS_SYNTAX -g -Wa,--noexecstack -Wa,-mtune=i686 -o /home/sriram/glibc/glibc-build/math/e_logl.o -MD -MP -MF /home/sriram/glibc/glibc-build/math/e_logl.o.dt -MT /home/sriram/glibc/glibc-build/math/e_logl.o
../sysdeps/i386/i686/fpu/e_logl.S: Assembler messages:
../sysdeps/i386/i686/fpu/e_logl.S:49: Error: suffix or operands invalid for `fcomip'
../sysdeps/i386/i686/fpu/e_logl.S:75: Error: suffix or operands invalid for `fcomip'
make[2]: *** [/home/sriram/glibc/glibc-build/math/e_logl.o] Error 1
make[2]: Leaving directory `/home/sriram/glibc/glibc-2.15/math'
make[1]: *** [math/others] Error 2
make[1]: Leaving directory `/home/sriram/glibc/glibc-2.15'
make: *** [all] Error 2
I have looked over the Internet to find a solution but have not gotten anywhere. How do I get rid of this error??