【问题标题】:Compiling SOCAT on Redhat在 Redhat 上编译 SOCAT
【发布时间】:2016-06-15 11:39:59
【问题描述】:

我正在尝试安装SOCAT,而且我对 C++ 非常了解。所以按照HERE的说明,我可以下载最新的稳定版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

我不知道从哪里开始,因为我对必须从源代码安装相当陌生。我发现一些文章将问题描述为没有安装正确版本的标头。如果有人能指出我正确的方向,我将不胜感激。

提前致谢。

【问题讨论】:

  • 一个细节:报告中唯一致命的事情是ptrdiff_t 不为人所知(错误)其余似乎是后续噪音。因此,要么在配置步骤中错误检测到所需的包含头文件,要么在 socat 源本身中出现错误。
  • 打开nestlex.c,查找#include <stddef.h>是否在其中,这是定义该类型的地方。
  • nestkex,c 有:#include "config.h" #include "mytypes.h" #include "sysincludes.h"
  • grep -R "stdef.h" * 在socat目录中不返回任何结果。
  • 我添加了#include "stddef.h" 并允许它编译。谢谢@renemilk 不知道如何为您的答案表示感谢。

标签: c++ gcc redhat llvm-gcc


【解决方案1】:

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

例如,通常可以通过搜索here 找到定义常见类型的位置。

【讨论】:

    【解决方案2】:

    当使用socat.spec默认配置时,实际上socat构建没有错误:请参阅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
    

    您还可以使用 $rpmbuild -bb socat.spec 从 socat-1.7.3.1-1.fc25.src.rpm 创建 socat-1.7.3.1-1.el7.x86_64.rpm (http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/source/tree/Packages/s/socat-1.7.3.1-1.fc25.src.rpm)。


    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-12
      • 1970-01-01
      • 2019-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-17
      • 1970-01-01
      相关资源
      最近更新 更多