Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

qt 4.8.0 compatibility error: "Can't load , the file may be broken." #101

Closed
andrewdeandrade opened this issue Dec 23, 2011 · 20 comments
Closed

Comments

@andrewdeandrade
Copy link

[ruby-1.9.3-p0] [~/code/backbone-jasmine-examples] [working]$ jasmine-headless-webkit
Can't load , the file may be broken.
Out of curiosity, did your tests try to submit a form and you haven't prevented that?
Try running your tests in your browser with the Jasmine server and see what happens.?

I keep getting this error with jasmine-headless-webkit, regardless of which project I try to use it in. I've tried it in our current project. I tried it on two online projects designed to show off jasmine and it didn't work with those either. For example, the error above came from adding jasmine-headless-webkit to: https://github.com/froots/backbone-jasmine-examples

At this point, I've exhausted every idea I have for debugging this. I've delved as far into the gem as I could and still be futzing around with ruby code. I don't even know where to begin,especially since the error message doesn't say which file it failed on.

My computer is a 17" MBP running OS X Lion, 10.7.2

Here are the contents of the file emitted by the --runner-out option:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
    <title>Jasmine Test Runner - Generated by jasmine-headless-webkit</title>
    <script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/vendor/assets/javascripts/prolog.js"></script>
    <script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-core-1.1.0/lib/jasmine-core/jasmine.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-core-1.1.0/lib/jasmine-core/jasmine-html.js"></script>
<link rel="stylesheet" href="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-core-1.1.0/lib/jasmine-core/jasmine.css" type="text/css" />
<script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/vendor/assets/javascripts/jasmine-extensions.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/vendor/assets/javascripts/intense.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/vendor/assets/javascripts/headless_reporter_result.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/vendor/assets/javascripts/jsDump.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/vendor/assets/javascripts/beautify-html.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/support/sinon-1.0.0.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/support/jasmine-sinon.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/support/jasmine-jquery.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/fixtures/Todos.fixture.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/templates/todo-template.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/lib/jquery-1.6.3.min.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/lib/underscore-min.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/lib/backbone-min.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/lib/handlebars.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/models/Todo.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/collections/Todos.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/routers/AppRouter.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/views/TodoDetailView.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/views/TodoListView.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/public/javascripts/views/TodoView.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/helpers/SpecHelper.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/collections/Todos.spec.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/views/TodoListView.spec.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/routers/AppRoutes.spec.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/views/TodoView.spec.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/routers/AppRouter.spec.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/intro.spec.js"></script>
<script type="text/javascript" src="/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/models/Todo.spec.js"></script>
    <script type="text/javascript">
      if (window.JHW) { HeadlessReporterResult.specLineNumbers = {"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/support/sinon-1.0.0.js":{":":[1118],";":[1486]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/support/jasmine-sinon.js":{" ":[3]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/templates/todo-template.js":{" type=\"text\" value=\"{{title}}\" style=\"display:none":[5]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/collections/Todos.spec.js":{"Todos collection":[1],"When instantiated with model literal":[34],"should have 1 Todo model":[43],"should find a model by id":[48],"should find a model by index":[52],"should have called the Todo constructor":[56],"When adding models":[63],"should order models by priority by default":[65],"when fetching collection from server":[76],"should make the correct request":[93],"should parse the todos from the response":[100],"should inject the list name for each todo":[107],"Custom finds":[118],"by priority":[124],"should return only todos with the priority specified":[126]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/views/TodoListView.spec.js":{"TodoListView":[1],"Instantiation":[7],"should create a list element":[9],"should have a class of 'todos'":[13],"Rendering":[19],"creates a Todo view for each todo item":[45],"renders each Todo view":[52],"appends the todo to the todo list":[56]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/routers/AppRoutes.spec.js":{"AppRouter routes":[1],"fires the todo detail route":[11],"fires the index route with a blank hash":[18]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/views/TodoView.spec.js":{"TodoView":[1],"loads the Todo template":[17],"Root element":[21],"is a LI":[23],"Rendering":[29],"returns the view object":[31],"produces the correct HTML":[38],"Template":[43],"has the correct URL":[49],"has the correct title text":[53],"has the correct input field value":[57],")).toHaveValue('My Todo":[58],"When todo is done":[64],"has a done class":[71],"Edit state":[79],"When edit button handler fired - Jasmine async":[81],").trigger('click":[86,105],"shows the edit input field":[89,113],"When edit button handler fired - sinon timers":[99]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/routers/AppRouter.spec.js":{"AppRouter":[1],"Index handler":[26],"when no Todo list exists":[28],"creates a Todo list collection":[34],"creates a Todo list view":[39],"fetches the Todo list from the server":[46],"Todo detail handler":[55],"when no detail view exists":[57],"creates a detailed todo view":[63],"creates a todo model":[70]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/intro.spec.js":{"Episode model":[7],"should fire the change event":[16]},"/Users/andrewdeandrade/code/backbone-jasmine-examples/spec/javascripts/models/Todo.spec.js":{"Todo model":[1],"when instantiated":[14],"should exhibit attributes":[16],"should set the priority to default value":[23],"should set the done property to default value":[27],"urls":[33],"when no id is set":[35],"should return the collection URL":[36],"when id is set":[41],"should return the collection URL and id":[42],"when saving":[50],"should not save when title is empty":[71],"should make a save request to the server":[79],"should fire a change event and provide returned todo model":[86]}}; }
    </script>
  </head>
  <body>
    <script type="text/javascript">
      jasmine.getEnv().console = {
        log: function(msg) { JHW.stdout.puts(msg) }
      }

      window._onload = window.onload;

      window.onload = function() {
        if (window._onload && (window._onload != window.onload)) {
          window._onload();
        }

        if (window.JHW) {
          jasmine.getEnv().addReporter(new jasmine.HeadlessConsoleReporter());
        } else {
          types = [ 'HtmlReporter', 'TrivialReporter' ];

          for (var i = 0, j = types.length; i < j; ++i) {
            var type = jasmine[types[i]]
            if (type) {
              jasmine.getEnv().addReporter(new type());
              break;
            }
          }
        }

        jasmine.getEnv().execute();
      }
    </script>
  </body>
</html>
@johnbintz
Copy link
Owner

I was able to get the tests from the Git repo running on my system (10.6, 1.9.2-p280 and 1.9.3-rc1) using both the standalone Gem and by adding the Gem to the Gemfile. When I get back from vacation, I can have a friend with Lion determine if it's a problem with that version of the OS.

What version of Qt did you install?

@andrewdeandrade
Copy link
Author

I installed qt 4.8.0 using brew and the compile from source options, $ brew install qt --build-from-source

[ruby-1.9.3-p0] [~/code/backbone-jasmine-examples] [working]$ brew info qt
qt 4.8.0
http://qt.nokia.com/
/usr/local/Cellar/qt/4.8.0 (2721 files, 192M)

Also, I tried this with ruby-1.9.2-p290 as well and got the same issue. Let me know if there is anything else I can try out here. I'm super anxious to try this out. I already have JSLint and LiveReload set up, so it's the remaining piece left to implement in Guard to get fully automated development goodness.

Thanks!

@johnbintz
Copy link
Owner

Qt 4.8 may be the problem. I didn't even know it was out and haven't had any chance to see what changed with regards to Qt WebKit. Try a 4.7.x line and see if that makes it work.

@andrewdeandrade
Copy link
Author

Weird. I tried checking out the qt formula for 4.7.4 and it installed but some how it didn't work. Going to try to install qt 4.7.4 from source now.

It says 4.7.4 is installed, but the error references qt 4.8.0, even though I ran brew uninstall qt before I installed 4.7.4

[ruby-1.9.3-p0] [~/code/backbone-jasmine-examples] [master]$ brew info qt
qt 4.7.4
http://qt.nokia.com/
/usr/local/Cellar/qt/4.7.4 (2578 files, 285M)

We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.

http://github.com/mxcl/homebrew/commits/master/Library/Formula/qt.rb

[ruby-1.9.3-p0] [~/code/backbone-jasmine-examples] [master]$ jasmine-headless-webkit --runner-out temp.html
dyld: Library not loaded: /usr/local/Cellar/qt/4.8.0/lib/QtWebKit.framework/Versions/4/QtWebKit
  Referenced from: /Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner
  Reason: image not found

Test ordering seed: --seed 5469
[jasmine-headless-webkit] no implicit conversion from nil to integer (TypeError)
  /Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/lib/jasmine/headless/command_line.rb:18:in `exit'
  /Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/lib/jasmine/headless/command_line.rb:18:in `run!'
  /Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-headless-webkit-0.8.4/bin/jasmine-headless-webkit:10:in `<top (required)>'
  /Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/bin/jasmine-headless-webkit:19:in `load'
  /Users/andrewdeandrade/.rvm/gems/ruby-1.9.3-p0/bin/jasmine-headless-webkit:19:in `<main>'

@johnbintz
Copy link
Owner

You'll have to reinstall the gem, if you haven't done so already.

@andrewdeandrade
Copy link
Author

Worked. You're awesome. Thanks. I'm going to leave this open as an issue and rename it to QT 4.8.0 compatibility.

@christiannelson
Copy link

I wish I could follow an issue without having to comment on it: +1

@andrewdeandrade
Copy link
Author

@christiannelson You can. On an issue you haven't commented on, just look for this text below the "Comment on this issue" button:

"Notifications for new comments on this Issue are off. Enable notifications for this Issue"

@christiannelson
Copy link

@malandrew thanks!

@johnbintz
Copy link
Owner

Turns out Qt 4.8's WebKit widget implementation doesn't let you play fast an loose with file paths for loading local files. I was feeding it runner.html when it at least needed ./runner.html or, better yet, /full/path/runner.html. Latest commit should fix that issue in 4.8 and 4.7, since it's actually an issue with what the Ruby wrapper sends to the C++ runner. (Did clean up just what gets sent into the WebKit widget, just to make it real clear what's going on).

@johnbintz
Copy link
Owner

Just tested on 4.7.4 on my work machine. Works great there.

@andrewdeandrade
Copy link
Author

John,

Didn't work over here. I force removed all qt versions from my system and reinstalled. Then I removed all the installed gems from the rvm folder and I'm still getting the error.

I'm going to try installing qt 4.8.0 from the source now to see if that resolves this. I also realized that I didn't have the gem file pointing to the master branch on this github repo. Out of curiosity, how long does it take for changes made here to make it to rubygems.org?

[ruby-1.9.3-p0] [~/code/backbone-jasmine-examples] [working]$ bundle install | grep "headless"
Using jasmine-headless-webkit (0.8.4) 

[ruby-1.9.3-p0] [~/code/backbone-jasmine-examples] [working]$ jasmine-headless-webkit
Can't load , the file may be broken.
Out of curiosity, did your tests try to submit a form and you haven't prevented that?
Try running your tests in your browser with the Jasmine server and see what happens.

Test ordering seed: --seed 3150

[ruby-1.9.3-p0] [~/code/backbone-jasmine-examples] [working]$ brew info qt
qt 4.8.0
http://qt.nokia.com/
/usr/local/Cellar/qt/4.8.0 (2722 files, 194M)

We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.

http://github.com/mxcl/homebrew/commits/master/Library/Formula/qt.rb

@andrewdeandrade
Copy link
Author

John,

Got it working. I had to build qt from source using: brew install qt --build-from-source

Then I had to clone and build the gem in my rvm gems folder and install it from the resulting pkg/ folder using the instructions here: http://stackoverflow.com/questions/2823492/install-gem-from-github-branch

In other words, it works fine with qt 4.8.0, but for the time being the current :master branch isn't available from rubygems.org and putting gem 'jasmine-headless-webkit', :git => 'git://github.com/johnbintz/jasmine-headless-webkit.git', :branch => 'master in the gem file doesn't seem to be working for some reason.

@christiannelson
Copy link

I found that I had to remove a directory to get :git bundler deps to rebuild. Using rvm, it was ~/.rvm/gems/ruby-1.9.3-p0@<gemset>/bundler/gems/jasmine-headless-webkit-<sha>. Otherwise, bundler wasn't rebuilding the gem for me because it thought there was an already suitable version around.

@cromulus
Copy link

cromulus commented Mar 9, 2012

I'm still having this issue: i've followed the fixes above, built qt 4.8.0 from source on lion, cleaned out all previous versions of jasmine-headless-webkit, installed the latest version of jasmine-headless-webkit from github, and still, getting the "Can't load , the file may be broken" error. Any ideas?

@johnbintz
Copy link
Owner

No idea off the top of my head, @cromulus. I believe thorough debugging of the C++ runner on your system would be the only way. I don't have the time to look deeper into this myself right now, so if you want, I would suggest looking through the files in ext and see if you can start to pinpoint where filenames aren't being passed along properly on your setup. It would be best to use bundle exec guard to recompile everything and re-run tests automatically on your setup.

@danielevans
Copy link

I just had the same issue and installing from the git branch resolved it. Thanks!

@hawknewton
Copy link

I was able to avoid having to install the qt from source (which takes forever).

The root of the problem is twofold:

  1. bundler-mananged git-sourced gems are not available outside a bundler-mananged environment.
  2. The version of jasmine-headless-webkit available on ruby gems.org is 0.8.4, while the current version in the git repo is 0.9.0.rc1.

The morale of the story? use 'bundle exec' (in this case: 'bundle exec jasmine-headless-webkit') any time you have git-sourced gems in your Gemfile.

@jgervin
Copy link

jgervin commented Jul 17, 2012

I had the same issue, but installed qt 4.8 (not from source just 'brew install qt') then after the 4.8 install I just ran 'sudo gem install jasmine-headless-webkit' again over top again. I thinks its the order in which you install. So for me I did the following steps

sudo gem install jasmine-headless-webkit
brew install qt
sudo gem install jasmine-headless-webkit

Now it works.

@alan-andrade
Copy link

I confirm thtat the solution posted by @hawknewton works.

I had qt 4.8 previously installed, and just by specifying the git source for the gem did the trick. No need to reinstall qt whatsoever.

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants