I am a newer in linux and using ubuntu(4.4.0-64-generic) in vmware fusion. I am learning how to compile kernel. So, I downloaded the kernel(linux-4.4.52.tar.xz) from the kernel.org. But when I input make menuconfig, there are some errors.
root#ubuntu:/usr/src/linux-4.4.52# make menuconfig
HOSTCC scripts/basic/fixdep
In file included from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:160:0,
from /usr/include/limits.h:143,
from /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:168,
from /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:34,
from scripts/basic/fixdep.c:114:
/usr/include/x86_64-linux-gnu/bits/local_lim.h:38:26: fatal error: linux/limits.h: No such file or directory
compilation terminated.
scripts/Makefile.host:91: recipe for target 'scripts/basic/fixdep' failed
make[1]: * [scripts/basic/fixdep] Error 1
Makefile:444: recipe for target 'scripts_basic' failed
make: * [scripts_basic] Error 2
I have installed headers files and done everything I can do. Someone can help me solve this problem?
You symbolic link is wrong; /usr/src/linux-4.4.0-64-generic/include/linux is the wrong directory and must not be linked to /usr/include/linux.
The kernel has two sets of headers: kernel-internal headers, and user API headers. The latter are inside the uapi directory, and they are what user-space program should see.
When you are compiling your own kernel, you can install the user-space headers of that kernel with make headers_install.
When you are using your distribution's kernel, you can just (re-)install the appropriate package (in your case, linux-headers-generic), and that will do the right thing as long as you do not muck around with those files afterwards.
Related
I have an external out-of-tree linux kernel module, say foo. Therein, I have a directory include/uapi/ that should, I assume, contain Kbuild file defining inclusion rules and/or headers to export. The directory include/uapi/ on its turn contains one more directory linux having the target user-API headers in, say three files foo.h bar.h baz.h
Ok, I have defined this Kbuild file inside include/uapi and it contains:
header-y += linux/
Then, inside include/uapi/linux directory I've defined one more KBuild and it has the content:
header-y += foo.h bar.h baz.h
Now I am expecting that upon running the command
make -C /lib/modules/5.4.48-dannftk/build M=/home/dannftk/foo INSTALL_HDR_PATH=/home/dannftk/my_exported_headers/ headers_install
I will get the headers installed in the /home/dannftk/my_exported_headers/ directory, instead, I am getting the error saying:
make: *** No rule to make target 'headers_install'. Stop.
/home/dannftk/foo - the path the out-of-tree module discussed is located by
/lib/modules/5.4.48-dannftk/build - the build directory of the kernel, it points to /usr/src/linux-5.4.48 containing the source code of the kernel, actually, I am on Gentoo Linux
May someone give me a hint what I am doing wrongly? Am I incorrectly setting rules for Kbuild? Or maybe I am locating them in unexpected for the kernel build system directories?
Thank you in advance
I personally consider this issue as a bad Kbuild error message. It's too confusing.
The answer is in linux documentation:
--- 2.3 Targets
When building an external module, only a subset of the "make"
targets are available.
make -C $KDIR M=$PWD [target]
The default will build the module(s) located in the current
directory, so a target does not need to be specified. All
output files will also be generated in this directory. No
attempts are made to update the kernel source, and it is a
precondition that a successful "make" has been executed for the
kernel.
modules
The default target for external modules. It has the
same functionality as if no target was specified. See
description above.
modules_install
Install the external module(s). The default location is
/lib/modules/<kernel_release>/extra/, but a prefix may
be added with INSTALL_MOD_PATH (discussed in section 5).
clean
Remove all generated files in the module directory only.
help
List the available targets for external modules.
There were some hacks available in older kernel versions, as adding header-y += ... into Kbuild file, but, as you see, it's not the official approach.
Looks like developers of out-of-tree modules should take care of headers installation manually, without reusing of linux kernel make rules.
I am trying to extend the built-in xfs module of linux kernel. Following this SO post, I am now able to compile it locally. But to avoid conflict with the existing kernel xfs module, I would like to rename my extension to, say xxfs, without changing the name of the source files.
I've found a related post, following which I changed the relevant lines in Makefile to:
obj-$(CONFIG_XFS_FS) += xxfs.o
xxfs-objs := xfs.o
But I got an error saying
make[1]: *** No rule to make target '/home/dev/tmp/xxfs/xfs.o', needed by '/home/dev/tmp/xxfs/xxfs.o'. Stop.
Makefile:1403: recipe for target '_module_/home/dev/tmp/xxfs' failed
make: *** [_module_/home/dev/tmp/xxfs] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.0-28-generic'
Environment:
Ubuntu 16.04 with kernel 4.4.0-28-generic.
EDIT
I got the xfs kernel module source file by
installing the linux kernel source with apt-get source linux-source-4.4.0
copy the linux-4.4.0/fs/xfs to another directory (merely for easy maintenance), currently /home/dev/tmp/xxfs
To compile the module, I run the command make -C /lib/modules/$(uname -r)/build M=$(pwd) modules from the /home/dev/tmp/xxfs directory, after which a xfs.ko will be generated in the same directory.
However after I change the following line in Makefile
obj-$(CONFIG_XFS_FS) += xfs.o
to
obj-$(CONFIG_XFS_FS) += xxfs.o
xxfs-objs := xfs.o
Everything else is not touched, but I am no longer able to compile the module with the same command.
Whilst attempting to make/compile the grafic package, I'm seeing this error after calling the make command within the grafic directory:
f77 -O2 -c grafic1.f
make: f77: No such file or directory
make: *** [grafic1.o] Error 1
I have XCode and all associated command line tools installed, what could be causing this error?
This error is make telling you that you have no binary in your path called f77. There are two things you need to look at the fix this:
Do you have a Fortran compiler installed? MacOS X/Xcode does not come pre-installed with one by default. The easiest options to install one are via third-party tools like macports or homebrew where you can install gfortran which may be a standalone package or may be part of the gcc package.
Once you have a compiler installed, your makefile needs to know about it. Without seeing the makefile this is only an assumption, but if autotools are not used the fortran compiler is usually hardcoded in a variable called FC, e.g. you might see a line
FC=f77
and you would change this to
FC=gfortran
assuming gfortran is in your path.
Once you have a Fortran compiler installed and the makefile knows about it, you should be able to execute make successfully.
On a Leopard Mac mini (PowerPC) I'm trying to compile Apple-GCC-3.3 which I got from https://opensource.apple.com/tarballs/gcc_os/gcc_os-1819.tar.gz
./configure gets completed w.o. any error but make gives the following errors:
When input only "make" it says
make: *** No rule to make target `all', needed by `default'. Stop.
When input make -f Makefile, the make starts fine but somewhere halfway down the process it stops with:
gcc tclAppInit.o -L/Users/macmini/Downloads/gcc_os-1819/tcl/unix -ltcl8.0 -lc \-o tclsh
make[1]: *** No rule to make target `all'. Stop.
make: *** [all-expect] Error 2
For this type of error, it's said that the tar might be dropping long filenames during the untar operation but I tried with different versions of tar such as 1.14, 1.27 and the error is the same.
What should I do? Thanks.
!(http://i.hizliresim.com/Kl9rRJ.png)
(Just in case you may wonder why I want to compile GCC-3.3, it's because it's needed to compile GIMP on PowerPC Macs)
Problem solved. It turned really hard to compile GCC-3.3 from source, so I made it easy and installed it from XCode 3.1 DVD, under the Packages directory where GCC-3.3.pkg was present.
Now the GIMP can be compiled.
Summary: It's a good idea to install the Apple's compiler group of programs from the XCode DVD.
Thanks.
out of sheer curiosity I tried compiling a 2.6.0 kernel on my slackware machine.
root#darkstar:/home/linux-2.6.0# uname -a
Linux darkstar 2.6.37.6-smp #2 SMP Sat Apr 9 23:39:07 CDT 2011 i686 Intel(R) Core(TM)2 Duo CPU P8600 # 2.40GHz GenuineIntel GNU/Linux
When I try compiling I get :-
root#darkstar:/home/linux-2.6.0# make menuconfig
HOSTCC scripts/fixdep
scripts/fixdep.c: In function 'traps':
scripts/fixdep.c:359:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
scripts/fixdep.c:361:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/mconf.o
scripts/kconfig/mconf.c:91:21: error: static declaration of 'current_menu' follows non-static declaration
scripts/kconfig/lkc.h:63:21: note: previous declaration of 'current_menu' was here
make[1]: *** [scripts/kconfig/mconf.o] Error 1
make: *** [menuconfig] Error 2
Some hints on what im doing wrong? Thanks!
How are you doing this to start with?
Typically, you download the latest kernel from kernel.org, copy the tarball to /usr/src, then:
1. tar -zxvvf linux-2.6.xxxx.tar.gz
2. ln -nsf linux-2.6.xxxx linux # ie: Update the "/usr/src/linux" symbolic link to
# point to the new kernel source directory
3. make menuconfig # or make xconfig
4. make modules # Build the kernel modules
5. make modules_install # Install the previously built modules for the
# new kernel
6. make bzImage # Create the boot image
At this point, DO NOT run make install. Most guides say to do this, but this is WRONG! Instead, copy the newly created bzImage file to /boot (ie: find -name bzImage /usr/src/linux, then cp to /boot), then edit your LILO configuration file (edit /etc/lilo.conf, and when done, run lilo), then reboot your system (ie: init 6 or shutdown -r now), and try out the new kernel.
The whole point of skipping the make install step is because it overwrites/replaces your existing kernel. The steps I described above allow you to have the new kernel and your existing kernel both installed and runnable in parallel. If the new kernel is broken or your left out an important option, you can still fall back to your existing stable/working kernel without the need for a boot/recovery CD/DVD.
If I recall well i think you are missing the ncurses libraries. Those are needed to create the interface with menuconfig.
Try a to do a make xconfig from an X session and see if it works.
if that is the case then the ncurses libs are definitely missing.
check with:
ls /var/log/packages/ncurses*
to see if installed