Unable to compile latest webruby #8

Closed
vincentwoo opened this Issue Jun 27, 2013 · 15 comments

Comments

Projects
None yet
2 participants
@vincentwoo

I've just installed llvm, etc. Here's what I get trying to do rake js (early bits omitted):

CC    build/emscripten/mrbgems/gem_init.c -> build/emscripten/mrbgems/gem_init.o
WARNING  root: -I or -L of an absolute path "-I/Users/vwoo/webruby/modules/mruby/include" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)
clang: warning: argument unused during compilation: '-nostdinc++'
AR    build/emscripten/lib/libmruby.a
/usr/local/bin/llvm-ar: creating /Users/vwoo/webruby/modules/mruby/build/emscripten/lib/libmruby.a
/Users/vwoo/webruby/modules/mruby/build/host/bin/mrbc -Bapp_irep -o/Users/vwoo/webruby/build/rbcode.c /Users/vwoo/webruby/build/rbcode.rb
cat /Users/vwoo/webruby/driver/driver.c /Users/vwoo/webruby/build/rbcode.c > /Users/vwoo/webruby/build/app.c
/Users/vwoo/webruby/modules/emscripten/emcc -Wall -Werror-implicit-function-declaration -I/Users/vwoo/webruby/modules/mruby/include /Users/vwoo/webruby/build/app.c -o /Users/vwoo/webruby/build/app.o
WARNING  root: -I or -L of an absolute path "-I/Users/vwoo/webruby/modules/mruby/include" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)
clang: warning: argument unused during compilation: '-nostdinc++'
ruby scripts/gen_post.rb 2 /Users/vwoo/webruby/build/js_api.js
Creating new post js file!
ruby scripts/gen_gems_config.rb /Users/vwoo/webruby/build_config.rb /Users/vwoo/webruby/build/js_api.js /Users/vwoo/webruby/build/gem_library.js /Users/vwoo/webruby/build/gem_append.js /Users/vwoo/webruby/build/gem_test_library.js /Users/vwoo/webruby/build/gem_test_append.js /Users/vwoo/webruby/build/functions
Creating new file: /Users/vwoo/webruby/build/gem_library.js!
Creating new file: /Users/vwoo/webruby/build/gem_append.js!
Creating new file: /Users/vwoo/webruby/build/gem_test_library.js!
Creating new file: /Users/vwoo/webruby/build/gem_test_append.js!
/Users/vwoo/webruby/modules/emscripten/emcc /Users/vwoo/webruby/build/app.o /Users/vwoo/webruby/modules/mruby/build/emscripten/lib/libmruby.a -o /Users/vwoo/webruby/build/webruby.js --js-library /Users/vwoo/webruby/build/gem_library.js --pre-js /Users/vwoo/webruby/build/gem_append.js -s EXPORTED_FUNCTIONS="['_mrb_open', '_mrb_close', '_webruby_internal_run', '_webruby_internal_run_bytecode', '_webruby_internal_run_source']" -O0

undefined:374
        throw 'Invalid token, cannot triage: ' + dump(item);
                                               ^
Invalid token, cannot triage: // {
//   "tokens": [
//     {
//       "text": "attributes"
//     },
//     {
//       "text": "#0"
//     },
//     {
//       "text": "="
//     },
//     {
//       "text": "{ nounwind\"less-precise-fpmad\"=\"false\"\"no-frame-pointer-elim\"=\"true\"\"no-frame-pointer-elim-non-leaf\"=\"true\"\"no-infs-fp-math\"=\"false\"\"no-nans-fp-math\"=\"false\"\"unsafe-fp-math\"=\"false\"\"use-soft-float\"=\"false\" }",
//       "tokens": [
//         {
//           "text": "nounwind"
//         },
//         {
//           "text": "\"less-precise-fpmad\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"no-frame-pointer-elim\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"true\""
//         },
//         {
//           "text": "\"no-frame-pointer-elim-non-leaf\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"true\""
//         },
//         {
//           "text": "\"no-infs-fp-math\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"no-nans-fp-math\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"unsafe-fp-math\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"use-soft-float\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         }
//       ],
//       "type": "{"
//     }
//   ],
//   "indent": 0,
//   "lineNum": 5622,
//   "__uid__": 163
// }
Traceback (most recent call last):
  File "/Users/vwoo/webruby/modules/emscripten/emscripten.py", line 809, in <module>
    _main(environ=os.environ)
  File "/Users/vwoo/webruby/modules/emscripten/emscripten.py", line 797, in _main
    temp_files.run_and_clean(lambda: main(
  File "/Users/vwoo/webruby/modules/emscripten/tools/tempfiles.py", line 38, in run_and_clean
    return func()
  File "/Users/vwoo/webruby/modules/emscripten/emscripten.py", line 805, in <lambda>
    DEBUG_CACHE=DEBUG_CACHE,
  File "/Users/vwoo/webruby/modules/emscripten/emscripten.py", line 691, in main
    jcache=jcache, temp_files=temp_files, DEBUG=DEBUG, DEBUG_CACHE=DEBUG_CACHE)
  File "/Users/vwoo/webruby/modules/emscripten/emscripten.py", line 179, in emscript
    assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?'
AssertionError: Did not receive forwarded data in pre output - process failed?
Traceback (most recent call last):
  File "/Users/vwoo/webruby/modules/emscripten/emcc", line 1439, in <module>
    final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
  File "/Users/vwoo/webruby/modules/emscripten/tools/shared.py", line 1091, in emscripten
    assert os.path.exists(filename + '.o.js') and len(open(filename + '.o.js', 'r').read()) > 0, 'Emscripten failed to generate .js: ' + str(compiler_output)
AssertionError: Emscripten failed to generate .js:
rake aborted!
Command failed with status (1): [/Users/vwoo/webruby/modules/emscripten/emc...]
/Users/vwoo/webruby/rakelib/build.rake:18:in `block in <top (required)>'
/Users/vwoo/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
/Users/vwoo/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => js => /Users/vwoo/webruby/build/webruby.js
(See full trace by running task with --trace)
@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

Hmm, this looks a little confusing. Can you tell me what version of LLVM you are using?

Owner

xxuejie commented Jun 27, 2013

Hmm, this looks a little confusing. Can you tell me what version of LLVM you are using?

@vincentwoo

This comment has been minimized.

Show comment
Hide comment
@vincentwoo

vincentwoo Jun 27, 2013

Is this what you're after?

Vincents-MacBook-Air:webruby vwoo$ clang --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.1
Thread model: posix

Is this what you're after?

Vincents-MacBook-Air:webruby vwoo$ clang --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.1
Thread model: posix
@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

I think the problem is that you are only installing llvm toolchain, but you are using the clang comes with XCode. My guess is that the bitcode generated by clang from XCode is not compatible with the llvm toolchain installed.

If you are using homebrew I suggest you try re-installing llvm using:

brew install llvm --with-clang

This might solve the problem.

Owner

xxuejie commented Jun 27, 2013

I think the problem is that you are only installing llvm toolchain, but you are using the clang comes with XCode. My guess is that the bitcode generated by clang from XCode is not compatible with the llvm toolchain installed.

If you are using homebrew I suggest you try re-installing llvm using:

brew install llvm --with-clang

This might solve the problem.

@vincentwoo

This comment has been minimized.

Show comment
Hide comment
@vincentwoo

vincentwoo Jun 27, 2013

That is how I installed llvm. I think I got the command from your docs.

That is how I installed llvm. I think I got the command from your docs.

@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

In this case can you confirm if you have clang under /usr/local/bin? And Does /usr/local/bin comes before /usr/bin in your PATH?

Owner

xxuejie commented Jun 27, 2013

In this case can you confirm if you have clang under /usr/local/bin? And Does /usr/local/bin comes before /usr/bin in your PATH?

@vincentwoo

This comment has been minimized.

Show comment
Hide comment
@vincentwoo

vincentwoo Jun 27, 2013

I think you're onto something

Vincents-MacBook-Air:webruby vwoo$ which clang
/usr/bin/clang
Vincents-MacBook-Air:webruby vwoo$ ls /usr/local/bin/clang
/usr/local/bin/clang

I think you want me to switch path loading so /usr/local/bin comes before /usr/bin?

I think you're onto something

Vincents-MacBook-Air:webruby vwoo$ which clang
/usr/bin/clang
Vincents-MacBook-Air:webruby vwoo$ ls /usr/local/bin/clang
/usr/local/bin/clang

I think you want me to switch path loading so /usr/local/bin comes before /usr/bin?

@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

Yep, this is what I mean. If you are using llvm toolchains from /usr/local/bin, you may want to use clang from /usr/local/bin.

Owner

xxuejie commented Jun 27, 2013

Yep, this is what I mean. If you are using llvm toolchains from /usr/local/bin, you may want to use clang from /usr/local/bin.

@vincentwoo

This comment has been minimized.

Show comment
Hide comment
@vincentwoo

vincentwoo Jun 27, 2013

I'm now using /usr/local/bin/clang, but I get the same error.

I'm now using /usr/local/bin/clang, but I get the same error.

@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

Can you do a rake clean first before running rake?

Owner

xxuejie commented Jun 27, 2013

Can you do a rake clean first before running rake?

@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

Or did you already do that?

Owner

xxuejie commented Jun 27, 2013

Or did you already do that?

@vincentwoo

This comment has been minimized.

Show comment
Hide comment
@vincentwoo

vincentwoo Jun 27, 2013

I did.

On Thu, Jun 27, 2013 at 10:56 AM, xxuejie notifications@github.com wrote:

Or did you already do that?


Reply to this email directly or view it on GitHubhttps://github.com/xxuejie/webruby/issues/8#issuecomment-20143021
.

I did.

On Thu, Jun 27, 2013 at 10:56 AM, xxuejie notifications@github.com wrote:

Or did you already do that?


Reply to this email directly or view it on GitHubhttps://github.com/xxuejie/webruby/issues/8#issuecomment-20143021
.

@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

This is wired, I will look into this. Sorry this happens.

Owner

xxuejie commented Jun 27, 2013

This is wired, I will look into this. Sorry this happens.

@vincentwoo

This comment has been minimized.

Show comment
Hide comment
@vincentwoo

vincentwoo Jun 27, 2013

No big deal. Thanks for an otherwise great project. Side note, any plans to
support require? This is the big blocker for me to use webruby in
production.

On Thu, Jun 27, 2013 at 10:59 AM, xxuejie notifications@github.com wrote:

This is wired, I will look into this. Sorry this happens.


Reply to this email directly or view it on GitHubhttps://github.com/xxuejie/webruby/issues/8#issuecomment-20143256
.

No big deal. Thanks for an otherwise great project. Side note, any plans to
support require? This is the big blocker for me to use webruby in
production.

On Thu, Jun 27, 2013 at 10:59 AM, xxuejie notifications@github.com wrote:

This is wired, I will look into this. Sorry this happens.


Reply to this email directly or view it on GitHubhttps://github.com/xxuejie/webruby/issues/8#issuecomment-20143256
.

@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 27, 2013

Owner

I have a guess on the problem: maybe you are using LLVM 3.3(This is the one that gets installed using homebrew now), but emscripten now only supports LLVM 3.2. But again, I'm not sure about this, I need more testing on this.

About require: I've been thinking about this for quite a while. The problem is that I haven't got a perfect solution for this. What's more, another main issue is that: with mruby, we do not need to "require" those module introduced from mrbgem, so I don't see a reason why we need "require" for other modules.

Maybe this will change, but for now, I don't see a need for require. My personal preference is mrubymix, but feel free to try to persuade me:)

For now, I don't suggest using this in production. There might be a lot of problems need to be tackled before using this in production. My plan is to create something myself first, trying to convince everyone(including me) that we can use webruby in production. But I've been so busy these days that I don't have the time to at least maintain webruby-_-

Owner

xxuejie commented Jun 27, 2013

I have a guess on the problem: maybe you are using LLVM 3.3(This is the one that gets installed using homebrew now), but emscripten now only supports LLVM 3.2. But again, I'm not sure about this, I need more testing on this.

About require: I've been thinking about this for quite a while. The problem is that I haven't got a perfect solution for this. What's more, another main issue is that: with mruby, we do not need to "require" those module introduced from mrbgem, so I don't see a reason why we need "require" for other modules.

Maybe this will change, but for now, I don't see a need for require. My personal preference is mrubymix, but feel free to try to persuade me:)

For now, I don't suggest using this in production. There might be a lot of problems need to be tackled before using this in production. My plan is to create something myself first, trying to convince everyone(including me) that we can use webruby in production. But I've been so busy these days that I don't have the time to at least maintain webruby-_-

@xxuejie

This comment has been minimized.

Show comment
Hide comment
@xxuejie

xxuejie Jun 28, 2013

Owner

@vincentwoo Okay, I think I got the problem for this: with homebrew we are installing LLVM 3.3 now, but emscripten only supports LLVM 3.2. Here's how you can solve this:

  1. Download LLVM 3.2 at here
  2. Extract the tarball, keep the location of the bin folder extracted somewhere. Suppose here the full path for bin is /Users/rafael/develop/clang+llvm-3.2-x86_64-apple-darwin11/bin.
  3. Here's two way you can change to use this LLVM version:
    • Setting LLVM environment variable: export LLVM=/Users/rafael/develop/clang+llvm-3.2-x86_64-apple-darwin11/bin
    • Change the LLVM_ROOT line in ~/.emscripten to point to this location
  4. After that, do a rake clean && rake, you can build webruby successfully.

I tried this on a clean iMac and everything works, let me know if this does not solve your problem :)

Owner

xxuejie commented Jun 28, 2013

@vincentwoo Okay, I think I got the problem for this: with homebrew we are installing LLVM 3.3 now, but emscripten only supports LLVM 3.2. Here's how you can solve this:

  1. Download LLVM 3.2 at here
  2. Extract the tarball, keep the location of the bin folder extracted somewhere. Suppose here the full path for bin is /Users/rafael/develop/clang+llvm-3.2-x86_64-apple-darwin11/bin.
  3. Here's two way you can change to use this LLVM version:
    • Setting LLVM environment variable: export LLVM=/Users/rafael/develop/clang+llvm-3.2-x86_64-apple-darwin11/bin
    • Change the LLVM_ROOT line in ~/.emscripten to point to this location
  4. After that, do a rake clean && rake, you can build webruby successfully.

I tried this on a clean iMac and everything works, let me know if this does not solve your problem :)

@xxuejie xxuejie closed this Jun 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment