编译Xvfb的静态链接二进制文件

时间:2013-02-13 02:06:01

标签: ubuntu compilation xvfb

我正在这里撞墙。我正在尝试编译Xvfb虚拟帧缓冲区的静态链接二进制文件。

http://manpages.ubuntu.com/manpages/natty/man1/Xvfb.1.html

现在我正在从这样的源代码编译:

$ sudo apt-get build-dep xvfb
$ apt-get source Xvfb
$ cd xorg-source
$ ./configure --enable-shared=no
$ make

这仍然导致编译的二进制文件,但它仍然是动态链接的(我正在使用此命令检查)

find -iname Xvfb -type f -exec file {} \;

这可能是因为我需要静态链接所有依赖项,但我无法继续进行。

2 个答案:

答案 0 :(得分:1)

查看最后一个发送到终端的链接命令并自行重新运行(手动),将“shared”替换为“static”(Possible to build a shared library with static link used library?

答案 1 :(得分:0)

这对我来说是Ubuntu 12.10 / amd64:

的诀窍
# be sure to build static versions of all included libraries
$ ./configure --enable-static

$ make

$ cd hw/vfb
$ make clean

# this provides static versions of some functions which are dynamic only in eglibc
$ sudo apt-get install libtirpc-dev

# LDFLAGS=-all-static asks libtool to do static linking
# LD_EXPORT_SYMBOLS_FLAGS= causes --export-dynamic to be omitted
# LIBS='...' fills in missing dependencies for static libraries
$ make LDFLAGS=-all-static LD_EXPORT_SYMBOLS_FLAG= LIBS='-lfreetype -lgpg-error -lfontenc -ltirpc -lz -lbz2 -lm -lrt -lpthread'

这有点像黑客有两个原因:

  1. 它对库依赖项进行了硬编码(可能会在其他版本的X中发生变化)

  2. 它引入了对libtirpc的奇怪依赖。没有它,我得到了xdrmem_create(3)的未解析符号以及动态链接时libnsl提供的一些其他内容:

    /tmp/xorg-server-1.13.0/os/rpcauth.c:79: undefined reference to `xdrmem_create'
    
相关问题