伟的博客 研发工程师

编译软件遇到的问题

2007-06-20

之前编译软件都是糊里糊涂的就编译好了,而现在不知道什么原因一直无法搞定编译环境。难道linux下编译软件如此之难?我都快要崩溃了。 现在把编译软件时遇到的问题和已经解决了的问题整理一下,以备以后出现问题时参考。 找到一个解决gtk安装的好办法,直接apt-get libgtk2.0-dev 先是编译eva,缺少X header,google之后用 sudo apt-get install xorg-dev解决了。接下来是Qt环境,google后发现了一篇很有意思的文章。 http://ubuntuforums.org/showthread.php?t=124483&page=1

Re: Qt headers not found!

I’m trying to follow the old adage of you can give a man fish and he will eat for a day, teach him to fish and he will eat every day. So here goes… Here is an example of how you might search for dependencies indicated by error messages at compilation. Code: mustard@slave:~$ apt-cache search libqt libcppunit-dev - Unit Testing Library for C++ libguile-dev - Development headers and static library for libguile libqt0-ruby1.8 - Qt bindings for Ruby libqt3-i18n - i18n files for Qt3 library libqt3-mt-dbg - debugging symbols for libqt3-mt libqt3-mt-ibase - InterBase/FireBird database driver for Qt3 (Threaded) libqt3-mt-mysql - MySQL database driver for Qt3 (Threaded) libqt3-mt-odbc - ODBC database driver for Qt3 (Threaded) libqt3-mt-psql - PostgreSQL database driver for Qt3 (Threaded) libqt3-mt-sqlite - SQLite database driver for Qt3 (Threaded) libqt4-core - Qt 4 core non-GUI functionality runtime library libqt4-debug - Qt 4 debugging runtime libraries libqt4-designer - Qt 4 Designer libraries libqt4-dev - Qt 4 development files libqt4-gui - Qt 4 core GUI functionality runtime library libqt4-qt3support - Qt 3 compatibility library for Qt 4 libqt4-sql - Qt 4 SQL database module libqttestrunner1c2 - Unit Testing Library for C++ qt3-assistant - The Qt3 assistant application adept - package manager for KDE libqt-perl - Perl bindings for the Qt library libqt3-compat-headers - Qt 1.x and 2.x compatibility includes
libqt3-headers - Qt3 header files libqt3-mt - Qt GUI Library (Threaded runtime version), Version 3 libqt3-mt-dev - Qt development files (Threaded) libqthreads-12 - QuickThreads library for Guile With 20/20 hindsight I probably could have used the grep command which would have filtered the above list and produced a shorter list of candidates..

Code: mustard@slave:~$ apt-cache search libqt | grep mt libqt3-mt-dbg - debugging symbols for libqt3-mt libqt3-mt-ibase - InterBase/FireBird database driver for Qt3 (Threaded) libqt3-mt-mysql - MySQL database driver for Qt3 (Threaded) libqt3-mt-odbc - ODBC database driver for Qt3 (Threaded) libqt3-mt-psql - PostgreSQL database driver for Qt3 (Threaded) libqt3-mt-sqlite - SQLite database driver for Qt3 (Threaded) libqt3-mt - Qt GUI Library (Threaded runtime version), Version 3 libqt3-mt-dev - Qt development files (Threaded) This list a number of available packages that could indicate a possible choice. In particular its looking for libqt-mt with a version number greater than 3.2, so that gives a hint that libqt3-mt might be the one you need. So you look for the -dev package that might fill that dependency and then show the information on that package with the command below. Code: mustard@slave:~$ apt-cache show libqt3-mt-dev Package: libqt3-mt-dev Priority: optional Section: libdevel Installed-Size: 160 Maintainer: Debian Qt/KDE Maintainers debian-qt-kde@lists.debian.org Architecture: i386 Source: qt-x11-free Version: 3:3.3.4-8ubuntu5 Replaces: libqt-mt-dev, libqt3-dev (>= 3.0.5-4), libqt3-helper, libqt3-headers (<= 3:3.1.1-3), libqt3-emb (<= 3:3.0.3-1) Depends: xlibs-static-dev (>= 4.3.0.dfsg.1-4), libxext-dev (>= 4.3.0.dfsg.1-4), libxrandr-dev (>= 4.3.0.dfsg.1-4), x-dev (>= 4.3.0.dfsg.1-4), libsm-dev (>= 4.3.0.dfsg.1-4), libxmu-dev (>= 4.3.0.dfsg.1-4), libice-dev (>= 4.3.0.dfsg.1-4), libx11-dev (>= 4.3.0.dfsg.1-4), libxt-dev (>= 4.3.0.dfsg.1-4), libxrender-dev, libxcursor-dev, libxinerama-dev, libxi-dev, libmng-dev (>= 1.0.3), libpng12-0-dev, libjpeg62-dev, zlib1g-dev, libfreetype6-dev, libc6-dev, libqt3-mt (= 3:3.3.4-8ubuntu5), libqt3-headers (= 3:3.3.4-8ubuntu5), qt3-dev-tools (= 3:3.3.4-8ubuntu5), libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, libxft-dev, libaudio-dev Recommends: libqt3-compat-headers Suggests: libqt3-i18n, qt3-doc Conflicts: libqt-mt-dev, libqt3-emb (<= 3:3.0.3-1) Filename: pool/main/q/qt-x11-free/libqt3-mt-dev_3.3.4-8ubuntu5_i386.deb Size: 51054 MD5sum: 13546fed7b184e6cf7033429faa57e8b Description: Qt development files (Threaded) Qt is a C++ class library optimized for graphical user interface development. This package contains the libqt-mt.so symlink, necessary for building threaded Qt applications as well as the libqui.so symlink and the necessary header files for libqui.so. (See README.Debian and the Qt Documentation for instructions on libqui.so) . WARNING: If you plan to build some older Qt3 applications, you will most probably have to install the libqt3-compat-headers package. It contains all the headers which are not part of the official Qt3 API anymore but which are still used by some programs. So if you encounter problems with missing header files, please install this package first before you send a bugreport. Bugs: mailto:ubuntu-users@lists.ubuntu.com Origin: Ubuntu mustard@slave:~$ The above library seems to fall within the parameters for version numbers that your dependency error is showing. Usually a liberal use of apt-cache search commands used in conjuction with the grep command as a filter can help to locate the correct package. Code: mustard@slave:~$ apt-cache search libqt | grep headers libguile-dev - Development headers and static library for libguile libqt3-compat-headers - Qt 1.x and 2.x compatibility includes libqt3-headers - Qt3 header files This search produces the headers package. Of course if you do all this and come up with nothing, then it’s quite possible that its not in the repositories for your version of Ubuntu. Sometimes you might find them included in the development version. Installing stuff outside of the repositories for your particular version of Ubuntu can be fraught with problems. It’s possible, but not always practical or wise to do so. If you read the example of the apt-cache show command I used, you would see that the description of the file actually tells you what you need to install. If you need the fish I can throw you the fish. Code: sudo apt-get install libqt3-headers libqt3-compat-headers Then run ./configure again. Yeah i installed those, but it’s giving me a different error now: checking for KDE… configure: error: in the prefix, you’ve chosen, are no KDE headers installed. This will fail. So, check this please and use another prefix! lol i’m learning how to catch fish but slowly

Hmmm..well this one is difficult. I hadn't really thought about this before, but I notice you are installing a KDE application in a Gnome environment, which basically means its going to want to install a lot of KDE specific packages to work. This 'configure:error' is due to it expecting you to be running KDE and again refers to some 'headers'. /me thinks a lot It took a bit of staring at the screen for a while for me to figure this one out (as well as some googling for the specifics about wha this application you are compiling does). I thought we might have hit a dead-end for a second, but I've worked it out.  Code:  mustard@slave:~$ apt-cache search qt | grep kde fireflier-client-kde - Interactive firewall rule creation tool - QT client ggz-kde-game-data - GGZ Gaming Zone:  KDE based game front-end data ggz-kde-games - GGZ Gaming Zone:  KDE based game front-ends kde-devel - the K Desktop Environment development files and modules kdesdk-kfile-plugins - KDE file dialog plugins for software development files kdesdk-misc - various goodies from the KDE Software Development Kit kdesdk-scripts - a set of useful development scripts for KDE kdevelop3 - An IDE for Unix/X11 - development version kdevelop3-data - An IDE for Unix/X11 - data kdevelop3-dev - An IDE for Unix/X11 - development files kdevelop3-doc - An IDE for Unix/X11 - documentation kdevelop3-plugins - An IDE for Unix/X11 - development files libsmokekde-dev - SMOKE Binding Library to KDE - Development Files licq-plugin-kde - graphical user interface plug-in for Licq using Qt and KDE openoffice.org-kde - KDE UI Plugin and KDE File Picker for OpenOffice.org openoffice.org2-kde - KDE Integration for OpenOffice.org (Widgets, Dialogs, Addressbook) ebook-dev-kde20 - [EBOOK-DEV] KDE 2.0 Development  Code:  mustard@slave:~$ apt-cache show kde-devel Package: kde-devel Priority: extra Section: universe/kde Installed-Size: 40 Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Architecture: all Source: meta-kde Version: 5:44ubuntu2 Depends: kde-core, kdesdk, libartsc0-dev, libarts1-dev, kdelibs4-dev, kdebase-dev, libkonq4-dev, qt3-designer Suggests: kde-i18n Filename: pool/universe/m/meta-kde/kde-devel_44ubuntu2_all.deb Size: 7500 MD5sum: a6e5b250e03210d3d0ad524df4b9acab Description: the K Desktop Environment development files and modules  KDE (the K Desktop Environment) is a powerful Open Source graphical  desktop environment for Unix workstations. It combines ease of use,  contemporary functionality, and outstanding graphical design with the  technological superiority of the Unix operating system.  .  This metapackage includes official KDE modules that are useful to developers,  including KDE's software development kit (SDK), Qt3's designer tool, and all  core KDE header and development packages. Bugs: mailto:ubuntu-users@lists.ubuntu.com Origin: Ubuntu mustard@slave:~$ 首先确认你的ubuntu中已经装好g++,gcc,make,auto make,perl等编译安装要用到的工具,如果没安装这些的话是不能通过编译的,没安装的话就用$sudo apt-get install g++ gcc make automake perl 就行了 然后要让编译通过还得安装kdelibs4-dev 和 kdelibs4c2a 代码: $sudo apt-get update $sudo apt-get install kdelibs4-dev kdelibs4c2a 2,从网上下载EVA(CVS版)解压: 下载地址: http://www.magiclinux.org/people/yunfan/eva-0.4.1/eva-0.4.1-cvs-20060204.tar.bz2 假如是直接下载在桌面上,解压: 代码: $tar -jvxf ~/Desktop/eva-0.4.1-cvs-20060204.tar.bz2 $cd ~/Desktop/eva $./configure --prefix=/eva $make $sudo make install $sudo ln -s /eva/bin/eva /usr/bin/eva //建立连接 然后在终端里用命令 $eva & 就可以在后台启动EVA了!基本搞定!!! 3,最后,可能不能输入中文,因此还要一步: $sudo apt-get install scim-qtimm 哈,搞定中文输入问题!!! 如果想在应用程序里加上EVA的话(在GNOME下自己编译安装EVA是不会自动创建启动菜单的 ),还得加上下面这步: sudo gedit /usr/share/applications/Eva.desktop 将下面内容加到打开的文件之中,然后保存 [Desktop Entry] Name=Eva Comment=QQ Client Exec=/usr/bin/eva Icon=/usr/share/apps/eva/image/theme/eva.png Terminal=false Type=Application Categories=Application;Network; 然后$killall gnome-panel 即可在应用程序>internet下找到Eva启动项 下面这步可省略: */ 如果想更新Eva又找不到源的话可以试用CVS更新(更新之后是最新测试版,新手不推荐选用): $sudo apt-get install cvs 然后就可以用cvs来更新eva了 $cvs -d:pserver:anonymous@evaq.cvs.sf.net:/cvsroot/evaq co eva /*

下一篇 qt教程

Comments