2

I have an error to compile Ruby 1.9.3 with RVM in my OSX. I already searched a lot of solutions but is not the common error. I think its a permission error, but I don't know how to solve.

See my make.log file:

[2013-04-03 09:37:41] make
    CC = clang
    LD = ld
    LDSHARED = clang -dynamiclib
    CFLAGS = -O2 -arch x86_64 -fno-common -pipe 
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS = -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/opt/local/include -I. -I.ext/include/x86_64-darwin12.3.0 -I./include -I.
    DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/brunno/.rvm/rubies/ruby-1.9.3-p392/lib/libruby.1.9.1.dylib -current_version 1.9.1 -compatibility_version 1.9.1  -Wl,-u,_objc_msgSend   
    SOLIBS = 
compiling main.c
compiling dmydln.c
compiling dmyencoding.c
compiling version.c
compiling miniprelude.c
compiling array.c
compiling bignum.c
compiling class.c
bignum.c:2732:26: warning: while loop has empty body [-Wempty-body]
        while (--ny && !zds[ny]); ++ny;
                                ^
bignum.c:2732:26: note: put the semicolon on a separate line to silence this warning
compiling compar.c
compiling complex.c
compiling dir.c
compiling dln_find.c
compiling enum.c
compiling enumerator.c
compiling error.c
compiling eval.c
compiling load.c
compiling proc.c
1 warning generated.
compiling file.c
compiling gc.c
compiling hash.c
compiling inits.c
compiling io.c
compiling marshal.c
compiling math.c
compiling node.c
compiling numeric.c
compiling object.c
compiling pack.c
compiling parse.c
compiling process.c
compiling random.c
compiling range.c
compiling rational.c
compiling re.c
compiling regcomp.c
compiling regenc.c
compiling regerror.c
compiling regexec.c
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
compiling vm_dump.c
compiling thread.c
thread.c:2550:34: warning: variable 'orig_read' is uninitialized when used within its own initialization [-Wuninitialized]
    rb_fdset_t UNINITIALIZED_VAR(orig_read);
                                 ^~~~~~~~~
./vm_core.h:115:34: note: expanded from macro 'UNINITIALIZED_VAR'
#define UNINITIALIZED_VAR(x) x = x
                                 ^
thread.c:2551:34: warning: variable 'orig_write' is uninitialized when used within its own initialization [-Wuninitialized]
    rb_fdset_t UNINITIALIZED_VAR(orig_write);
                                 ^~~~~~~~~~
./vm_core.h:115:34: note: expanded from macro 'UNINITIALIZED_VAR'
#define UNINITIALIZED_VAR(x) x = x
                                 ^
thread.c:2552:34: warning: variable 'orig_except' is uninitialized when used within its own initialization [-Wuninitialized]
    rb_fdset_t UNINITIALIZED_VAR(orig_except);
                                 ^~~~~~~~~~~
./vm_core.h:115:34: note: expanded from macro 'UNINITIALIZED_VAR'
#define UNINITIALIZED_VAR(x) x = x
                                 ^
compiling cont.c
compiling ./enc/ascii.c
compiling ./enc/us_ascii.c
compiling ./enc/unicode.c
3 warnings generated.
compiling ./enc/utf_8.c
compiling newline.c
compiling ./missing/setproctitle.c
compiling dln.c
compiling encoding.c
compiling dmyversion.c
linking miniruby
generating encdb.h
rbconfig.rb updated
generating enc.mk
generating prelude.c
compiling prelude.c
encdb.h unchanged
making srcs under enc
linking static-library libruby.1.9.1-static.a
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
linking shared-library libruby.1.9.1.dylib
making enc
making trans
compiling ./enc/trans/transdb.c
compiling ./enc/big5.c
compiling ./enc/encdb.c
compiling ./enc/cp949.c
compiling ./enc/trans/big5.c
configuring -test-/array/resize
configuring -test-/bug-3571
compiling ./enc/emacs_mule.c
configuring -test-/bug-3662
configuring -test-/funcall
configuring -test-/load/dot.dot
configuring -test-/old_thread_select
configuring -test-/st/numhash
configuring -test-/string
configuring -test-/wait_for_single_fd
configuring -test-/win32/dln
Failed to configure -test-/win32/dln. It will not be installed.
configuring -test-/win32/fd_setsize
Failed to configure -test-/win32/fd_setsize. It will not be installed.
compiling ./enc/trans/chinese.c
configuring bigdecimal
compiling ./enc/euc_jp.c
compiling ./enc/euc_kr.c
compiling ./enc/euc_tw.c
configuring continuation
configuring coverage
configuring curses
compiling ./enc/gb2312.c
compiling ./enc/gb18030.c
compiling ./enc/gbk.c
compiling ./enc/iso_8859_1.c
compiling ./enc/iso_8859_2.c
compiling ./enc/iso_8859_3.c
compiling ./enc/iso_8859_4.c
compiling ./enc/iso_8859_5.c
compiling ./enc/iso_8859_6.c
compiling ./enc/iso_8859_7.c
compiling ./enc/iso_8859_8.c
compiling ./enc/iso_8859_9.c
compiling ./enc/iso_8859_10.c
compiling ./enc/iso_8859_11.c
compiling ./enc/iso_8859_13.c
compiling ./enc/iso_8859_14.c
compiling ./enc/iso_8859_15.c
compiling ./enc/iso_8859_16.c
compiling ./enc/koi8_r.c
compiling ./enc/koi8_u.c
compiling ./enc/shift_jis.c
compiling ./enc/utf_16be.c
compiling ./enc/trans/emoji.c
compiling ./enc/utf_16le.c
compiling ./enc/utf_32be.c
compiling ./enc/utf_32le.c
compiling ./enc/windows_1251.c
linking encoding encdb.bundle
linking encoding big5.bundle
compiling ./enc/trans/emoji_iso2022_kddi.c
linking encoding cp949.bundle
linking encoding emacs_mule.bundle
linking encoding euc_jp.bundle
linking encoding euc_kr.bundle
linking encoding euc_tw.bundle
linking encoding gb2312.bundle
linking encoding gb18030.bundle
linking encoding gbk.bundle
linking encoding iso_8859_1.bundle
linking encoding iso_8859_2.bundle
linking encoding iso_8859_3.bundle
linking encoding iso_8859_4.bundle
linking encoding iso_8859_5.bundle
linking encoding iso_8859_6.bundle
linking encoding iso_8859_7.bundle
linking encoding iso_8859_8.bundle
linking encoding iso_8859_9.bundle
linking encoding iso_8859_10.bundle
linking encoding iso_8859_11.bundle
linking encoding iso_8859_13.bundle
linking encoding iso_8859_14.bundle
linking encoding iso_8859_15.bundle
linking encoding iso_8859_16.bundle
linking encoding koi8_r.bundle
linking encoding koi8_u.bundle
linking encoding shift_jis.bundle
linking encoding utf_16be.bundle
linking encoding utf_16le.bundle
linking encoding utf_32be.bundle
linking encoding utf_32le.bundle
linking encoding windows_1251.bundle
compiling ./enc/trans/emoji_sjis_docomo.c
compiling ./enc/trans/emoji_sjis_kddi.c
compiling ./enc/trans/emoji_sjis_softbank.c
compiling ./enc/trans/escape.c
compiling ./enc/trans/gb18030.c
compiling ./enc/trans/gbk.c
compiling ./enc/trans/iso2022.c
compiling ./enc/trans/japanese.c
compiling ./enc/trans/japanese_euc.c
compiling ./enc/trans/japanese_sjis.c
configuring date
configuring dbm
configuring digest
configuring digest/bubblebabble
configuring digest/md5
configuring digest/rmd160
compiling ./enc/trans/korean.c
configuring digest/sha1
configuring digest/sha2
compiling ./enc/trans/single_byte.c
configuring dl
compiling ./enc/trans/utf8_mac.c
compiling ./enc/trans/utf_16_32.c
linking transcoder transdb.bundle
linking transcoder big5.bundle
linking transcoder chinese.bundle
linking transcoder emoji.bundle
linking transcoder emoji_iso2022_kddi.bundle
linking transcoder emoji_sjis_docomo.bundle
linking transcoder emoji_sjis_kddi.bundle
linking transcoder emoji_sjis_softbank.bundle
linking transcoder escape.bundle
configuring dl/callback
configuring dl/win32
Failed to configure dl/win32. It will not be installed.
configuring etc
linking transcoder gb18030.bundle
linking transcoder gbk.bundle
linking transcoder iso2022.bundle
linking transcoder japanese.bundle
linking transcoder japanese_euc.bundle
linking transcoder japanese_sjis.bundle
linking transcoder single_byte.bundle
linking transcoder utf8_mac.bundle
linking transcoder utf_16_32.bundle
linking transcoder korean.bundle
making encs
configuring fcntl
configuring fiber
configuring fiddle
configuring gdbm
configuring iconv
configuring io/console
configuring io/nonblock
configuring io/wait
configuring json
configuring json/generator
configuring json/parser
configuring mathn/complex
configuring mathn/rational
configuring nkf
configuring objspace
configuring openssl
configuring pathname
configuring psych
configuring pty
configuring racc/cparse
configuring readline
configuring ripper
configuring sdbm
configuring socket
configuring stringio
configuring strscan
configuring syck
configuring syslog
configuring tk/tkutil
Failed to configure tk/tkutil. It will not be installed.
configuring win32ole
Failed to configure win32ole. It will not be installed.
configuring zlib
compiling resize.c
compiling bug.c
compiling bug.c
compiling passing_block.c
installing default bug libraries
installing default funcall libraries
linking shared-object -test-/bug-3571/bug.bundle
installing default bug libraries
linking shared-object -test-/funcall/funcall.bundle
linking shared-object -test-/bug-3662/bug.bundle
installing default resize libraries
linking shared-object -test-/array/resize.bundle
ld: can't open output file for writing: ../../../.ext/x86_64-darwin12.3.0/-test-/bug-3571/bug.bundle, errno=2 for architecture x86_64
ld: can't open output file for writing: ../../../.ext/x86_64-darwin12.3.0/-test-/bug-3662/bug.bundle, errno=2 for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: can't open output file for writing: ../../../.ext/x86_64-darwin12.3.0/-test-/funcall/funcall.bundle, errno=2 for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../../.ext/x86_64-darwin12.3.0/-test-/bug-3662/bug.bundle] Error 1
make[1]: *** [ext/-test-/bug-3662/all] Error 2
make[2]: *** [../../../.ext/x86_64-darwin12.3.0/-test-/funcall/funcall.bundle] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [ext/-test-/funcall/all] Error 2
make[2]: *** [../../../.ext/x86_64-darwin12.3.0/-test-/bug-3571/bug.bundle] Error 1
make[1]: *** [ext/-test-/bug-3571/all] Error 2
ld: can't open output file for writing: ../../../../.ext/x86_64-darwin12.3.0/-test-/array/resize.bundle, errno=2 for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../../../.ext/x86_64-darwin12.3.0/-test-/array/resize.bundle] Error 1
make[1]: *** [ext/-test-/array/resize/all] Error 2
make: *** [build-ext] Error 2

Thanks for yout time guys!

squiter
  • 5,711
  • 4
  • 24
  • 24

3 Answers3

5

I know this question has already been answered, but I thought I'd contribute the commands needed to solve work-around this problem:

cd ~/.rvm/src/ruby-1.9.3-p392
mkdir -p .ext/x86_64-darwin12.3.0/-test-/array
mkdir -p .ext/x86_64-darwin12.3.0/-test-/bug-3571
mkdir -p .ext/x86_64-darwin12.3.0/-test-/bug-3662
mkdir -p .ext/x86_64-darwin12.3.0/-test-/funcall/
mkdir -p .ext/x86_64-darwin12.3.0/-test-/load/dot.dot/
mkdir -p .ext/x86_64-darwin12.3.0/-test-/old_thread_select
mkdir -p .ext/x86_64-darwin12.3.0/-test-/st
mkdir -p .ext/x86_64-darwin12.3.0/-test-/string
mkdir -p .ext/x86_64-darwin12.3.0/-test-/wait_for_single_fd
mkdir -p .ext/x86_64-darwin12.3.0/digest
mkdir -p .ext/x86_64-darwin12.3.0/dl
mkdir -p .ext/x86_64-darwin12.3.0/io
mkdir -p .ext/x86_64-darwin12.3.0/json/ext
mkdir -p .ext/x86_64-darwin12.3.0/mathn
dr4g0n
  • 76
  • 3
  • 1
    Thanks! It was exactly those folders! – squiter Apr 05 '13 at 13:05
  • 1
    You're welcome! Solving this was tedious for me, so I thought I'd save others some time. – dr4g0n Apr 06 '13 at 23:51
  • I'd call this a workaround rather than a solution. The problem still exists for anyone trying to build ruby with rvm -- if they haven't read this web page. – Br.Bill Apr 18 '13 at 23:52
  • Agreed. It was originally my intention to work out _why_ the build scripts aren't creating this directories themselves, but I never got round to it... I've edited my answer to not say that it _solves_ the problem. – dr4g0n Apr 27 '13 at 15:01
3

The log clearly states:

ld: can't open output file for writing: ../../../.ext/x86_64-darwin12.3.0/

Give her the ability :-) Just create a folder and chown it.

Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160
  • yeah I know, but I don't know exactly where I must use chown, from where I must start.... "../../../"?? – squiter Apr 03 '13 at 13:09
  • 1
    To my pity I’m far from OSX. Would you give a try to `find / -type d -name bug-3571`, since it’s the only distinguishable name? – Aleksei Matiushkin Apr 03 '13 at 13:33
  • I had to create multiple folder in x86_64-darwin12.3.0... more than 10 mkdirs..... but finaly works!! Thanks @mudasobwa – squiter Apr 03 '13 at 14:17
0

I had the same problem but with ruby 2.0.0

This helped (thanks @dr4g0n):

cd ~/.rvm/src/ruby-2.0.0-p195/.ext/x86_64-darwin12.4.0
mkdir -p ./-test-/array
mkdir -p ./-test-/bug-3571
mkdir -p ./-test-/bug-3662
mkdir -p ./-test-/funcall/
mkdir -p ./-test-/load/dot.dot/
mkdir -p ./-test-/old_thread_select
mkdir -p ./-test-/st
mkdir -p ./-test-/string
mkdir -p ./-test-/wait_for_single_fd
mkdir -p ./digest
mkdir -p ./dl
mkdir -p ./io
mkdir -p ./json/ext
mkdir -p ./mathn
mkdir -p ./racc
mkdir -p ./-test-/bug-5832/
mkdir -p ./-test-/fatal/
mkdir -p ./-test-/marshal/
mkdir -p ./-test-/iter/
mkdir -p ./-test-/num2int/
mkdir -p ./-test-/path_to_class/
mkdir -p ./-test-/symbol/
mkdir -p ./-test-/typeddata/
Artur Trzop
  • 336
  • 3
  • 12
  • I'm working through these mkdir commands for Ruby 2.0.0 now. Thanks for the help! Is anyone aware of an open rvm issue to avoid this workaround in the future? – srt32 Jul 20 '13 at 23:17