在 64 位机器上编译 tcpsplice [英] Compiling tcpsplice on a 64-bit machine

查看:73
本文介绍了在 64 位机器上编译 tcpsplice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译一个名为 tcpslice 的小实用程序.它是典型的 GNU C 应用程序.当我运行 ./configure 时,输出如下:

<前>检查构建系统类型...无效配置`x86_64-pc-linux-gnuoldld':机器`x86_64-pc'无法识别配置:错误:/bin/sh ./config.sub x86_64-pc-linux-gnuoldld 失败

它似乎不支持编译为 64 位 Linux 应用程序.所以我有几个问题:

  1. 是否可以设置一些标志来将应用程序编译为 32 位并能够在我的 64 位操作系统上运行它?
  2. 是否可以更新配置脚本以支持 64 位 Linux?如果是这样,我是否也会对 .c 文件进行一些重大的代码更改?
  3. 我注意到我网络上的 64 位 RHEL6 机器安装了此实用程序,并以相同的版本号 (1.2a3) 运行.我可以以某种方式下载用于构建它的源代码吗?如有必要,我可以访问 RHN.

解决方案

您误解了 configure 脚本告诉您的内容.该解决方案与 CPU 位数无关.

该错误归结为 config.guess 版本太旧,包创建者使用 libtoolize 生成该版本.要修复它,您需要安装 libtool,然后说:

$ libtoolize --force

您会发现 configure 现在可以运行了,因为 libtoolize 用适合您系统的版本覆盖了 config.guess 的 tarball 版本.

您可能会遇到另一个问题,即丢失"bpf.h 文件.只需编辑 tcpslice.c 并更改这一行:

#include 

到:

#include 

通过这两个更改,我可以在我的 64 位 CentOS 5 机器上构建 tcpslice.

I am trying to compile a small utility called tcpslice. It's the typical GNU C application. When I run ./configure, here is the output:

checking build system type... Invalid configuration `x86_64-pc-linux-gnuoldld': machine `x86_64-pc' not recognized
configure: error: /bin/sh ./config.sub x86_64-pc-linux-gnuoldld failed

It appears to not support compilation as a 64-bit Linux application. So I have a few questions:

  1. Is it possible to set some flags to compile the application as 32-bit AND be able to run it on my 64-bit operating system?
  2. Is it possible to update the configure script to support 64-bit Linux? If so, will I be making some serious code changes in the .c files as well?
  3. I noticed a 64-bit RHEL6 machine on my network has this utility installed and running with an identical version number (1.2a3). Could I somehow download the source that was used to build it? I can get access the to RHN if necessary.

解决方案

You've misinterpreted what the configure script is telling you. The solution has nothing to do with CPU bitness.

The error comes down to a too-old version of config.guess, which the package creator generated with libtoolize. To fix it, you will need to have libtool installed, then say:

$ libtoolize --force

You'll find that configure now runs, because libtoolize overwrote the tarball version of config.guess with one appropriate to your system.

You may run into another problem, a "missing" bpf.h file. Just edit tcpslice.c and change this line:

#include <net/bpf.h>

to:

#include <pcap-bpf.h>

With those two changes, I got tcpslice to build on my 64-bit CentOS 5 box.

这篇关于在 64 位机器上编译 tcpsplice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆