ubuntu运行makefile(makefile实例教程)

大家好,关于ubuntu运行makefile很多朋友都还不太明白,今天小编就来为大家分享关于makefile实例教程的知识,希望对各位有所帮助!

如何在ubuntu中安装makefile文件,求详细步骤!

如果是需要编译的环境,推荐安装"build essential"包,

#sudo apt-get install"build-essential"

在用./configure,make, makeinstall,方法安装软件是,经常会发生发生各种错误,而导致无法生成 makefile文件。现在我把我安装过程中遇到的问题以及解决办法写下来,希望对大家有点帮助。

以我安装 pidgin-2.0.0为例

#./configure出现错误:

configure: error: C compiler cannot create executables

按照错误提示安装缺少的包

#sudo apt-get install libc6-dev

再次

#./configure

出现错误

checking for GLIB... no

no

configure: error:

You must have the GLib 2.0 development headers installed to build.

根据错误提示,用新得立搜索 GLib 2.0或者用命令

#sudo apt-cache search GLib 2.0

发现有个包 libglib2.0-dev- Development files for the GLib library。

选择安装;

#sudo apt-get install libglib2.0-dev

这里原文为libglib2.0-0-dev,似乎有误。

#./configure#又出现错误

checking for X... no

checking for GTK... no

no

configure: error:

You must have the GTK+ 2.0 development headers installed to compile Pidgin.

If you only want to build Finch then specify--disable-gtkui when running configure.

用如上同样的方法查找到缺少的包并安装

sudo apt-get install libgtkmm2.0-dev

./configure出现错误

checking for LIBXML... no

no

configure: error:

You must have libxml2>= 2.6.0 development headers installed to build.

于是安装

sudo apt-get install libxml2-dev

经过上面包的安装,在次./configure没有再出现错误,这次成功的生成了makefile文件。

然后执行:

#make

#make install

成功安装软件。

ubuntu 中makefile 是什么

1.配置系统的基本结构Linux内核的配置系统由三个部分组成,分别是:

1. Makefile:分布在 Linux内核源代码中的 Makefile,定义 Linux内核的编译规则;

2.配置文件(config.in):给用户提供配置选择的功能;

3.配置工具:包括配置命令解释器(对配置脚本中使用的配置命令进行解释)和配置用户界面(提供基于字符界面、基于 Ncurses图形界面以及基于 Xwindows

图形界面的用户配置界面,各自对应于 Make config、Make menuconfig和 make xconfig)。

这些配置工具都是使用脚本语言,如 Tcl/TK、Perl编写的(也包含一些用 C编写的代码)。本文并不是对配置系统本身进行分析,而是介绍如何使用配置系统。所以,除非是配置系统的维护者,一般的内核开发者无须了解它们的原理,只需要知道如何编写

Makefile和配置文件就可以。所以,在本文中,我们只对 Makefile和配置文件进行讨论。另外,凡是涉及到与具体 CPU体系结构相关的内容,我们都以

ARM为例,这样不仅可以将讨论的问题明确化,而且对内容本身不产生影响。

2. Makefile

2.1 Makefile概述Makefile

的作用是根据配置的情况,构造出需要编译的源文件列表,然后分别编译,并把目标代码链接到一起,最终形成 Linux内核二进制文件。

由于 Linux内核源代码是按照树形结构组织的,所以 Makefile也被分布在目录树中。Linux内核中的 Makefile以及与 Makefile直接相关的文件有:

1. Makefile:顶层 Makefile,是整个内核配置、编译的总体控制文件。

2..config:内核配置文件,包含由用户选择的配置选项,用来存放内核配置后的结果(如 make config)。

3. archMakefile还作了扩充。

...make: *** 没有指明目标并且找不到 makefile。 停止。

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

从下载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

阅读剩余
THE END