Fink

常见疑问(F.A.Q.) - 6. 一般性编译问题

Q6.1: 一个配置脚本出错说找不到一个 "acceptable cc"。什么意思?

A: 下次应该阅读一下文档。 要从源代码编译软件包,你需要安装开发工具包,其中就包括 C 编译器:cc

Q6.2: 我运行 "fink selfupdate-cvs",但出现这个错误:"cvs: Command not found."。

A: 你需要安装开发工具包。

Q6.3: 我碰到一个涉及 make 的错误。

A: 如果错误信息是这种形式

make: command not found

Can't exec "make": No such file or directory at /sw/lib/perl5/Fink/Services.pm line 190.

它表示你需要安装开发工具。

如果你的错误信息是这样的

make: illegal option -- C

那是因为你把开发工具包里面 GNU 版本的 make 工具换成了 BSD 版本。许多软件包依赖于 GNU Make 的特有功能。 确定 /usr/bin/make 是一个指向 gnumake的符号链接,而不是指向 bsdmake。另外,确定 /usr/local/bin/ 中没有另外一个 make

Q6.4: 我碰到 head 命令的一个奇怪的错误信息。什么出问题了?

A: 如果你看到的是:

Unknown option: 1
Usage: head [-options] <url>...

后面是一列选项描述,你的 head 程序被损坏了。 这会在你安装 Perl 的 libwww 库到一个 HFS+ 系统宗卷时发生。 原因是它会建立一个新的命令 /usr/bin/HEAD,它会覆盖现存的 head 命令,因为 HFS+ 是不区分大小写的。 head 是一个在许多 shell 脚本和 Makefiles 中用到的标准命令。 如果你想使用 Fink,你需要装回原来的 head 程序。

现在源代码发布版的 bootstrap 脚本会检查这一点,但你仍然会碰到这个问题,如果你使用二进制安装或在安装 Fink 以后又安装 libwww。

也曾经有报告说发生这个问题是因为安装了 /sw/bin/HEAD(这不是 Fink 软件包安装的)。这种情况很容易解决:重命名 /sw/bin/HEAD

Q6.5: 当我安装一个软件包的时候,我碰到一个错误信息说我试图覆盖另外一个软件包的文件。

A: 当你安装那些具有版本分支的软件包(也就是那些名字末尾有 -dev,-shlibs,等的)时,如果需要有些文件从一个版本分支移动到另一个版本分支(例如,从 foofoo-shlibs)的时候,你就会碰到这个错误。你可以做的是使用你现在安装的版本来覆盖旧有的版本(因为他们通常是相同的):

sudo dpkg -i --force-overwrite 文件名
        

这里文件名 filename 是对应于你要安装的软件包的 .deb 文件名称。

Q6.6: 当我构建一个软件包时,"execution of mv failed, exit code 1" 错误是什么意思?

A: 如果你安装了 StuffIt Pro,这可能是因为你使用了 "Archive Via Real Name" 模式。在系统预置中检查 StuffIt 面板,禁用 "ArchiveViaRealName"。它包括对一些重要的系统调用的不正确的替代,从而引起一些古怪的错误。

否则,一个 mv 错误通常意味着构建过程更早期发生了错误,但是构建过程并没有因为那个错误而终止。要找到发生的问题的文件,可以搜索那个不存在文件构建时候的输出。比如,如果你碰到这样的错误:

mv /sw/src/root-foo-0.1.2-3/sw/lib/libbar*.dylib \
 /sw/src/root-foo-shlibs-0.1.2-3/sw/lib/
 mv: cannot stat `/sw/src/root-foo-0.1.2-3/sw/lib/libbar*.dylib': 
 No such file or directory
### execution of mv failed, exit code 1
Failed: installing foo-0.1.2-3 failed

那么你应该在你构建输出信息的更前面的地方寻找有关 libbar 的信息。

Q6.7: 我无法安装软件包或更新它,因为我碰到一个错误说一个 "node" 已经存在。

A: 这个错误的大约是这个样子的:

Failed: Internal error: node for system-xfree86 already exists

这个问题是因为依赖关系引擎发生了混乱,原因是修改了某些软件包的 info 文件。要修正它:

  • 强行删除出现问题的软件包,例如,对于上面的例子,可以:

    sudo dpkg -r --force-all system-xfree86
  • 再尝试安装或升级。有时会提示一个包含你删除了的软件包的 "virtual dependency"。选择它,它会在构建过程中重新被安装。

Q6.8: 我听说安装在 /usr/local/lib 的库有时会引起 Fink 构建的问题。是这样吗?

A: This is a frequent source of problems, because the package configuration script finds headers and libraries in /usr/local and decides to use them rather than using those in the Fink path. If you are having problems with a build that aren't covered by another FAQ entry, you should check whether you have libraries in /usr/local/lib or headers in /usr/local/include. If so, then try renaming /usr/local to something else, e.g.:

sudo mv /usr/local /usr/local.moved

完成你的构建,然后把 /usr/local 改回来:

sudo mv /usr/local.moved /usr/local

Q6.9: 当我构建一个软件包的时候,我碰到一个消息说 "table of contents" 已经过时。我需要怎么办?

A: 输出已经提示了该怎么办。消息通常是这样的:

ld: table of contents for archive: /sw/lib/libintl.a is out of date; rerun ranlib(1) (can't load from it)

你需要(以 root 权限)运行 ranlib 处理引起问题的库。例如对上面的情况,你可以运行:

sudo ranlib /sw/lib/libintl.a

Q6.10: 当我安装 atlas 时 Fink Commander 挂了。

A: 这原因时在构建 atlas 时,Fink Commander 遗漏了一个发向用户要求选择的信息。你需要使用 fink install atlas 命令来安装。

Q6.11: I get messages saying that I'm missing stddef.h | wchar.h | stdlib.h | crt1.o, or that my C compiler cannot create executables.

A: Both of these problems are typically due to the absence of essential headers that are provided by the DevSDK package of the Developer Tools. Check whether /Library/Receipts/DevSDK.pkg exists on your system. If not, then run the Dev Tools Installer again, and install the DevSDK package using a Custom Install.

The cannot create executables error can also occur when your Developer Tools version is for an earlier OS version.

Q6.12: 我无法升级,因为 Fink "unable to resolve version conflict on multiple dependencies"。

A: 要回避这个问题,尝试升级一个单独的软件包,然后再次尝试使用 "fink update-all"。如果你还碰到这个信息,重复这个过程。

Q6.13: 我不能安装任何东西,因为我碰到 "dpkg: parse error, in file `/sw/var/lib/dpkg/status'" 错误!

A: This means that somehow your dpkg database got damaged, usually from a crash or some other unrecoverable error. This most often occurs with a buildlock, e.g:

package `fink-buildlock-foo-1.2.3-4':  missing version

(of course, replace foo-1.2.3-4 with the package name you are seeing).

When this happens, you should edit /sw/var/lib/dpkg/status as a superuser. Then go near the line number which shows up in the error message. You should see a fink-buildlock-foo-1.2.3-4 package whose Status field is marked

install ok installed

Change that to

purge ok not-installed

Under other circumstances, there may be garbage in the file. You can fix this situation by copying the previous version of the database, like so:

sudo cp /sw/var/lib/dpkg/status-old /sw/var/lib/dpkg/status

You may need to re-install the last couple of packages you installed before the problem started occurring.

Q6.14: 我碰到一个涉及 freetype 的错误。

A: 这个错误有几种形式。If you get the following:

/usr/bin/ld: can't locate file for: -lfreetype

check whether you have an extraneous freetype-config excutable by running

where freetype-config

if you're using tcsh, or

type -a freetype-config

if you're using bash. The Mono Framework has been known to install a /usr/bin/freetype-config that is a symbolic link to a file in that framework.

如果你的错误是这样的:

/sw/include/pango-1.0/pango/pangoft2.h:52: error: parse error before '*' token
/sw/include/pango-1.0/pango/pangoft2.h:57: error: parse error before '*' token
/sw/include/pango-1.0/pango/pangoft2.h:61: error: parse error before '*' token
/sw/include/pango-1.0/pango/pangoft2.h:86: error: parse error before "pango_ft2_font_get_face"
/sw/include/pango-1.0/pango/pangoft2.h:86: warning: data definition has no type or storage class
make[2]: *** [rsvg-gz.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2
### execution of make failed, exit code 2
Failed: compiling librsvg2-2.4.0-3 failed

In file included from vteft2.c:32:
vteglyph.h:64: error: parse error before "FT_Library"
vteglyph.h:64: warning: no semicolon at end of struct or union
vteft2.c: In function `_vte_ft2_get_text_width':
vteft2.c:236: error: dereferencing pointer to incomplete type
vteft2.c: In function `_vte_ft2_get_text_height':
vteft2.c:244: error: dereferencing pointer to incomplete type
vteft2.c: In function `_vte_ft2_get_text_ascent':
vteft2.c:252: error: dereferencing pointer to incomplete type
vteft2.c: In function `_vte_ft2_draw_text':
vteft2.c:294: error: dereferencing pointer to incomplete type
vteft2.c:295: error: dereferencing pointer to incomplete type
make[2]: *** [vteft2.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
### execution of make failed, exit code 2
Failed: compiling vte-0.11.10-3 failed

checking for freetype-config... /usr/X11R6/bin/freetype-config
checking For sufficiently new FreeType (at least 2.0.1)... no
configure: error: pangoxft Pango backend found but did not find freetype libraries
make: *** No targets specified and no makefile found.  Stop.
### execution of LD_TWOLEVEL_NAMESPACE=1 failed, exit code 2
Failed: compiling gtk+2-2.2.4-2 failed

问题发生在 freetypefreetype-hinting 软件包的头文件和包含在 X11 或 XFree86 中的 freetype2 头文件之间发生混淆。

fink remove freetype freetype-hinting

命令可以删除你安装的(导致问题的)变种。如果你的错误是这样的:

ld: Undefined symbols:
_FT_Access_Frame 

这通常是用于以前安装的 X11 的残余文件。你需要重新安装 X11 SDK。

Q6.15: 我碰到一个涉及 `Dl_info' 的编译错误。

A: 如果你的错误是这样的

unix_dl.c: In function `rep_open_dl_library':
unix_dl.c:328: warning: assignment discards qualifiers from pointer target type
unix_dl.c: In function `rep_find_c_symbol':
unix_dl.c:466: error: `Dl_info' undeclared (first use in this function)
unix_dl.c:466: error: (Each undeclared identifier is reported only once
unix_dl.c:466: error: for each function it appears in.)
unix_dl.c:466: error: parse error before "info"
unix_dl.c:467: error: `info' undeclared (first use in this function)
make[1]: *** [unix_dl.lo] Error 1

最可能是你有这样的一个头文件:/usr/local/include/dlfcn.h,它和 Panther 不兼容。

这一般是由 Open Office 所安装的,你应该通过符号链接把这个头文件和对应的 /usr/local/lib/libdl.dylib 库指向 Panther 的内置文件

sudo ln -s /usr/include/dlfcn.h /usr/local/include/dlfcn.h
sudo ln -s /usr/lib/libdl.dylib /usr/local/lib/libdl.dylib

Q6.16: Fink says I'm missing gcc2 or gcc3.1 but I can't seem to install it.

A: This is because gcc2 and gcc3.1 are virtual packages to indicate the presence of gcc-2.95 and gcc-3.1, respectively, on your system. Install the gcc2.95 and/or the gcc3.1 package from the XCode Tools (earlier OS versions have gcc-2.95 and gcc-3.1 as part of their main Developer Tools installation).

Note: Installing gcc2.95 and/or gcc3.1 will not interfere with your gcc3.3 compiler--they can all coexist.

Q6.17: Fink 提示说 Failed: Can't resolve dependency "system-java14-dev",但我却找不到有这个软件包。

A: 这是因为它是一个虚拟软件包。 这类错误在 Java 通过软件更新升级后造成的: 有关的头问题被删除了,引起不能生成 -dev 软件包。

你需要自己从苹果网站下载相应的Java 开发工具软件包。在本例的情况中,你需要Java 1.4.2 Developer Tools

Q6.18: 当我尝试安装东西的时候,我碰到 dpkg (subprocess): failed to exec dpkg-split to see if it's part of a multiparter: No such file or directory 这样的错误。我怎么修复它?

A: 通常来说,这可以通过正确设置你的环境变量来修复。参考 这个 FAQ 条目

Q6.19: 我碰到这个 configure: error: XML::Parser perl module is required for intltool 错误信息。我应该怎么办?

A: You need to make sure that you have the right variant of the xml-parser-pm package to match the Perl version for your system. For example, if you're on Panther you should have xml-parser-pm581 rather than xml-parser-pm560 (you may also have the xml-parser-pm placeholder), since you have Perl-5.8.1 rather than Perl-5.6.0. If you're on Jaguar, and are using the default system Perl version, you'll have the pm560 variant, and if you've installed Perl 5.8.0 you may have the pm580 variant.

Q6.20: I'm trying to download a package, but Fink goes to some weird site with distfiles in its name, and the file isn't there.

A: What's happened here is that Fink is trying to use one of it's so called Master mirrors. These were set up to makes sure that sources for Fink packages are available even when the upstream site has moved them around. Typically these errors occur when a new upstream version of a package is released, but hasn't made it to the Master mirrors yet.

To remedy this, run fink configure and set the search order to use Master mirrors last.

Q6.21: I want Fink to use different options in building a package.

A: The first thing to do is to contact the package maintainer to request a variant. It may be relatively easy to do it. If you don't hear from the maintainer or see the new packages, or want to try a different option yourself, check out the Packaging Tutorial and Packaging Manual.

Note: Fink is deliberately set up such that all official binaries are identical regardless of what machine they are built on, so things like G5 optimization won't happen with an official package. If you want them, you'll have to do it yourself.

Q6.22: Whenever I try to build from source, Fink keeps waffling between alternate versions of the same library.

A: Often, in a complicated build tree, you may find that some of the packages depend on a particular version of a library, and other depend on a different one (e.g. db47 vs. db44). Consequently, Fink may try to switch to whichever one isn't currently installed in order to satisfy the build dependency for the current package that you're trying to update.

Unfortunately, due to limitations in the build-dependency engine, you may wind up with the dreaded

Fink::SysState: Could not resolve inconsistent dependencies

message when trying a sufficiently complicated update-all. This generally gives you a command to try to resolve the issue:

fink scanpackages
sudo apt-get update
sudo apt-get install foo=1.23-4	
      

but this may not work for sufficiently complicated updates. You might need to update packages one-by-one, at least for a while.

Q6.23: I get errors involving MACOSX_DEPLOYMENT_TARGET when I try to build a Python module.

A: For errors that look like the following:

running build
running build_ext
Traceback (most recent call last):
  File "setup_socket_ssl.py", line 21, in ?
    depends = ['socketmodule.h'] )
  File "/sw/src/root-python24-2.4.1-1/sw/lib/python2.4/distutils/core.py", line 166, in setup
SystemExit: error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.4" but "10.3" during configure
### execution of /sw/bin/python2.4 failed, exit code 1

the problem occurs because the python2* packages write the current MACOSX_DEPLOYMENT_TARGET to a configuration file when they're built and the python build utilities use this value when compiling modules. This means that if you have, for example, a python24 package on 10.4 that was built on 10.3, either by upgrading 10.3 => 10.4, or via the 10.4-transitional binary distribution, in which python24 wasn't rebuilt, there will be a mismatch between what python thinks MACOSX_DEPLOYMENT_TARGET should be (10.3) and what it actually is (10.4).

The fix is to rebuild the offending python package, e.g. fink rebuild python24 for the case above.

Q6.24: I get unrecognized option `-dynamic' errors from libtool.

A: This error:

 libtool: unrecognized option `-dynamic'

typically means that you've replaced Apple's /usr/bin/libtool with a GNU libtool. Unfortunately, the two libtools do not do the same thing.

The only way to solve this is to get a working Apple libtool from somewhere. It is installed as part of the DeveloperTools.pkg package of the XCode Tools, and you can reinstall that whole package if you first clear out its receipt in /Library/Receipts (drag it to the Trash for OS 10.4 and later, or use sudo rm -rf /Library/Receipts/DeveloperTools.pkg for 10.3).

Next: 7. 编译问题-特定软件包