无法在Solaris 10 SPARC上编译Ruby 2.5.1

时间:2018-09-11 18:47:26

标签: ruby solaris

正在尝试在Solaris 10 SPARC上编译Ruby 2.5.1,但由于以下错误而结束。不知道为什么要为套接字获取未定义符号。

generating a glommed object with DTrace probes for static library
linking static-library libruby-static.a
generating enc.mk
compiling enc/encinit.c
linking ruby
Undefined                       first referenced
 symbol                             in file
parse_numeric_port                  ext/socket/socket.a(raddrinfo.o)
ld: fatal: Symbol referencing errors. No output written to ruby
collect2: ld returned 1 exit status
*** Error code 1
The following command caused the error:
gcc -std=c99  -L. -L/usr/local/lib -L.  -L/var/tools/openssl/lib main.o ext/extinit.o ext/socket/socket.a ext/cgi/escape/escape.a  ext/continuation/continuation.a ext/racc/cparse/cparse.a  ext/openssl/openssl.a ext/ripper/ripper.a  ext/objspace/objspace.a ext/pty/pty.a ext/zlib/zlib.a  ext/etc/etc.a ext/fcntl/fcntl.a ext/dbm/dbm.a  ext/strscan/strscan.a ext/fiber/fiber.a  ext/readline/readline.a ext/digest/digest.a  ext/digest/bubblebabble/bubblebabble.a ext/digest/md5/md5.a  ext/digest/rmd160/rmd160.a ext/digest/sha1/sha1.a  ext/digest/sha2/sha2.a ext/fiddle/fiddle.a  ext/syslog/syslog.a ext/date/date_core.a  ext/coverage/coverage.a ext/nkf/nkf.a ext/gdbm/gdbm.a  ext/io/console/console.a ext/io/nonblock/nonblock.a  ext/io/wait/wait.a ext/rbconfig/sizeof/sizeof.a  ext/psych/psych.a ext/json/generator/generator.a  ext/json/parser/parser.a ext/stringio/stringio.a  ext/pathname/pathname.a ext/sdbm/sdbm.a  ext/bigdecimal/bigdecimal.a enc/encinit.o enc/libenc.a enc/libtrans.a -lruby-static  -lpthread -lrt -lgmp -lsocket -ldl -lcrypt -lm  -lsocket -lnsl -lssl -lcrypto -lz -lreadline -lncurses -ldl  -lffi -lgdbm -lyaml -lsocket -lnsl -lssl -lcrypto -lz -lreadline -lncurses -ldl  -lffi -lgdbm -lyaml -o ruby
make: Fatal error: Command failed for target `ruby'
Current working directory /usr/share/src/ruby-2.5.1
*** Error code 1
The following command caused the error:
make  EXTOBJS="ext/extinit.o ext/socket/socket.a ext/cgi/escape/escape.a  ext/continuation/continuation.a ext/racc/cparse/cparse.a  ext/openssl/openssl.a ext/ripper/ripper.a  ext/objspace/objspace.a ext/pty/pty.a ext/zlib/zlib.a  ext/etc/etc.a ext/fcntl/fcntl.a ext/dbm/dbm.a  ext/strscan/strscan.a ext/fiber/fiber.a  ext/readline/readline.a ext/digest/digest.a  ext/digest/bubblebabble/bubblebabble.a ext/digest/md5/md5.a  ext/digest/rmd160/rmd160.a ext/digest/sha1/sha1.a  ext/digest/sha2/sha2.a ext/fiddle/fiddle.a  ext/syslog/syslog.a ext/date/date_core.a  ext/coverage/coverage.a ext/nkf/nkf.a ext/gdbm/gdbm.a  ext/io/console/console.a ext/io/nonblock/nonblock.a  ext/io/wait/wait.a ext/rbconfig/sizeof/sizeof.a  ext/psych/psych.a ext/json/generator/generator.a  ext/json/parser/parser.a ext/stringio/stringio.a  ext/pathname/pathname.a ext/sdbm/sdbm.a  ext/bigdecimal/bigdecimal.a enc/encinit.o enc/libenc.a enc/libtrans.a" EXTLIBS="-lsocket -lnsl -lssl -lcrypto -lz -lreadline -lncurses -ldl  -lffi -lgdbm -lyaml"  EXTLDFLAGS="-L/usr/local/lib -L.  -L/var/tools/openssl/lib" EXTINITS="socket cgi/escape continuation racc/cparse openssl ripper  objspace pty zlib etc fcntl dbm strscan fiber readline  digest digest/bubblebabble digest/md5 digest/rmd160  digest/sha1 digest/sha2 fiddle syslog date_core coverage  nkf gdbm io/console io/nonblock io/wait rbconfig/sizeof  psych json/ext/generator json/ext/parser stringio pathname  sdbm bigdecimal"  UPDATE_LIBRARIES="no" SHOWFLAGS= ruby
make: Fatal error: Command failed for target `ruby'
Current working directory /usr/share/src/ruby-2.5.1
*** Error code 1
The following command caused the error:
make -f exts.mk  libdir="/var/tools/ruby251/lib" LIBRUBY_EXTS=./.libruby-with-ext.time \
    EXTENCS="enc/encinit.o enc/libenc.a enc/libtrans.a" UPDATE_LIBRARIES=no static
make: Fatal error: Command failed for target `build-ext'

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

看起来像the source code中的错误。仅在以下情况下定义parse_numeric_port()GETADDRINFO_EMU未定义,但是如果未定义parse_numeric_port(),则代码使用GETADDRINFO_EMU(请注意我在代码中添加的注释):

#ifndef GETADDRINFO_EMU
struct getaddrinfo_arg
{
    const char *node;
    const char *service;
    const struct addrinfo *hints;
    struct addrinfo **res;
};

#ifdef HAVE_INET_PTON
static int
parse_numeric_port(const char *service, int *portp)
{
    unsigned long u;

    if (!service) {
        *portp = 0;
        return 1;
    }

    if (strspn(service, "0123456789") != strlen(service))
        return 0;

    errno = 0;
    u = STRTOUL(service, NULL, 10);
    if (errno)
        return 0;

    if (0x10000 <= u)
        return 0;

    *portp = (int)u;

    return 1;
}
#endif

static void *
nogvl_getaddrinfo(void *arg)
{
    int ret;
    struct getaddrinfo_arg *ptr = arg;
    ret = getaddrinfo(ptr->node, ptr->service, ptr->hints, ptr->res);
#ifdef __linux__
    /* On Linux (mainly Ubuntu 13.04) /etc/nsswitch.conf has mdns4 and
     * it cause getaddrinfo to return EAI_SYSTEM/ENOENT. [ruby-list:49420]
     */
    if (ret == EAI_SYSTEM && errno == ENOENT)
    ret = EAI_NONAME;
#endif
    return (void *)(VALUE)ret;
}
#endif  // *** This closes #ifndef GETADDRINFO_EMU ***

static int
numeric_getaddrinfo(const char *node, const char *service,
        const struct addrinfo *hints,
        struct addrinfo **res)
{
#ifdef HAVE_INET_PTON
# if defined __MINGW64__
#   define inet_pton(f,s,d)        rb_w32_inet_pton(f,s,d)
# endif

    int port;

    // *** But this uses parse_numeric_port() even if it wasn't defined ***
    if (node && parse_numeric_port(service, &port)) {
    static const struct {
        int socktype;

您可以找到一种在构建时未定义GETADDRINFO_EMU的方法,也可以提交错误报告并等待修复。