导航:首页 > 程序命令 > ubuntu的make命令找不到

ubuntu的make命令找不到

发布时间:2022-12-09 14:09:07

㈠ Ubuntu bochs源码安装时出现: make: *** 没有指明目标并且找不到 makefile。 停止。

用ubuntu中的ubuntu软件安装中心安装的bochs不带调试功能,所以我们要用源码安装bochs.

从http://sourceforge.net/projects/bochs/files/ 下载bochs-2.4.5.tar.gz

然后

tar vxzf bochs-2.4.5.tar.gz
cd bochs-2.4.5
./configure --enable-debugger --enable-disasm
make
sudo make install

结果出错,解决的办法是:

问题1:
checking for C compiler default output file name… configure: error: C compiler cannot create executables
解决办法:
[thornbird@thornbird bochs-2.4]$ sudo apt-get install libc6-dev
问题2:
...
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
解决方法:
[thornbird@thornbird bochs-2.4]$ sudo apt-get install build-essential

问题3:
[thornbird@thornbird bochs-2.4]$ make
make: *** 没有指明目标并且找不到 makefile.停止。
解决方法:
[thornbird@thornbird bochs-2.4]$ sudo apt-get install build-essential

问题4:
...
checking for wxWidgets library version...
checking for default gui on this platform... x11
ERROR: X windows gui was selected, but X windows libraries were not found.

解决方法: 配置的时候加上"--with-nogui "
或者改成:[thornbird@thornbird bochs-2.4]$sudo apt-get install xorg-dev (建议)

问题5:

Package gtk+-2.0 was not found in the pkg-config search path.Perhaps you should add the directory containing `gtk+-2.0.pc'to the PKG_CONFIG_PATH environment variableNo package 'gtk+-2.0' foundERROR: pkg-config was not found, or unable to access the gtk+-2.0 package.Install pkg-config and the gtk+ development package,or disable the gui debugger, or the wxWidgets display library (whichever is being used).

解决方法:

[thornbird@thornbird bochs-2.4]$sudo apt-get install libgtk2.0-dev

问题6:

install: 无法获取"./bochsdbg" 的文件状态(stat): 没有该文件或目录

解决办法:需要在make后,将bochs拷贝一份,命名为bochsdbg

[thornbird@thornbird bochs-2.4]$ cp bochs bochsdbg

㈡ ubuntu linux里面 make 命令不能用 怎么决

从问题补充来看,你的g++没有安装,你安装一下g++即可,安装g++的方法如下:
1、按Ctrl+Alt+T快捷键打开终端。
2、输入:sudo apt-get install g++ 命令,然后回车。
3、输入root用户密码(输入的时候不会显示,输入完成后回车就行了)。
4、等待安装完成。
通过以上步骤基本就能安装好g++了。

㈢ 我装的linux 系统中没有make命令,没有很多命令,比如init 、reboot、shutdown等等,怎么办能安装rpm,

这些命令应该是最基本的命令,不应该没有安装的
可能是你的权限不够,或者是你的$PATH不正确导致的
首先你是用root用户执行的吗?
然后看下echo $PATH,你的路径中是否包含了/bin;/sbin;/usr/bin;/usr/sbin目录呢?

㈣ make命令找不到makefile 怎么解决

我勒个去,ls你太无耻了吧,那是我原来发的帖,也是我的作业,你居然给我硬生生的复制过来也不注明一下?拜托你注明一下OK?而且你明明就是答非所问。

如果没记错的话,ubuntu是需要装一个patch才能用make命令的,而redhat(fedora)都是集成了的。

㈤ Ubuntu下面Makefile的使用方法

运行可执行文件hello

./hello

移除文件 rm hello

编译文件得到可执行文件的同时,保留产生的中间文件

g++ -save-temps hello_world.cpp -o hello

单个文件编译过程:
实际的编译过程:预处理,对应临时文件hello_world.ii

g++ -E hello_world.cpp -o preprocessed.ii

cat preprocessed.ii

预处理的工作主要包含去掉注释,然后将我们include的库tack上,以上过程使我们自己主动调用预处理器的过程

cat hello_world.ii

则展示了我们在第5)中编译时保留的中间文件,两者是一样的

实际的编译过程:这是真正的编译过程compilation step,对应临时文件hello_world.s(assembly code)

我们自己把.ii文件进行assembly code得到.s的方法。

g++ -S preprocessed.ii -o complied.s

.s文件是高级语言和机器语言之间的中间环节

实际的编译过程:Assembly,将.s对应的assembly code转换成.o对应的机器语言的过程,也叫machine-readable code或者object code

让编译器将.s文件assembly起来

g++ -c complied.s -o assembled.o

实际的编译过程:最后一步Linking,产生最终的可执行文件。

"Undefined reference" errors are pretty much always linking errors, and you will probably have them. Remember this.

我们通过连接一堆.o文件,得到.exe文件的过程,命令:

g++ assembled.o -o hello_manual

多个文件编译过程:
举例,如果我们有定义一个class,然后我们的文件中包含dog.hpp,dog.cpp和main.cpp三个文件,然后我们只使用以下两个命令:

g++ -c main.cpp -o main.o

g++ main.o dog_program

的话就会出错,告诉我们undefined reference of dog::bark()

因为对于不同的.cpp文件,都要生成一个object file,也就是.o文件。所以如果我们用以下命令:

g++ -c main.cpp -o main.o

g++ -c dog.cpp

g++ dog.o main.o -o dog_program

的话,就不会出错。

我们如果修改main.cpp中的内容的话,我们只需要重新用最后一个连接命令。但是,如果我们修改了dog class本身的内容的话,例如添加一个函数,我们就需要重新产生object file of dog.cpp,然后重新连接。

关于Make的介绍
用自己常用的记事本创建一个Makefile,并注意大小写。在program对应的目录下面。

gedit Makefile

Makefile里面语句的书写规则是

Target: tgt_dependency1 tgt_dependency2 ……
Command

所以dog.o和main.o对应的语句分别是:

dog.o: dog.hpp dog.cpp
g++ -c dog.cpp

main.o: main.cpp
g++ -c main.cpp

在Makefile中Tab是很重要的,所以不要忘记在command对应的第二行加Tab

Makefile的编译顺序

如果Makefile中有如下语句

animal_assembly : moose goose cat
command

moose : antlers hooves fur
command

goose : beak wings webbed_feet interest_in_bread
command

cat : whiskers evil_personality
command

我们可以看到animal_assembly的dependency是 moose goose cat。如果文件夹中存在moose goose cat的话,make命令只需要执行第一句就可以了。如果文件夹中缺少moose goose cat中的一个或者几个,make命令执行的时候,需要先找到moose goose cat的生成方法,然后执行对应的命令,最后执行animal_assembly生成的命令。

moose : antlers hooves fur
command

animal_assembly : moose goose cat
command

goose : beak wings webbed_feet interest_in_bread
command

cat : whiskers evil_personality
command

如果Makefille是以上形式的话,我们只运行make的话,Makefile会只执行第一句,因为第一句的dependency都存在了,所以只把moose生成的命令执行完就好了。如果我们要生成animal_assembly,就要运行命令make animal_assembly。所以,我们需要把最重要的命令,我们最重要生成的object file对应的命令放在第一行。

所以我们的dog_program的完整的Makefile文件应该是:

dog_program: dog.o main.o
g++ dog.o main.o -o dog_program

dog.o: dog.hpp dog.cpp
g++ -c dog.cpp

main.o: main.cpp
g++ -c main.cpp

在Makefile的最后写clean语句。

clean:
rm dog_program *.o

然后我们在命令窗口运行make clean的话,就会删除文件夹中生成的可执行文件,和所有过程中产生的副产品。

对于Makefile中的dependency list,我们需要将每个object file的dependency list都写好。因为make不负责检查文件中的具体的语句,只负责执行Makefile中的语句。

dog_program:
g++ dog.o main.o -o dog_program

dog.o: dog.hpp dog.cpp
g++ -c dog.cpp

main.o: main.cpp
g++ -c main.cpp

如果像上面所示去掉dog_program的dependency list的话,运行make就会出错,因为main是依赖于dog.cpp的。

如果文件中本身就存在dog.o和main.o的话,运行make不会出错,因为make就是先check dog.o main.o是否存在,存在的话就直接运行。

所以,我们如果修改了main.cpp或者dog.cpp的话,我们需要重新生成dog.o和main.o。因为make是不管这个问题的。

make这个命令的功能就是执行Makefile中我们要求执行的语句,对结果没有任何的预期,也不会检查命令有没有问题。所以,我们必须遵守Makefile书写中的一些规则。

all : fill_file_with_nonsense
echo "I have mostly created a lot of junk today!"

fill_file_with_nonsense : create_file
echo "Hello, there is nothing important here" > silly_file

create_file :
touch silly_file touch是Unix中的典型命令,用于生成空的文件

move_file :
mv silly_file silly_file_new_name

delete_file :
rm _file

open_file :
gedit another_silly_file

clean :
touch junk1 junk2 junk3 junk4 junk5

really_clean :
rm junk*

如果想体验的更加清楚,就可以运行这个文件中的内容,然后就知道make完全不会管结果是什么,只是没有脑子的执行命令。

解释上面的内容:

Makefile的书写规则。all: 放在第一句,把所以我们要生成executable依赖的Targets列出来,这样我们需要的所有的文件都可以生成。我们看到all对应的dependency是file_file_with_nonsense,就去找file_file_with_nonsense的生成语句,发现它的dependency是create_file,然后去找create_file的生成语句,就到touch silly_file,touch是Unix中的典型命令,用于生成空的文件。create_file的语句执行完之后,回到file_file_with_nonsense,执行echo "Hello, there is nothing important here" > silly_file,就把"Hello, there is nothing important here" 写入silly_file中,file_file_with_nonsense的语句也执行完之后,我们就返回到all,然后在命令行输出"I have mostly created a lot of junk today!"。

因为其他的target,不在all的dependency list中,也不在all的dependency的dependency当中,所以只能通过make target的形式来调用对应的命令。

Marvelous macros(宏)
一个宏的示例,宏就是Makefile中的variables,用来定义我们需要的操作,一些变量之类的

CXX = clang++

FLAGS = -O

hello : hello_world.cpp
$(CXX) $(FLAGS) $? -o $@

clean :
rm hello

CXX,这是一个预定义的宏,default value是g++。这里把CXX定义成clang++了。

FLAGS,这里定义的是-O。FLAGS也不一定非得定义成-o,也可以是some moose have large antlers,但是这样定义的话,就会导致调用的时候出错。

对于上面的文件,我们在命令行输入make的时候,实际运行的是clang++ -O hello_world.cpp -o hello。

如果我们把CXX=clang++这一行删掉的话,在命令行输入make,实际运行的就是g++ -O hello_world.cpp -o hello。

定义好macro宏,我们使用的时候,就要用$(MACRO)这样的形式,这是makefile语言的一种语法。我们注意到MACRO全部用的大写,虽然不是明确规定的,但是通常情况下用大写。

$?和$@是makefile language里面特别的预定义的宏。$?是指的"names of the dependencies(newer than the target)",$@是指的"name of the target"。

Complier and liner flags in CS 225

CXX = clang++ LD = clang++

CXXFLAGS = -std=c++1y -stdlib=libc++ -c -g -O0 -Wall -Wextra -Werror -pedantic

LDFLAGS = -std=c++1y -stdlib=libc++ -lpng -lc++abi

㈥ ubuntu里没有make命令吗

make只是用来帮助配置编译参数、调用编译命令的,需要安装gcc编译器才能编译。
网络不好的话还是安装dvd版本,不用通过网络下东西。

阅读全文

与ubuntu的make命令找不到相关的资料

热点内容
下班之后的程序员 浏览:69
检测支持ssl加密算法 浏览:340
衢州发布新闻什么APP 浏览:82
中国移动长沙dns服务器地址 浏览:249
wifi密码加密了怎么破解吗 浏览:596
linux命令cpu使用率 浏览:67
linux实用命令 浏览:238
传奇引擎修改在线时间命令 浏览:109
php取域名中间 浏览:897
cad命令栏太小 浏览:830
php开发环境搭建eclipse 浏览:480
qt文件夹名称大全 浏览:212
金山云服务器架构 浏览:230
安卓系统笔记本怎么切换系统 浏览:618
u盘加密快2个小时还没有搞完 浏览:93
小米有品商家版app叫什么 浏览:94
行命令调用 浏览:436
菜鸟裹裹员用什么app 浏览:273
穷查理宝典pdf下载 浏览:515
csgo您已被禁用此服务器怎么办 浏览:398