3

我在我的 linux 机器(Redhat)上编译 Ruby-1.9.3 时遇到问题。

我尝试使用 RVM 并得到以下错误:

compiling regparse.c
compiling regsyntax.c
compiling ruby.c
compiling safe.c
compiling signal.c
compiling sprintf.c
compiling st.c
compiling strftime.c
compiling string.c
compiling struct.c
compiling time.c
compiling transcode.c
compiling util.c
compiling variable.c
compiling compile.c
compiling debug.c
compiling iseq.c
compiling vm.c
In file included from vm.c:27:
vm_method.c: In function ‘rb_gc_mark_unlinked_live_method_entries’:
vm_method.c:102: warning: unused variable ‘curr_ume’
vm_method.c:102: warning: unused variable ‘prev_ume’
compiling vm_dump.c
compiling thread.c
/tmp/ccsuOCyc.s: Assembler messages:
/tmp/ccsuOCyc.s:243: Error: Incorrect register `%rax' used with `l' suffix
/tmp/ccsuOCyc.s:268: Error: Incorrect register `%rdx' used with `l' suffix
/tmp/ccsuOCyc.s:9562: Error: Incorrect register `%rax' used with `l' suffix
/tmp/ccsuOCyc.s:14547: Error: Incorrect register `%rax' used with `l' suffix
make: *** [thread.o] Error 1

我也尝试手动部署 ruby​​,但下载源 tarball 并运行 configure/make 等并在编译 thread.c 时得到相同的错误

任何想法可能是什么问题?我尝试删除 rvm/ruby 并多次重做,但无济于事。任何帮助,将不胜感激!

添加更多信息:

$gcc -v

Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

$uname -a

Linux <machine name> 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

$cat 生成文件

SHELL = /bin/sh
NULLCMD = :
RUNCMD = $(SHELL)
CHDIR = cd -P
exec = exec
NULL = /dev/null

#### Start of system configuration section. ####

srcdir = .
top_srcdir = $(srcdir)
hdrdir = $(srcdir)/include

CC = gcc
CPP = $(CC) -E
YACC = bison
PURIFY =
AUTOCONF = autoconf

MKFILES = Makefile
BASERUBY = echo executable host ruby is required.  use --with-baseruby option.; false
TEST_RUNNABLE = yes
DOXYGEN = 

prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
datarootdir = ${prefix}/share
datadir = ${datarootdir}
arch = x86_64-linux
sitearch = ${arch}
sitedir = ${rubylibprefix}/site_ruby
ruby_version = 1.9.1

TESTUI = console
TESTS =
INSTALLDOC = nodoc
DOCTARGETS = nodoc nodoc

EXTOUT = .ext
arch_hdrdir = $(EXTOUT)/include/$(arch)
VPATH = $(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/enc:$(srcdir)/missing

empty =
OUTFLAG = -o $(empty)
COUTFLAG = -o $(empty)
ARCH_FLAG = 
CFLAGS = ${cflags}  -fPIC
cflags =  ${optflags} ${debugflags} ${warnflags}
optflags = -O3
debugflags = -ggdb
warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Werror-implicit-function-declaration
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir)
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS =  $(DEFS) ${cppflags} $(INCFLAGS)
LDFLAGS =  $(CFLAGS) -L.  -rdynamic -Wl,-export-dynamic
EXTLDFLAGS = 
XLDFLAGS =  $(EXTLDFLAGS)
EXTLIBS = 
LIBS = -lpthread -lrt -ldl -lcrypt -lm  $(EXTLIBS)
MISSING =  ${LIBOBJDIR}strlcpy.o ${LIBOBJDIR}strlcat.o ${LIBOBJDIR}setproctitle.o ${LIBOBJDIR}addr2line.o 
LDSHARED = $(CC) -shared
DLDFLAGS = -Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) $(EXTLDFLAGS) $(ARCH_FLAG)
SOLIBS = $(LIBS)
MAINLIBS = 
ARCHMINIOBJS = dmydln.o
BUILTIN_ENCOBJS =  ascii.$(OBJEXT) us_ascii.$(OBJEXT) unicode.$(OBJEXT) utf_8.$(OBJEXT)
BUILTIN_TRANSSRCS =  newline.c
BUILTIN_TRANSOBJS =  newline.$(OBJEXT)

RUBY_BASE_NAME=ruby
RUBY_PROGRAM_VERSION=1.9.3
RUBY_INSTALL_NAME=$(RUBY_BASE_NAME)
RUBY_SO_NAME=$(RUBY_BASE_NAME)
EXEEXT = 
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
RUBY = $(RUBY_INSTALL_NAME)
MINIRUBY = ./miniruby$(EXEEXT) -I$(srcdir)/lib -I. -I$(EXTOUT)/common\
    $(MINIRUBYOPT)
RUNRUBY = $(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT) -- $(RUN_OPTS)
XRUBY = $(RUNRUBY)
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SCRIPT = ${INSTALL}
INSTALL_PROGRAM = ${INSTALL}
XRUBY_LIBDIR = 
XRUBY_RUBYLIBDIR = 
XRUBY_RUBYHDRDIR = 

DEFAULT_PRELUDES = $(YES_GEM_PRELUDE)

#### End of system configuration section. ####

MAJOR=  1
MINOR=  9
TEENY=  1

LIBRUBY_A     = lib$(RUBY_SO_NAME)-static.a
LIBRUBY_SO    = lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY)
LIBRUBY_ALIASES= lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so
LIBRUBY       = $(LIBRUBY_SO)
LIBRUBYARG    = $(LIBRUBYARG_SHARED)
LIBRUBYARG_STATIC = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)

THREAD_MODEL  = pthread

PREP          = miniruby$(EXEEXT)
ARCHFILE      = 
SETUP         =
EXTSTATIC     = 
SET_LC_MESSAGES = env LC_MESSAGES=C

MAKEDIRS      = /bin/mkdir -p
CP            = cp
MV            = mv
RM            = rm -f
RMDIR         = rmdir --ignore-fail-on-non-empty
RMDIRS        = rmdir --ignore-fail-on-non-empty -p
RMALL         = rm -fr
NM            = nm
AR            = ar
ARFLAGS       = rcu
RANLIB        = ranlib
AS            = as
ASFLAGS       =  $(INCFLAGS)
IFCHANGE      = $(srcdir)/tool/ifchange
SET_LC_MESSAGES = env LC_MESSAGES=C
OBJDUMP       = objdump
OBJCOPY       = objcopy
VCS           = echo cannot
VCSUP         = $(VCS)

OBJEXT        = o
ASMEXT        = S
DLEXT         = so
MANTYPE       = doc
SYMBOL_PREFIX = 

INSTALLED_LIST= .installed.list

MKMAIN_CMD    = mkmain.sh

SRC_FILE      = $<

MESSAGE_BEGIN = @for line in
MESSAGE_END = ; do echo "$$line"; done

configure_args =  '--prefix=/usr/local' '--enable-shared' '--disable-install-doc' '--with-opt-dir=/usr/local/lib'
#### End of variables

all:

.DEFAULT: all

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:

miniruby$(EXEEXT):
        @-if test -f $@; then $(MV) -f $@ $@.old; $(RM) $@.old; fi
        $(ECHO) linking $@
        $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(LIBS) $(OUTFLAG)$@

$(PROGRAM):
        @$(RM) $@
        $(ECHO) linking $@
        $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) $(OUTFLAG)$@

# We must `rm' the library each time this rule is invoked because "updating" a
# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
# supported.
$(LIBRUBY_A):
        @$(RM) $@
        $(ECHO) linking static-library $@
        $(Q) $(AR) $(ARFLAGS) $@ $(OBJS) $(DMYEXT)
        @-$(RANLIB) $@ 2> /dev/null || true

$(LIBRUBY_SO):
        @-$(PRE_LIBRUBY_UPDATE)
        $(ECHO) linking shared-library $@
        $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@
        -$(Q) $(OBJCOPY) -w -L '$(SYMBOL_PREFIX)Init_*' -L '$(SYMBOL_PREFIX)*_threadptr_*' $@
        @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
                          File.symlink "$(LIBRUBY_SO)", link}' \
                $(LIBRUBY_ALIASES) || true

fake: $(arch)-fake.rb
$(arch)-fake.rb: config.status $(srcdir)/template/fake.rb.in
        @./config.status --file=$@:$(srcdir)/template/fake.rb.in
        @chmod +x $@

ruby_pc = ruby-1.9.pc
$(ruby_pc):
        @./config.status --file=$@:$(srcdir)/template/ruby.pc.in

install-cross: $(arch)-fake.rb $(RBCONFIG) rbconfig.rb $(arch_hdrdir)/ruby/config.h \
    $(LIBRUBY_A) $(LIBRUBY_SO) $(ARCHFILE)
    $(ECHO) installing cross-compiling stuff
    $(Q) $(MAKEDIRS) $(XRUBY_RUBYLIBDIR)/$(arch) $(XRUBY_RUBYHDRDIR)/$(arch)/ruby
    $(Q) sed '/^\$$:\.unshift/q' $(arch)-fake.rb > fake.rb
    $(Q) $(BASERUBY) -p \
    -e '~/^\s*CONFIG\["LDFLAGS"\]/ and' \
    -e '$$_[/(?=\s*"$$)/] = %q[ #{(CONFIG["LIBPATHFLAG"]%File.dirname(__FILE__)).strip}]' \
    rbconfig.rb > fake-rbconfig.rb
    $(INSTALL_SCRIPT) fake.rb $(XRUBY_RUBYLIBDIR)/$(arch)/fake.rb
    $(INSTALL_SCRIPT) fake-rbconfig.rb $(XRUBY_RUBYLIBDIR)/$(arch)/rbconfig.rb
    @$(RM) fake.rb fake-rbconfig.rb
    $(INSTALL_DATA) $(arch_hdrdir)/ruby/config.h $(XRUBY_RUBYHDRDIR)/$(arch)/ruby
    $(INSTALL_DATA) $(top_srcdir)/include/ruby/win32.h $(XRUBY_RUBYHDRDIR)/ruby
    $(INSTALL_DATA) $(LIBRUBY) $(LIBRUBY_A) $(XRUBY_RUBYLIBDIR)/$(arch)
    $(INSTALL_PROGRAM) $(LIBRUBY_SO) $(XRUBY_RUBYLIBDIR)/$(arch)

Makefile:   $(srcdir)/Makefile.in $(srcdir)/enc/Makefile.in

$(MKFILES): config.status
        MAKE=$(MAKE) $(SHELL) ./config.status
        @{ \
            echo "all:; -@rm -f conftest.mk"; \
            echo "conftest.mk: .force; @echo AUTO_REMAKE"; \
            echo ".force:"; \
        } > conftest.mk || exit 1; \
        $(MAKE) -f conftest.mk | grep '^AUTO_REMAKE$$' >/dev/null 2>&1 || \
        { echo "Makefile updated, restart."; exit 1; }

uncommon.mk: $(srcdir)/common.mk
        sed 's/{\$$([^(){}]*)[^{}]*}//g' $< > $@

.PHONY: reconfig
reconfig-args = $(srcdir)/configure $(configure_args)
config.status-args = ./config.status --recheck
reconfig-exec-0 = exec 3>&1; exit `exec 4>&1; { "$$@" 3>&- 4>&-; echo $$? 1>&4; } | fgrep -v '(cached)' 1>&3`
reconfig-exec-1 = set -x; "$$@"

reconfig config.status: $(srcdir)/configure $(srcdir)/enc/Makefile.in
    @PWD= MINIRUBY="$(MINIRUBY)"; export MINIRUBY; \
    set $(SHELL) $($@-args); $(reconfig-exec-$(V))

$(srcdir)/configure: $(srcdir)/configure.in
    $(CHDIR) $(srcdir) && exec $(AUTOCONF)

incs: id.h

# Things which should be considered:
# * with gperf v.s. without gperf
# * committers may have various versions of gperf
# * ./configure v.s. ../ruby/configure
# * GNU make v.s. HP-UX make    # HP-UX make invokes the action if lex.c and keywords has same mtime.
# * svn checkout generate a file with mtime as current time
# * ext4 and XFS has a mtime with fractional part
lex.c: defs/keywords
    @\
    if cmp -s $(srcdir)/defs/lex.c.src $?; then \
      [ $(Q) ] && echo copying $@ || set -x; \
      $(CP) $(srcdir)/lex.c.blt $@; \
    else \
      [ $(Q) ] && echo generating $@ || set -x; \
      gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@.tmp && \
      $(MV) $@.tmp $@ && \
      $(CP) $? $(srcdir)/defs/lex.c.src && \
      $(CP) $@ $(srcdir)/lex.c.blt; \
    fi

NAME2CTYPE_OPTIONS = -7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p

enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd
    $(MAKEDIRS) $(@D)
    @set +e; \
    if cmp -s $(?:.kwd=.src) $?; then \
      set -x; \
      $(CP) $(?:.kwd=.h.blt) $@; \
    else \
      trap '$(RM) $@-1.h $@-2.h' 0 && \
      set -x; \
      sed '/^#ifdef USE_UNICODE_PROPERTIES/,/^#endif/d' $? | gperf $(NAME2CTYPE_OPTIONS) > $@-1.h && \
      gperf $(NAME2CTYPE_OPTIONS) < $? > $@-2.h && \
      diff -DUSE_UNICODE_PROPERTIES $@-1.h $@-2.h > $@.tmp || :; \
      $(MV) $@.tmp $@ && \
      $(CP) $? $(?:.kwd=.src) && \
      $(CP) $@ $(?:.kwd=.h.blt); \
    fi

.c.o:
    @$(ECHO) compiling $<
    $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $<

.s.o:
    @$(ECHO) assembling $<
    $(Q) $(AS) $(ASFLAGS) -o $@ $<

.c.S:
    @$(ECHO) translating $<
    $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -S $<

.c.i:
    @$(ECHO) preprocessing $<
    $(Q) $(CPP) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@

clean-local::
    $(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output
    -$(Q)$(RM) $(pkgconfig_DATA)

distclean-local::
    $(Q)$(RM) ext/config.cache $(RBCONFIG) Doxyfile
    -$(Q)$(RM) run.gdb
    -$(Q)$(RM) $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h
    -$(Q)$(RMDIRS) $(arch_hdrdir)/ruby 2> /dev/null || true

clean-ext distclean-ext realclean-ext::
    @cd ext 2>/dev/null || exit 0; set dummy `echo "${EXTS}" | tr , ' '`; shift; \
    test "$$#" = 0 && set .; \
    set dummy `\
        find "$$@" -name Makefile -print | sed 's:^\./::;s:/Makefile$$:~:' | sort | sed 's:~$$::'; \
    `; shift; \
    cd ..; \
    for dir do \
        echo $(@:-ext=)ing "$$dir"; \
        (cd "ext/$$dir" && exec $(MAKE) $(MFLAGS) $(@:-ext=)) && \
        case "$@" in \
        *distclean-ext*|*realclean-ext*) \
        $(RMDIRS) "ext/$$dir" 2> /dev/null || true;; \
        esac; \
    done

distclean-ext realclean-ext::
    -$(Q)$(RMDIR) ext 2> /dev/null || true

clean-extout:
    -$(Q)$(RMDIRS) $(EXTOUT) 2> /dev/null || true

clean-enc distclean-enc realclean-enc:
    @test -f "$(ENC_MK)" || exit 0; \
    echo $(@:-enc=ing) encodings; \
    exec $(MAKE) -f $(ENC_MK) $(MFLAGS) $(@:-enc=)

clean-rdoc distclean-rdoc realclean-rdoc:
    @echo $(@:-rdoc=ing) rdoc
    $(Q)$(RMALL) $(RDOCOUT)
clean-capi distclean-capi realclean-capi:
    @echo $(@:-capi=ing) capi
    $(Q)$(RMALL) $(CAPIOUT)


ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
    $(ECHO) compiling $@
    $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c ext/extinit.c

up::
    @$(CHDIR) "$(srcdir)" && LC_TIME=C exec $(VCSUP)

update-mspec:
    @$(CHDIR) $(srcdir); \
    if [ -d spec/mspec ]; then \
      cd spec/mspec; \
      echo updating mspec ...; \
      exec git pull; \
    else \
      echo retrieving mspec ...; \
      exec git clone $(MSPEC_GIT_URL) spec/mspec; \
    fi

update-rubyspec: update-mspec
    @$(CHDIR) $(srcdir); \
    if [ -d spec/rubyspec ]; then \
      cd spec/rubyspec; \
      echo updating rubyspec ...; \
      exec git pull; \
    else \
      echo retrieving rubyspec ...; \
      exec git clone $(RUBYSPEC_GIT_URL) spec/rubyspec; \
    fi

test-rubyspec-precheck:
    @if [ ! -d $(srcdir)/spec/rubyspec ]; then echo No rubyspec here.  make update-rubyspec first.; exit 1; fi

INSNS   = opt_sc.inc optinsn.inc optunifs.inc insns.inc insns_info.inc \
      vmtc.inc vm.inc

$(INSNS): $(srcdir)/insns.def vm_opts.h \
      $(srcdir)/defs/opt_operand.def $(srcdir)/defs/opt_insn_unif.def \
      $(srcdir)/tool/instruction.rb $(srcdir)/tool/insns2vm.rb
    $(ECHO) generating $@
    $(Q) $(BASERUBY) -Ks $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT) $@

distclean-local::; @$(RM) GNUmakefile uncommon.mk

rpm -qa | grep 兼容-libstdc

compat-libstdc++-33-3.2.3-61
compat-libstdc++-33-3.2.3-61
compat-libstdc++-296-2.96-138
4

1 回答 1

1

给你一些选择...

如果您有名为“yum”的 RedHat 包管理器,请尝试以下操作:

$ sudo yum install ruby
$ sudo yum install ruby19
$ sudo yum install ruby19-devel 

尝试 ruby​​ 构建:

https://github.com/sstephenson/ruby-build

这里有一些地方可以寻找潜在客户……如果您可以将结果发布到这些地方,那么这里的更多人可能会为您提供帮助。

$ gcc -v
$ uname -a
$ cat /etc/redhat-release
$ cat ~/.rvmrc
$ cat Makefile
$ rpm -qa | grep compat-libstdc

您正在寻找的是 32 位与 64 位之间的一些区别。如果您看到“686”之类的项目,通常是 32 位;如果您看到通常是 64 位的“x64”之类的项目。

您是否使用任何编译器标志来选择 32 位?例如在您的 Makefile 中:

CFLAGS="-m32" LDFLAGS="-m32" CXXFLAGS="-m32" 

如果是这样,请将它们全部更改为“-m64”,然后make clean重试。

如果您的 GCC 不是最新的 (4.7.2),我建议您更新它,make clean然后再试一次。

于 2013-02-20T08:51:53.703 回答