One of frequent mistakes might be typo in another file name.
You example is quite straightforward but what may sometimes confuse are
messages of make
itself. Lets consider an example.
My folder contents is:
$ ls -1
another_file
index.md
makefile
Whereas my makefile
looks like
all: index.html
%.html: %.md wrong_path_to_another_file
@echo $@ $<
Although I do have index.md
where it should be and there is no mistake in the name of it, the message from make
will be
make: *** No rule to make target `index.html', needed by `all'. Stop.
To be honest the message is confusing. It just says, that there is no rule. In fact, it means that the rule is wrong, but due to wildcard (pattern) rules make
cannot determine what exactly caused the issue.
Lets alter makefile
a little, which is to say replace patterns with explicit rules:
index.html: index.md wrong_path_to_another_file
And now the message we get will be:
make: *** No rule to make target `wrong_path_to_another_file', needed by `index.html'. Stop.
Miracle! The following might be concluded:
-
Messages of
make
depends on rules and does not always point to the root of problems -
There might be other problems in your
makefile
different from specified by this message
Now we’ve come up with the idea of checking other dependencies in a rule as well:
all: index.html
%.html: %.md another_file
@echo $@ $<
Only this will provide us with the desired result:
$ make
index.html index.md
No rule to make target | |
GNUmakefile:1: *** missing separator. Stop. | |
Syntax error : end of file unexpected (expecting «fi») | |
OLDPWD not set | |
@echo: command not found | |
-bash: make: command not found | |
Похожие статьи |
No rule to make target
make: *** No rule to make target ‘main.cpp’, needed by ‘main.o’. Stop.
GNUmakefile:1: *** missing separator. Stop.
Если вы видите ошибку
GNUmakefile:1: *** missing separator. Stop.
Обратите внимание на GNUmakefile:1:
1 — это номер строки, в которой произошла ошибка
Возможно где-то вместо табуляции затесался пробел. Напоминаю, что в makefile отступы должны быть заданы табуляциями.
Либо таргет перечислен без двоеточия .PHONY clean вместо .PHONY: clean
Либо какая-то похожая ошибка.
Syntax error : end of file unexpected (expecting «fi»)
Если вы видите ошибку
Syntax error : end of file unexpected (expecting «fi»)
Обратите внимание на расстановку ; в конце выражений и расстановку при переносе строк.
Изучите этот
пример
и сравните со своим кодом.
OLDPWD not set
Если внутри makefile вы выполняете cd и видите ошибку
OLDPWD not set
Попробуйте сперва явно перейти в текущую директорию с помощью
CURDIR
cd $(CURDIR)
@echo: command not found
Если внутри makefile вы пытаетесь подавить вывод echo и получаете
@echo: command not found
Скорее всего echo это не первая команда в строке
НЕПРАВИЛЬНО:
if [ ! -f /home/andrei/Downloads/iso/centos_netinstall.iso ]; then
rm ./CentOS-7-x86_64-NetInstall-*;
wget -r -np «http://builder.hel.fi.ssh.com/privx-builds/latest/PrivX-master/Deliverables/» -A «CentOS-7-x86_64-NetInstall-2009.iso
-*.iso;
else
@echo «WARNING: centos_netinstall.iso already exists»;
ПРАВИЛЬНО:
@if [ ! -f /home/andrei/Downloads/iso/centos_netinstall.iso ]; then
rm ./CentOS-7-x86_64-NetInstall-*;
wget -r -np «http://builder.hel.fi.ssh.com/privx-builds/latest/PrivX-master/Deliverables/» -A «CentOS-7-x86_64-NetInstall-2009.iso
-*.iso;
else
echo «WARNING: centos_netinstall.iso already exists»;
-bash: make: command not found
Ошибка
-bash: make: command not found
Означает, что make не установлен.
Установить make в rpm системах можно с помощью yum в deb система — с помощью apt
sudo yum -y install make
sudo apt -y install make
make | |
Основы make | |
PHONY | |
CURDIR | |
shell | |
wget + make | |
Переменные в Make файлах | |
ifeq: Условные операторы | |
filter | |
-c: Компиляция | |
Linux | |
Bash | |
C | |
C++ | |
C++ Header файлы | |
Configure make install | |
DevOps | |
Docker | |
OpenBSD | |
Errors make |
This step-by-step troubleshooting guide will help you resolve the make: *** no rule to make target 'install'. stop.
error that occurs during the compilation and installation of a software package from source code. This error typically indicates that the Makefile
doesn’t have a target rule named install
. Follow the steps below to resolve this issue.
Prerequisites
Before proceeding with the troubleshooting steps, ensure that you have the following installed in your system:
- A compatible version of
make
utility - Necessary development tools and libraries for the software package
Table of Contents
- Step 1: Verify the Installation Instructions
- Step 2: Check the Makefile for the Install Target
- Step 3: Look for an Alternative Makefile
- Step 4: Manually Create the Install Target
- FAQs
Step 1: Verify the Installation Instructions
Before diving into the Makefile
, make sure to carefully read the installation instructions provided in the software package. The installation steps may vary depending on the package, so it’s essential to follow the instructions as closely as possible. Look for a README
or INSTALL
file in the package directory and follow the steps mentioned.
Step 2: Check the Makefile for the Install Target
Open the Makefile
in a text editor and search for a target named install
. If you find it, ensure that it’s not commented out. If the install
target is missing, proceed to the next step.
Step 3: Look for an Alternative Makefile
In some cases, the software package may include more than one Makefile
. These alternative Makefile
s may have different names, such as Makefile.install
, Makefile.src
, or Makefile.local
. Check the package directory for any such files and verify if they contain an install
target. If you find a suitable alternative Makefile
, use it with the -f
flag:
make -f Makefile.alternative install
Step 4: Manually Create the Install Target
If none of the above steps work, you can create an install
target manually in the Makefile
. To do this, follow these steps:
- Open the
Makefile
in a text editor. - At the end of the file, add the following lines:
install:
cp binary_name /usr/local/bin/
Replace binary_name
with the appropriate name of the compiled binary generated by the make
command.
- Save the
Makefile
and runmake install
again.
If the above steps don’t resolve the issue, refer to the software package’s documentation, forums, or issue trackers for further assistance.
FAQs
Q1: What does the make: *** no rule to make target 'install'. stop.
error mean?
The error make: *** no rule to make target 'install'. stop.
indicates that the Makefile
doesn’t have a target rule named install
. This target is usually responsible for installing the compiled software binaries and associated files in the appropriate system directories.
Q2: How do I check if the install
target is available in the Makefile
?
Open the Makefile
in a text editor and search for a target named install
. If you find it, ensure that it’s not commented out.
Q3: Can I use an alternative Makefile
with a different name?
Yes, you can use an alternative Makefile
with a different name. To do so, use the -f
flag with the make
command, like this:
make -f Makefile.alternative install
Q4: How do I manually create an install
target in the Makefile
?
To manually create an install
target in the Makefile
, open the file in a text editor and add the following lines at the end:
install:
cp binary_name /usr/local/bin/
Replace binary_name
with the appropriate name of the compiled binary generated by the make
command.
Q5: What should I do if none of the steps in this guide resolve the issue?
If none of the steps in this guide resolve the issue, refer to the software package’s documentation, forums, or issue trackers for further assistance.
- GNU Make Manual
- Introduction to Makefiles
- Common Makefile Mistakes
The no rule to make target cmake bug nearly always affects scripts and documents without an adequate vertex file or command. In addition, developers and programmers must ensure they are in the correct directory when creating the file to avoid the no rule to make target cs50 invalid code snippet that halts all operations.
This comprehensive guide answers the hot network questions tagged by beginners and less skillful developers, provides the syntaxes that replicate the bug, and lists the possible solution principles.
So, you are at the best place if you want to learn how to obliterate the no rule to make target so errors from your document without any complications or obstacles.
Contents
- Why No Rule To Make Target Exists? Explaining the Possible Causes
- – Using GCC Linux With Make File
- – The File Is Not in the Current Directory
- – Building a Template Project on MPLABX
- No Rule To Make Target: Presenting The Ultimate Solution
- – Fixing the Backlash in the Multi-line Rule
- Conclusion
Why No Rule To Make Target Exists? Explaining the Possible Causes
The no rule to make target Ubuntu error is caused when programmers have a document or a script without a fair vertex file or command. Unfortunately, users may also experience the no rule to make target o exceptions when the functions, values, or powers have several spelling errors and inconsistencies.
Furthermore, our experts confirmed an identical code snippet exception when their build configurations lack proper directories or values. For instance, the system may display the annoying no rule to make target in C bug when the project location or workspace location is wrong, although users wrote most of the code successfully.
In this case, developers must create another workspace in the uppermost directory to repair the no rule to make target all. Again, readers must learn more about the possible culprits and incorrect syntaxes before discovering plausible solutions.
In addition, this error can affect your programming experience when your project misses or has a corrupted primary makefile. Still, this instance is different from typical, and only a few developers have encountered it, but knowing it exists is critical.
In addition, readers must be aware this guide discusses the no rule to make target vs code differences because they are irrelevant when learning how to debug your document. So, let us begin exemplifying the possible culprits for this aggravating mistake that affects short and complex programs or applications.
– Using GCC Linux With Make File
The first instance we exemplify in this guide attempt to use a make file to compile the project on GCC Linux. The script includes several elements and commands that introduce the primary and secondary operations, but the program faces an entirely incorrect code snippet.
However, we will only show you the complete project with some documents and files because our experts would like to focus on the make file. But first, let us learn about the exception that stops the processes and blocks your project.
Readers can discover the entire message in this example:
“No rule to make target ‘vertex.cpp’, needed by ‘vertex.oo’. Stop.”
This snippet confirms the script has issues with the vertex file, so it launches a stop. Still, debugging the mistake is easy, as you will soon learn. We will now provide the make file syntax that provokes this bug due to the lack of correct vertex files.
The following code uses the make file in GCC Linux:
g++ vertex.o edge.o elist.o main.o vlist.o enode.o vnode.o
main.o: main.cpp main.h
g++ -c main.cpp
vertex.o: vertex.cpp vertex.h
g++ -c vertex.cpp
edge.o: edge.cpp edge.h
g++ -c num.cpp
vlist.o: vlist.cpp vlist.h
g++ -c vlist.cpp
elist.o: elist.cpp elist.h
g++ -c elist.cpp
vnode.o: vnode.cpp vnode.h
g++ -c vnode.cpp
enode.o: enode.cpp enode.h
g++ -c node.cpp
Although looking at the directory listing of this file is beneficial, it is irrelevant when applying the debugging solutions discussed later.
– The File Is Not in the Current Directory
As the previous chapter explained, the lack of adequate make files is one of the most common causes of this error. However, unlike that example where the vertex file did not exist, this script confuses the command because the file is not in the current directory.
In addition, programmers wrote this syntax on Linux, so several properties and elements might overlap. This time, however, we will provide the running command for the operation.
This script provides the make file commands:
OBJS = main.o mapp.o extended_map.o elections.o utilities.o
EXEC = election
DEBUG_FLAG = -DNDEBUG
COMP_FLAG = -std=c99 -Wall -pedantic-errors -Werror
$(EXEC) : $(OBJS)
$(CC) $(DEBUG_FLAGS) $(OBJS) -o $@
main.o: main.c map.h elections.h test_utilities.h
$(CC) -c $(DEBUG_FLAGS) $(COMP_FLAGS) $*.c
map.o: map.c map.h utilities.h
$(CC) -c $(DEBUG_FLAGS) $(COMP_FLAGS) $*.c
extended_map.o: extended_mapp.c extended_map.h map.h utilities.h
$(CC) -c $(DEBUG_FLAGS) $(COMP_FLAGS) $*.c
election.o: elections.c elections.h map.h extended_map.h utilities.h
$(CC) -c $(DEBUG_FLAGS) $(COMP_FLAGS) $*.c
utilities.o: utilities.c utilities.h
$(CC) -c $(DEBUG_FLAGS) $(COMP_FLAGS) $*.c
clean:
rm -f $(OBJS) $(EXEC)
This code snippet confirms the map file exists in a different folder than the primary directory. Henceforth, the system has nothing to catch on to, displaying the error that halts further operations.
Still, readers must learn more about the running command shown below:
elections.c extended_map.c main.c
makefile mtm_map utilities.c
elections.h extended_mapp.h main.o
map.h test_utilities.h utilities.hh
-bash-4.1$ make
make: *** No rule to make target `map.c’, needed by `map.o’. Stop.
-bash-4.1$
As you can tell, the exception snippet is nearly identical because it stops a specific file.
– Building a Template Project on MPLABX
A few programmers reported an identical invalid syntax when building a template project on MPLABX, either in new or old versions. The user attempts to call out the project in the XC16 compiler guide, but the entire build fails, and the system launches this message.
This is especially typical for new users that install the MPLABX software and the adequate compiler suite without playing around with the values and settings. As a result, one of the C source files confuses your system and prevents developers from finishing their projects.
The following sequence captures the commands and processes:
make[1]: Entering directory `C:/ Users/ Noah/ MPLABXProjects/ first_xc16_project.X’
make -f nbproject/ Makefile-default.mk dist/ default/ production/ first_xc16_project.X.production.hex
make[2]: Entering directory `C:/ Users/ Noah/ MPLABXProjects/ first_xc16_project.X’
make[2]: Leaving directory `C:/ Users/ Noah/ MPLABXProjects/ first_xc16_project.X’
make[2]: *** No rule to make target `../../../../Program Files (x86)/ Microchip/ xc16/ v1.20/ support/ templates/ c/ traps.c’, needed by `build/ default/ production/ _ext/ 908808360/ traps.o’. Stop.
make[1]: Leaving directory `C:/ Users/ Noah/ MPLABXProjects/ first_xc16_project.X’
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 300ms)
In theory, this mistake should not affect your project in MPLABX because the C file is full-proof and is not case-sensitive. But, unfortunately, the special cases and characters in Windows 7 64-bit folder names can launch several inconsistencies.
Ultimately, the bug happens because the compiler version does not match the original one. So, let us now begin solving this mistake that obliterates your user experience.
No Rule To Make Target: Presenting The Ultimate Solution
You can debug the no rule to make target by double-checking your code for any obvious mistakes in the make file that might confuse your system or application. Moreover, the ultimate solution to this error is fixing the backlash in multi-line rule.
For instance, the messages inside the files sometimes need to be clarified, especially in projects with many commands, processes, and operations. Luckily, this guide takes you on a step-by-step journey to clear your script.
Let us first learn about the folder contents:
another_file
index.md
makefile
Everything looks ordinary and functional here so we will discover the make file and its properties in the following example:
%.html: %.md wrong_path_to_another_file
@echo $@ $<
Unfortunately, this example is not functional because the dependencies are invalid. In addition, although developers might try to change the patterns with explicit rules, the error will persist. Luckily, developers can follow our code to check the directories and fix any typos in the script.
The following example checks other dependencies and rules:
%.html: %.md another_file
@echo $@ $<
For instance, the make file messages depend on the rules and only sometimes point to the problem’s root. As a result, programmers must think outside the box and fix the locations and typos in different files.
Consequently, this clears your script and outputs the following result:
index.html index.md
This snippet completes the primary solution for this bug. Fortunately, this guide includes other possible solutions and fixes that repair the backlash in the multi-line rule.
– Fixing the Backlash in the Multi-line Rule
Although the solution is sometimes as straightforward as checking if the specified file exists, readers must learn alternative approaches in case something else is needed. In addition, developers can confirm they are in the correct directory, which only takes a few seconds.
However, this chapter fixes the backlash in multi-line rules and adds the right symbols to the source libraries. These solutions are full-proof and will not affect other commands and processes in your script.
First, we will provide the source library with invalid commands:
LIBRARYDIRS = src/TheOtherLibrary
This example is incorrect due to a single symbol before the source. Instead, developers must repeat the following script:
LIBRARYDIRS += src/TheOtherLibrary
The plus symbol in this syntax is vital when debugging your code because it establishes the purpose. In addition, users can change the multi-line rules in the make file.
The following example provides the invalid values:
file3.o file4.o
OBJS-$(CONFIG_OBJ2) += file5.o
OBJS-$(CONFIG_OBJ3) += file6.o
…
The backlash at the end of the configuration in the file list causes this bug. So, deleting it removes the error without further complications, as shown here:
file3.o file4.o
OBJS-$(CONFIG_OBJ2) += file5.o
…
As you can tell, a few single code changes can replenish your code and enable all commands and functions. This example also confirms symbols are critical when programming and programmers must never misplace them.
Conclusion
The no rule to make target bug nearly always affects scripts and documents without an adequate vertex file or command, but it can happen due to a lack of correct symbols. So, the following bullet list will help you remember the vital points covered in our in-depth guide:
- This bug affects all operating systems and programs, although it is most common in Linux
- The error has several common culprits exemplified in this guide’s introductory chapters
- Programmers and developers must always double-check the script for typos or incorrect directories
- The alternative solutions are full-proof and easy to replicate, although each syntax is unique
- Removing the invalid code snippet allows developers to complete the project
Experiencing bugs and errors is typical when programming and should not put off beginners or developers who are just starting their programming journey. Hopefully, this guide helped you overcome the rule target error from your script.
- Author
- Recent Posts
Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team
I am doing an install of git on Ubuntu 20.04, according to this tutorial. I executed from «Install Git on Linux«, the Debian/Ubuntu parts. And then I get the errors:
make: *** No rule to make target 'all'. Stop.
make: *** No rule to make target 'install'. Stop.
at point 3 under «Build Git from source on Linux«. I am new to Linux, but it seems as though make
is automatically installed. When I run:
apt list --installed
it is listed:
make/focal,now 4.2.1-1.2 amd64 [installed,automatic]
Can you help on how to take this forward or approach learning about the problem?
Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team
I am doing an install of git on Ubuntu 20.04, according to this tutorial. I executed from «Install Git on Linux«, the Debian/Ubuntu parts. And then I get the errors:
make: *** No rule to make target 'all'. Stop.
make: *** No rule to make target 'install'. Stop.
at point 3 under «Build Git from source on Linux«. I am new to Linux, but it seems as though make
is automatically installed. When I run:
apt list --installed
it is listed:
make/focal,now 4.2.1-1.2 amd64 [installed,automatic]
Can you help on how to take this forward or approach learning about the problem?
asked Jul 4, 2021 at 16:23
1
There are multiple ways to install software in Ubuntu. You can install software using APT, Snap, Flatpak, AppImage, installing from source, etc.
As far as what I can understand, you are trying to install git
from source.
I would personally not suggest new Ubuntu/Linux users to install software from source as it is a bit complex than compared to other methods.
In the article which you have mentioned, following these steps will install git
using APT:
Debian / Ubuntu (apt-get)
Git packages are available via apt:
- From your shell, install Git using apt-get:
$ sudo apt-get update
$ sudo apt-get install git
- Verify the installation was successful by typing
git --version
:$ git --version
git version 2.9.2
- Configure your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that you create:
$ git config --global user.name "Emma Paris"
$ git config --global user.email "eparis@atlassian.com"
To know more about installing software in Ubuntu, read these:
- https://medium.com/geekculture/5-different-ways-to-install-software-on-ubuntu-linux-14ae6b95d1d2
- How do I install a .tar.gz (or .tar.bz2) file? (I suggest you research a bit about
checkinstall
.)
answered Jul 4, 2021 at 17:36
Random PersonRandom Person
1,4741 gold badge13 silver badges31 bronze badges