在Redhat上编译SOCAT

Compiling SOCAT on Redhat

本文关键字:SOCAT 编译 Redhat      更新时间:2023-10-16

我正在尝试安装socat,我对C 很精简。因此,按照此处的说明,我能够获得最新的稳定版本1.7.3.1下载,我可以通过./configure,但是当我进入./make时,我会收到以下错误:

nestlex.c:14:7: error: unknown type name ‘ptrdiff_t’
       ptrdiff_t *len,
       ^
nestlex.c: In function ‘nestlex’:
nestlex.c:48:7: warning: implicit declaration of function ‘_nestlex’ [-Wimplicit-function-declaration]
       _nestlex(addr, token, (ptrdiff_t *)len, ends, hquotes, squotes, nests,
       ^
nestlex.c:48:30: error: ‘ptrdiff_t’ undeclared (first use in this function)
       _nestlex(addr, token, (ptrdiff_t *)len, ends, hquotes, squotes, nests,
                              ^
nestlex.c:48:30: note: each undeclared identifier is reported only once for each function it appears in
nestlex.c:48:41: error: expected expression before ‘)’ token
       _nestlex(addr, token, (ptrdiff_t *)len, ends, hquotes, squotes, nests,
                                         ^
nestlex.c: At top level:
nestlex.c:54:7: error: unknown type name ‘ptrdiff_t’
       ptrdiff_t *len,
       ^
nestlex.c: In function ‘nestlex’:
nestlex.c:50:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [nestlex.o] Error 1

系统信息:

cat system-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
rpm -qa |grep gcc
libgcc-4.8.5-4.el7.x86_64
gcc-4.8.5-4.el7.x86_64
rpm -qa |grep glibc
glibc-common-2.17-106.el7_2.6.x86_64
glibc-2.17-106.el7_2.6.x86_64
glibc-devel-2.17-106.el7_2.6.x86_64
glibc-headers-2.17-106.el7_2.6.x86_64
rpm -qa |grep gd
gdisk-0.8.6-5.el7.x86_64
gd-2.0.35-26.el7.x86_64
gdbm-1.10-8.el7.x86_64

我不确定从这里去哪里,因为我不得不从源头安装。我发现了一些文章,描述该问题没有安装标题的正确版本。如果有人可以将我指向正确的方向,我将非常感谢。

预先感谢。

未知类型在标题文件stddef.h中定义。如果文件中没有#include <stddef.h>的编译,则报告了错误,请将其添加到顶部的某个位置。由于标题包含本质上是传递性的,因此当其他仍包含的标题中存在必要的包含时,有时会发生这种错误,但由于某种原因包括一个较新的版本。

通常可以通过在此处搜索来找到常见类型的位置。


使用SOCAT.SPEC使用默认配置时实际上没有错误构建:请参阅 SOCAT-1.7.3.1 -1.fc25.src.rpm→→

./configure  
        --enable-help --enable-stdio 
        --enable-fdnum --enable-file --enable-creat 
        --enable-gopen --enable-pipe --enable-termios 
        --enable-unix --enable-ip4 --enable-ip6 
        --enable-rawip --enable-tcp --enable-udp 
        --enable-listen --enable-proxy --enable-exec 
        --enable-system --enable-pty --enable-readline 
        --enable-openssl --enable-sycls --enable-filan 
        --enable-retry --enable-libwrap --enable-fips

您还可以从SOCAT-1.7.3.1-1.fc25.src.rpm中获得SOCAT-1.7.3.1.1.EL7.X86_64.RPM创建的,使用$ rpmbuild -bb socat.spec(http://dl.fedoraproject.org/pub/pub/fedora/linux/development/rawhide/everything/everything/source/tree/packages/packages/socat-1.7.3.1-1.7.3.1-1.fc25.src.rpm)