amirrajan / rubymotion-applied

RubyMotion documentation provided by the community. Submit a pull request to the docs for a free one year indie subscription.
Apache License 2.0
49 stars 10 forks source link

High Sierra issues with symlinking Toolchain directory #96

Closed andrewhavens closed 5 years ago

andrewhavens commented 6 years ago

You might run into this issue when running Mac 10.13 (High Sierra), Xcode (installed via the Mac App Store), and RubyMotion 5.7:

RubyMotion attempted to create a symlink under /Applications/Xcode.app/Contents/Developer/Toolchains, but wasn't able to.
Please run the following command manually: 
ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain
You may need to run the command above with `sudo`.
/Library/RubyMotion/bin/gen_bridge_metadata:17:in `symlink': Permission denied @ rb_file_s_symlink - (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain, /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain) (Errno::EACCES)
    from /Library/RubyMotion/bin/gen_bridge_metadata:17:in `<main>'
rake aborted!
Command failed with status (1): [RUBYOPT='' '/Library/RubyMotion/bin/gen_br...]
/Library/RubyMotion/lib/motion/project/xcode_config.rb:476:in `gen_bridge_metadata'
/Library/RubyMotion/lib/motion/project/vendor.rb:242:in `generate_bridgesupport'
/Library/RubyMotion/lib/motion/project/vendor.rb:225:in `build_xcode'
/Library/RubyMotion/lib/motion/project/vendor.rb:48:in `block in build'
/Library/RubyMotion/lib/motion/project/vendor.rb:47:in `chdir'
/Library/RubyMotion/lib/motion/project/vendor.rb:47:in `build'
/Library/RubyMotion/lib/motion/project/builder.rb:68:in `block in build'
/Library/RubyMotion/lib/motion/project/builder.rb:67:in `each'
/Library/RubyMotion/lib/motion/project/builder.rb:67:in `build'
/Library/RubyMotion/lib/motion/project/app.rb:78:in `build'
/Users/andrew/.rubymotion/rubymotion-templates/motion/project/template/ios.rb:69:in `block (2 levels) in <top (required)>'
/Users/andrew/.rubymotion/rubymotion-templates/motion/project/template/ios.rb:179:in `block in <top (required)>'
Tasks: TOP => build:simulator
(See full trace by running task with --trace)

Mixed into this long block of text is a helpful message:

Please run the following command manually: 
ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain
You may need to run the command above with `sudo`.

(It would be nice if this message was formatted like the other kinds of RubyMotion error messages so that it would be easier to read).

However, this issue can also cause another issue to happen. The error output could be written to a .bridgesupport file. In my case, my sqlite3.bridgesupport file was generated incorrectly. The workaround solution was to remove the file so that it could be regenerated:

...
   Compile /Users/andrew/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bubble-wrap-1.9.6/motion/util/deprecated.rb
2018-03-12 11:00:26.864 ruby[91174:8855670] can't open BridgeSupport full file at path `build/sqlite3.bridgesupport': Error Domain=NSXMLParserErrorDomain Code=4 "Line 1: Document is empty
" UserInfo={NSLocalizedDescription=Line 1: Document is empty
}
    ERROR! File '/vendor/motion-layout/lib/motion-layout/version.rb' failed to compile
2018-03-12 11:00:27.099 ruby[91176:8855672] can't open BridgeSupport full file at path `build/sqlite3.bridgesupport': Error Domain=NSXMLParserErrorDomain Code=4 "Line 1: Document is empty
" UserInfo={NSLocalizedDescription=Line 1: Document is empty
}
2018-03-12 11:00:27.108 ruby[91175:8855669] can't open BridgeSupport full file at path `build/sqlite3.bridgesupport': Error Domain=NSXMLParserErrorDomain Code=4 "Line 1: Document is empty
" UserInfo={NSLocalizedDescription=Line 1: Document is empty
}
2018-03-12 11:00:27.245 ruby[91177:8855676] can't open BridgeSupport full file at path `build/sqlite3.bridgesupport': Error Domain=NSXMLParserErrorDomain Code=4 "Line 1: Document is empty
" UserInfo={NSLocalizedDescription=Line 1: Document is empty
}

$ ls -la build/
total 8
drwxr-xr-x   4 andrew  staff  128 Mar 12 11:00 .
drwxr-xr-x  15 andrew  staff  480 Mar 12 10:27 ..
drwxr-xr-x   3 andrew  staff   96 Mar 12 11:00 iPhoneSimulator-9.0-Development
-rw-r--r--   1 andrew  staff  377 Mar 12 10:27 sqlite3.bridgesupport

$ cat build/sqlite3.bridgesupport 
RubyMotion attempted to create a symlink under /Applications/Xcode.app/Contents/Developer/Toolchains, but wasn't able to.
Please run the following command manually: 
ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain
You may need to run the command above with `sudo`.

$ rm build/sqlite3.bridgesupport
andrewhavens commented 5 years ago

Pretty sure this has been resolved, so I'm going to close this issue.