After issuing a make command to compile Example 2.4 from the Linux Kernel Module Programming Guide, I get the following response:
$ make
make -C /lib/modules/3.11.0-12-generic/build M= modules
make[1]: Entering directory `/usr/src/linux-headers-3.11.0-12-generic'
/usr/src/linux-headers-3.11.0-12-generic/arch/x86/Makefile:107: CONFIG_X86_X32 enabled but no binutils support
make[2]: *** No rule to make target `/usr/src/linux-headers-3.11.0-12-generic/arch/x86 /syscalls/syscall_32.tbl', needed by `arch/x86/syscalls/../include/generated /uapi/asm/unistd_32.h'. Stop.
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.11.0-12-generic'
make: *** [all] Error 2
Here's the content of the appropriate makefile:
obj−m += hello−1.o
obj−m += hello−2.o
all:
make −C /lib/modules/$(shell uname −r)/build M=$(PWD) modules
clean:
make −C /lib/modules/$(shell uname −r)/build M=$(PWD) clean
I'd appreciate any help, since I'm a complete noob regarding the topic.
EDIT: After rewriting the makefile, the compilation succeeded for some mysterious reason.
it looks like conflicts in your setup, you can do following things may work..
1)if your installation is 64-bit then check following file
vim /boot/config-3.8.0-19-generic
CONFIG_X86_X32=y then there is problem
it should CONFIG_X86_X32=n
and CONFIG_X86_X64=y
2)other option is install remove your binutils using apt-get remove binutils and then install again using apt-get install binutils
Rewriting the makefile solved the problem
A common cause of CONFIG_X86_X32 enabled but no binutils support is spaces in the compilation directory, but that's clearly not the issue in your case.
I've had CONFIG_X86_X32 enabled but no binutils support in some cases if the kernel source directory belongs to root and you're running as an unprivileged user. Building with sudo make fixed this for me.
Related
I do ./configure with-pjproject-bundled, and it runs OK. Then, I issue make, and it crashes with cannot find -lwebrtc-x86_64-unknown-linux-gnu. Full stack here:
CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" LDFLAGS="" make -C
menuselect CONFIGURE_SILENT="--silent" makeopts
make[1]: Entering directory `/usr/local/asterisk-14.4.0/menuselect'
make[1]: `makeopts' is up to date.
make[1]: Leaving directory `/usr/local/asterisk-14.4.0/menuselect'
Generating input for menuselect ...
menuselect/menuselect --check-deps menuselect.makeopts
menuselect/menuselect --check-deps menuselect.makeopts
Generating embedded module rules ...
[LD] libasteriskpj.o -> libasteriskpj.so.2
/usr/bin/ld: cannot find -lwebrtc-x86_64-unknown-linux-gnu
collect2: error: ld returned 1 exit status
make[1]: *** [libasteriskpj.so.2] Error 1
make: *** [main] Error 2
I use RedHat 7.3 and Asterisk 14.4.
If I do ./configure without parameters, then make runs without an error. What am I doing wrong?
You’re simply missing a library. Run this command to install it:
yum install webrtc-audio-processing-devel
Then clear out your settings before running configure again:
make clean all
I’m not at my computer now but I believe there’s a script bundled with the code that installs all the dependencies for you. Might be worth checking out.
I am trying to compile a gcc from source since I cannot use yum, apt-get and so forth. My steps are simple:
-I download the source GCC (I tried gcc-4.8.4 and gcc-5.3.0) in my pc and I used:
./contrib/download_prerequisites
-After this, I send this my gcc source file to my system using powerPC y Linux.
mkdir objdir
cd objdir
../gcc-4.6.2/configure --prefix=/usr --enable-languages=c,c++,fortran,go
make
I have got the next error:
In file included from ../../gcc-4.9.2/gcc/genmddeps.c:19:0:
../../gcc-4.9.2/gcc/system.h:205:20: fatal error: cstring: No such file or directory
# include <cstring>
^
compilation terminated.
make[3]: *** [build/genmddeps.o] Error 1
make[3]: Leaving directory `/home/root/build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/root/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/root/build'
make: *** [all] Error 2
Any idea about what it is going wrong?
Best regards
Some advice: first, compile (notably for learning purposes) something simpler than GCC, e.g. GNU make if you never compiled GNU stuff from source code.
Then compile a recent GCC (so 5.3 in january 2016) - building issues would be the same with 4.8, and GCC 5 is better! You need the gcc & libc-dev & g++ & libstdc++-dev for your host machine (the one running your future cross-compiler). I am not sure your --prefix=/usr is a good idea. Consider perhaps a --program-suffix=-mine option (otherwise, your system's /usr/bin/gcc could be overwritten, which you don't want to happen)
You could leave the default --prefix=/usr/local and later add appropriately /usr/local/bin/ into your PATH
I have a new installation of Ubuntu linux and I am trying to update my gcc complier. The latest gcc compiler depends on gmp, mpfr, and mpc, so I downloaded those and placed the source into the gcc 4.8.1 source folder, as instructed.
configure seems to have run just fine. I did not include any options, because none seemed appropriate. I just ran with the defaults.
When I run make, I get the following error:
configure: error: C++ compiler missing or inoperational
make[2]: \*** [configure-stage1-libcpp] Error 1
make[2]: Leaving directory `/home/clay/programming/C++/gcc-4.8.1'
make[1]: \*** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/clay/programming/C++/gcc-4.8.1'
make: \*** [all] Error 2
I am running out of a terminal window as root, and I did a make distclean and tried a second time, but no dice. I know it can find both gcc and cc because it says so in the make output.
Any ideas?
You need a C++ compiler to build GCC. On Ubuntu, the C++ compiler is in the package g++, separate from gcc (which is a C compiler, not a C++ compiler), so be sure to:
sudo apt-get install g++
first you should ensure a C++ compiler to build on your machine
yum install gcc-c++
I try to cross-compiler icu4c 51.1 with Emscripten (clang) via
emconfigure source/configure --host=i386-pc-linux-gnu --prefix=${myprefix} --enable-static --disable-shared --disable-dyload --disable-renaming CXXFLAGS='-DU_USING_ICU_NAMESPACE=0' CPPFLAGS='-DU_DISABLE_RENAMING=1'
emmake make
emmake make install
It compiles most of the sources fine, but fails with
Unpacking ../source/data/in/icudt51l.dat and generating out/tmp/icudata.lst (list of data files)
LD_LIBRARY_PATH=../lib:../stubdata:../tools/ctestfw:$LD_LIBRARY_PATH ../bin/icupkg -d ./out/build/icudt51l --list -x \* ../source/data/in/icudt51l.dat -o out/tmp/icudata.lst
run-detectors: warning: unable to exec /usr/bin/lli-2.8: No such file or directory
run-detectors: warning: unable to exec /usr/bin/lli-2.9: No such file or directory
LLVM ERROR: Program used external function 'findBasename' which could not be resolved!
make[1]: *** [out/tmp/icudata.lst] Error 1
make[1]: Leaving directory `/home/andreas/.emscripten-libs/sources/icu4c/51.1/data'
make: *** [all-recursive] Error 2
So I am wondering, where it tries to find findBasename and what this data compiling is all about.
EDIT:
The error messages come from icupkg being built with clang, which does not make sense in this case. How can I specifc that the libraries are built with clang, but the tools with another compiler?
Sounds like it wasn't able to find, I'm guessing, ICU tool utilities lib in ../lib - might try running ldd or equivalent on icupkg
I am trying to compile a Hello World module. I am having a fresh Ubuntu in my system which doesn't have any compiled kernel.
My kernel is:
2.6.32-34-generic
I gave the following Makefile and got the error:
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
# make
make -C /lib/modules/2.6.32-34-generic/build M=/home/james/Desktop/hello modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-34-generic'
make[2]: *** No rule to make target `/home/james/Desktop/hello/hello-1.c', needed by `/home/james/Desktop/hello/hello-1.o'. Stop.
make[1]: *** [_module_/home/james/Desktop/hello] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-34-generic'
make: *** [all] Error 2
The contents of my /lib/modules/2.6.32-34-generic are
total 3864
lrwxrwxrwx 1 root root 40 2011-11-05 15:55 build -> /usr/src/linux-headers-2.6.32-34-generic
drwxr-xr-x 2 root root 4096 2011-11-05 15:49 initrd
drwxr-xr-x 10 root root 4096 2011-11-05 15:49 kernel
.......................................................
.......................................................
The folder /usr/src/linux-headers-2.6.32-34-generic exists.
Since it didnt work, I downloaded the linux-headers-2.6.32-34-generic source from Ubuntu and compiled and changed my Makefile to:
obj-m += hello-1.o
all:
make -C /usr/src/linux-2.6.32/ M=$(PWD) modules
clean:
make -C /usr/src/linux-2.6.32/ M=$(PWD) clean
#make
make -C /usr/src/linux-2.6.32/ M=/home/james/Desktop/hello modules
make[1]: Entering directory `/usr/src/linux-2.6.32'
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /usr/src/linux-2.6.32/Module.symvers
is missing; modules will have no dependencies and modversions.
make[2]: *** No rule to make target `/home/james/Desktop/hello/hello-1.c', needed by `/home/james/Desktop/hello/hello-1.o'. Stop.
make[1]: *** [_module_/home/james/Desktop/hello] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.32'
make: *** [all] Error 2
Could someone help me solving this.http://packages.ubuntu.com/lucid-updates/devel/linux-headers-2.6.32-34-generic
I have some general questions to ask.
After a fresh install what is the best way of compiling a kernel. After I compiled the kernel and built a module it worked flawlessly earlier. But I couldnt know what to do this in this situation
The error:
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /usr/src/linux-2.6.32/Module.symvers
is missing; modules will have no dependencies and modversions.
simply is because your kernel source is newly downloaded and uncompiled before.
This is how u should compile any kernel module.
After download the kernel source, you must prepare it for adding any modules to it.
Copy the older-kernel's "config-xxxx" file from the /boot/ directory into the new kernel source directory, and rename it as ".config".
Then execute "make oldconfig", which will take a backup of the .config into .config.old, and regenerate a new .config based on the new kernel source. Just enter "ENTER" for all the default settings (lots of them).
Next is to do a "make" (and wait for some time) - it will generate a new kernel file "vmlinux", together with many other files which is read by the modules compilation process.
Now you can go to your directory where the kernel module source code is located, and based on the following Makefile:
obj-m += hello-1.o
default: modules
modules:
make -C /kernel_source/ M=$(PWD) modules
clean:
make -C /kernel_source/ M=$(PWD) clean
Together with Makefile are your header and source file, which is hello-1.c located together.
Just "make" and your kernel modules should be generated successfully.
You need to install some package like 'kernel-devel' on Fedora (sorry I am not a Ubuntu user), it provides the headers and .config to compile your kernel module.
make[2]: * No rule to make target
/home/james/Desktop/hello/hello-1.c', needed by/home/james/Desktop/hello/hello-1.o'. Stop
Your are facing this error in the first compilation because hello-1.c file is missing in /home/james/Desktop/hello/ directory.
Check if hello-1.c exists in /home/james/Desktop/hello/ directory.
You need to have modules_enabled in your kernel. You need to compile a fresh kernel to do this.
Following post explains how to build kernel nicely. Enable modules in configuration of kernel build.
http://kernelnewbies.org/FAQ/KernelCompilation