我下载了代码(“bzr branch lp:tcprstat”来获取代码 - 总共 1.5 MB),但我无法编译它。出现在 tcprstat 目录中的文件如下。我非常熟悉传统的 ./configure、make、sudo make install 和合理的 IT 知识。
问题的解决(根据 Mehmet 的意见)。
从这个页面, http: //xcb.freedesktop.org/dist/,我得到了这个文件:
libpthread-stubs-0.3.tar.gz (14-Oct-2009 02:16 267K)
Ran ./configure, make, sudo make install.
该程序仍然无法编译并出现相同的错误,但进一步谷歌搜索(“centos pthread 缺失”)给了我这个页面 https://www.centos.org/forums/viewtopic.php?t=3517 其中包含圣人建议
yum install glibc-static
(我用 sudo 做的)
等等瞧。
感谢(并祝贺 :-) )收集 50 个奖励积分的 Mehmet。
ps Mehmet,你对 Linux 中的静态/动态链接有什么好的指南吗?
【问题的完整解释】
我对此并不懒惰(在我们说话的时候正在下载书),并且我尝试了许多 automake、autoconf、make、aclocal、bootstrap 的变体,我被难住了。是的,我已经阅读了自述文件,但作者似乎认为每个人都知道 GNU 工具链。我已经在帖子底部给出了迄今为止我最成功的努力的细节。
Summary of best efforts (details at bottom)
chmod 755 ./bootstrap
./bootstrap <--- at this point more files appear in the directory
./configure // appeared to work fine
make // errors -> /usr/bin/ld: cannot find -lpthread -lp,
如果有人能告诉我如何编译这个程序,我将不胜感激。
========= 初始文件列表 ==============
-rw-rw-r--. 1 pol pol 38 Jan 30 09:46 AUTHORS
-rw-rw-r--. 1 pol pol 926 Jan 30 09:46 bootstrap
-rw-rw-r--. 1 pol pol 0 Jan 30 09:46 ChangeLog
-rw-rw-r--. 1 pol pol 2643 Jan 30 09:46 configure.ac
-rw-rw-r--. 1 pol pol 35147 Jan 30 09:46 COPYING
drwxrwxr-x. 2 pol pol 4096 Jan 30 09:46 libpcap
-rw-rw-r--. 1 pol pol 922 Jan 30 09:46 Makefile.am
-rw-rw-r--. 1 pol pol 914 Jan 30 09:46 NEWS
-rw-rw-r--. 1 pol pol 2730 Jan 30 09:46 README
drwxrwxr-x. 2 pol pol 4096 Jan 30 09:46 src
-rw-rw-r--. 1 pol pol 81 Jan 30 09:46 TODO
============= 尽力而为===============
运行 ./bootstrap
[pol@localhost tcprstat]$ chmod 755 bootstrap
[pol@localhost tcprstat]$ ./bootstrap
configure.ac:80: warning: AC_CONFIG_SUBDIRS: you should use literals
../../lib/autoconf/status.m4:1097: AC_CONFIG_SUBDIRS is expanded from...
configure.ac:80: the top level
configure.ac:80: warning: AC_CONFIG_SUBDIRS: you should use literals
../../lib/autoconf/status.m4:1097: AC_CONFIG_SUBDIRS is expanded from...
configure.ac:80: the top level
configure.ac:80: warning: AC_CONFIG_SUBDIRS: you should use literals
../../lib/autoconf/status.m4:1097: AC_CONFIG_SUBDIRS is expanded from...
configure.ac:80: the top level
configure.ac:31: installing './compile'
configure.ac:26: installing './install-sh'
configure.ac:26: installing './missing'
Makefile.am: installing './INSTALL'
src/Makefile.am: installing './depcomp'
configure.ac:80: warning: AC_CONFIG_SUBDIRS: you should use literals
../../lib/autoconf/status.m4:1097: AC_CONFIG_SUBDIRS is expanded from...
configure.ac:80: the top level
[pol@localhost tcprstat]$ ll
total 336
==== 运行 ./bootstrap 后的新文件列表
-rw-rw-r--. 1 pol pol 39001 Jan 30 10:27 aclocal.m4
-rw-rw-r--. 1 pol pol 38 Jan 30 10:27 AUTHORS
drwxr-xr-x. 2 pol pol 4096 Jan 30 10:27 autom4te.cache
-rwxr-xr-x. 1 pol pol 926 Jan 30 10:27 bootstrap
-rw-rw-r--. 1 pol pol 0 Jan 30 10:27 ChangeLog
lrwxrwxrwx. 1 pol pol 32 Jan 30 10:27 compile -> /usr/share/automake-1.13/compile
-rw-rw-r--. 1 pol pol 3039 Jan 30 10:27 config.h.in
-rwxrwxr-x. 1 pol pol 192216 Jan 30 10:27 configure
-rw-rw-r--. 1 pol pol 2643 Jan 30 10:27 configure.ac
-rw-rw-r--. 1 pol pol 35147 Jan 30 10:27 COPYING
lrwxrwxrwx. 1 pol pol 32 Jan 30 10:27 depcomp -> /usr/share/automake-1.13/depcomp
lrwxrwxrwx. 1 pol pol 32 Jan 30 10:27 INSTALL -> /usr/share/automake-1.13/INSTALL
lrwxrwxrwx. 1 pol pol 35 Jan 30 10:27 install-sh -> /usr/share/automake-1.13/install-sh
drwxrwxr-x. 2 pol pol 4096 Jan 30 10:27 libpcap
-rw-rw-r--. 1 pol pol 922 Jan 30 10:27 Makefile.am
-rw-rw-r--. 1 pol pol 24785 Jan 30 10:27 Makefile.in
lrwxrwxrwx. 1 pol pol 32 Jan 30 10:27 missing -> /usr/share/automake-1.13/missing
-rw-rw-r--. 1 pol pol 914 Jan 30 10:27 NEWS
-rw-rw-r--. 1 pol pol 2730 Jan 30 10:27 README
drwxrwxr-x. 2 pol pol 4096 Jan 30 10:27 src
-rw-rw-r--. 1 pol pol 81 Jan 30 10:27 TODO
然后我运行 ./configure - 似乎工作正常 - 没有错误。
然后我尝试运行 make 但它失败了 - 显示错误。
mv -f .deps/tcprstat_static-stats-hash.Tpo .deps/tcprstat_static-stats-hash.Po
gcc -Wall -Werror -g -pthread -I../libpcap/libpcap-1.1.1/ -g -O2 -static -L../libpcap/libpcap-1.1.1/ -o tcprstat-static tcprstat_static-tcprstat.o tcprstat_static-functions.o tcprstat_static-capture.o tcprstat_static-process-packet.o tcprstat_static-local-addresses.o tcprstat_static-stats.o tcprstat_static-output.o tcprstat_static-stats-hash.o -lpthread -lpcap
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [tcprstat-static] Error 1
make[2]: Leaving directory `/mysql/tools/tcprstat/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mysql/tools/tcprstat'
make: *** [all] Error 2
[pol@localhost tcprstat]$