getting error "make: *** No rule to make target `all'. Stop." while running this command "make all" during installing nagios host - linux

Getting error:
make: *** No rule to make target all. Stop."
while running this command make all during installing nagios host

Possible common mistakes:
Be sure to name the file makefile and run the command in same directory.
Make sure that there is a target named all in the file with proper indentation. You can open with vim to see if there is an indentation issue.
An example makefile with target all could be like this:
all: a.c
gcc a.c
If you have trouble figuring out the issue, append your makefile along with the question to help others resolve it.

Related

Problems building driver on Linux kernel 5.8.x

I'm working with a Linux driver that is building on v5.7.x kernels but not on the latest v5.8.x releases.
To summarise, most of the driver is pre-built and the kernel interface is built on the target. This involves a make -f Kbuild command.
Having checked all of the relevant kernel interface files for any changes that would affect us, normally the driver would just build as usual on a new kernel. However, this time we get the following error:
make[2]: *** [scripts/Makefile.modpost:111: /path/to/source/Module.symvers] Error 1
make[1]: *** [Makefile:1669: modules] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.8.0-1.el8.elrepo.x86_64'
make: *** [Kbuild:26: default] Error 2
This is from CentOS 8.1, but the same error has been seen on Ubuntu 20.04.
I am no expert on this so interpreting these errors is a bit difficult. I have tried building with the KBUILD_VERBOSE flag and it doesn't really provide any useful information, other than the build succeeding until this point.
On previous kernels the Module.symvers file would be created but empty. On 5.8 this file is not created at all presumably due to this error. As a result, the .ko file is not created.
Finally, if we drop in the source files rather than the pre-built .o files the build does succeed. These .o files are built with a very old version of GCC (4.4.7) but we have also tried building with a much newer version (8.3.1), the same version as the target machine.
I would appreciate suggestions for things to check. Let me know if any other details would help.
Edit:
I ran make on Makefile.modpost manually and got the following output:
sudo make -f ./scripts/Makefile.modpost
WARNING: Symbol version dump "vmlinux.symvers" is missing.
Modules may not have dependencies or modversions.
make -f /scripts/Makefile.modfinal
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-050800-generic'
make[1]: /scripts/Makefile.modfinal: No such file or directory
make[1]: *** No rule to make target '/scripts/Makefile.modfinal'. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-050800-generic'
make: *** [scripts/Makefile.modpost:117: __modpost] Error 2
I am answering my own question in case it helps anyone else with this problem. Although it has never been an issue in the past, we've always had a warning that the corresponding .o.cmd file was not present for our .o_shipped files. This appears to be important in kernel 5.8 onwards and my fix was to add a touch command to the Kbuild file (i.e. "touch .driver.o.cmd"). This does not remove the warning but it allows the driver to build as normal.

Device driver compilation error on linux

I have started writing device driver and written first character driver and got the compilation error:
scripts/Makefile.build:44: /home/betatest/Public/Device-Driver-Test/first-driver/Makefile: No such file or directory
make[2]: *** No rule to make target '/home/betatest/Public/Device-Driver-Test/first-driver/Makefile'. Stop.
Makefile:1448: recipe for target '_module_/home/betatest/Public/Device-Driver-Test/first-driver' failed
make[1]: *** [_module_/home/betatest/Public/Device-Driver-Test/first-driver] Error 2
make[1]: Leaving directory '/usr/src/kernels/2.6.32-573.12.1.el6.x86_64'
makefile:19: recipe for target 'default' failed
make: *** [default] Error 2
My make file name is "makefile"?
while studying makefile it is written that default name of makefile can be Makefile or makefile it does not make difference for make utility. Does the name matters for device drivers makefile ? Should the name of make file for device driver compulsorily be "Makefile"? If so why?
Any help would be appreciated.
The script is not running make with a default name. The script is giving -f /home/betatest/Public/Device-Driver-Test/first-driver/Makefile which does not exist.
while studying makefile it is written that default name of make file can be Makefile or makefile it does not make difference for make utility
True enough. When you invoke the make command, it knows to look for either of Makefile or makefile.
But there could be other reasons why you are seeing this error. It is possible that the script invokes make with an explicit -f argument to look for a Makefile. Take a look at line 44 in scripts/Makefile.build.
What Name to Give Your Makefile
When you use make utility it will search in order as GNUmakefile, makefile and Makefile.First name is not recommended as it should be used when GNU make utility is used. For non-standard name of makefile you can specify --file or -f with make utility.
Its seems that line 44 has error .Try to compile that makefile with -f option.

How do I find the actual GCC error in compiler output?

I'm trying to compile some old software from source on debian-based linux.
The build failed:
make[2]: Leaving directory '/home/owner/kallistios/utils/dc-chain/build-gcc-sh-elf-4.7.3'
Makefile:871: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/owner/kallistios/utils/dc-chain/build-gcc-sh-elf-4.7.3'
Makefile:201: recipe for target 'build-sh4-gcc-pass2' failed
make: *** [build-sh4-gcc-pass2] Error 1
owner#ubuntu:~/kallistios/utils/dc-chain$
But it doesn't say what the actual error is or how I can find it in the output.
If I don't know what the problem is obviously I can't fix it.
This is the full output:
http://pasted.co/cff68fa2
The first thing to do if you're having problems deciphering error output is to NOT run the build in parallel (don't use the -j flag). Also you should NOT use the keep-going (-k) flag. If you don't use -j or -k then make will run one recipe at a time and fail as soon as a recipe fails. So, whenever you get an error the last command that was printed is the one that failed.
Also if you want to use -j and you're using a new-enough version of GNU make (4.0 or above) you can add the -Otarget option which will collect all the output from a given target and print it atomically at the end of the recipe, rather than interweaving output from different recipes together.
In your situation it appears as though one of the configure operations failed. It's not easy to tell exactly why because of the parallel build output. This may or may not be related:
kos is an unknown thread package
...
Makefile:3810: recipe for target 'configure-gcc' failed
make[2]: *** [configure-gcc] Error 1
You are trying to compile the Sega Dreamcast toolchain which I know very well, using the dc-chain utility inside KallistiOS (often shortened to KOS).
The key error message here is kos is an unknown thread package. It means that you don't have applied the KOS patches before compiling your sh-elf cross-compiler.
To solve this issue, you just have to enter the make patch command before running everything else. Please note, if you just enter the make command, it will already apply the patches.
To finish this answer, you may check the KallistiOS Nitro repository, as this repo is handling the official KOS plus a lot of community patches, including some very interesting things about the dc-chain utility, like complete documentation.

Linux 3.13 Kernel Fails to Compile

After configuring various options inside .conf using
$make config
I try to compile the entire linux kernel using
$make
However it throws an error as below:
root#localbox:/LinuxKernel/linux-3.13# make
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
root#localbox:/LinuxKernel/linux-3.13#
I tried to search for .conf by using:
$find -name ".conf"
However it turns up no results. But since make config worked I assume .config must exist somewhere.
Please advise me on how to overcome this annoying problem. I am doing this for the first time and I am not sure if there are any dependencies that have to be installed before trying to compile the kernel. Your feedbacks are highly appreciated.
There must have been some error with make config, e.g. disk full or you aborted it with Ctrl-C. The .config file (not .conf) is right in the main directory.
The error message says it already
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
There are several textbased (config, oldconfig, menuconfig) and graphical (xconfig, gconfig) configuration programs. You might want to pick a graphical one and run it, e.g.
make gconfig
These graphical configurators also help to avoid all the hundreds of irrelevant questions. When you're done selecting the needed options, don't forget to save the .config file and try again compiling the kernel and modules.

Error while building glibc

I'm trying to install glibc to debug a C-framework I'm working on. But, I'm getting an error in the build process. Here's the error msg:
make[3]: Leaving directory `/root/glibc-source/glibc-2.14/elf'
/usr/bin/install -c /root/glibc-2.14-build/elf/ld.so /usr/local/myglibc/lib/ld-2.14.so.new
mv -f /usr/local/myglibc/lib/ld-2.14.so.new /usr/local/myglibc/lib/ld-2.14.so
/usr/bin/install -c /root/glibc-2.14-build/libc.so /usr/local/myglibc/lib/libc-2.14.so.new
mv -f /usr/local/myglibc/lib/libc-2.14.so.new /usr/local/myglibc/lib/libc-2.14.so
echo ld-2.14.so /usr/local/myglibc/lib/ld-linux-x86-64.so.2 >> /root/glibc-2.14-build/elf/symlink.list
/usr/bin/install -c /root/glibc-2.14-build/elf/sotruss-lib.so /usr/local/myglibc/lib/audit/sotruss-lib.so.new
mv -f /usr/local/myglibc/lib/audit/sotruss-lib.so.new /usr/local/myglibc/lib/audit/sotruss-lib.so
make[2]: *** No rule to make target `/root/glibc-2.14-build/dlfcn/libdl.so.2', needed by `/root/glibc-2.14-build/elf/sprof'. Stop.
make[2]: Leaving directory `/root/glibc-source/glibc-2.14/elf'
make[1]: *** [elf/subdir_install] Error 2
make[1]: Leaving directory `/root/glibc-source/glibc-2.14'
make: *** [install] Error 2
Is this a known problem?
I had built glibc on the same machine earlier last week without any errors. I'm rebuilding it because glibc is compiled with optimization level 2(-O2) by default and I'm unable to look into the values of a few variables inside the library functions from the code dump as they've been optimized out. I'm currently trying to compile with optimization level 1.
Thanks
It looks like you are trying to make install, without first doing a successful make all.
This is for the benefit of anyone who might be trying to build glibc on their ubuntu box.
I went through the following problems and resolved them the following way.
These problems were encountered in ubuntu 12.04
I created a directory glib-build on the same level as the glib-VERSION and ran the following command
$> ../glibc-2.16.0/configure --prefix=/home/gugovind/tsapp/glibc/glibc-build/
that gave me the following error that makeinfo is missing.
for that
$>sudo apt-get install texinfo
will resolve the problem.
It threw and error about LD_LIBRARY_PATH having the current directory (even if it does not exist)
for that run the following in your command prompt
$>set LD_LIBRARY_PATH
this will clear the LD_LIBRARY_PATH only for that console temporarily. Then run the configure again.
You might encounter another problem with configure..
"function strtonum never defined"
look at the config.log file and it might be missing mawk or gawk. install them using
sudo apt-get install gawk
This should get you through the configure part.
now run
make all
if in case you encounter a particular file not compiling.. just copy the gcc ... before that and paste it in the command prompt again after you have cd to that directory (the command lines before the error should tell you where to go.)
make install
You might get a warning about not able to find etc/ld.config... file. ignore that..
you are all set now.

Resources