rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 191 forks source link

only run C spec compiled with Clang #355

Closed cowboyd closed 9 years ago

cowboyd commented 9 years ago

In order to make sure we have valid failures on this branch, and not just a bunch of false negatives, we're only running the C specs, and building with clang. Eventually, we'll merge in support for gcc and more of the test suite.

For now, we want to only include the specs we things should be passing

cowboyd commented 9 years ago

I am defeated.

@ignisf maybe you can show me where I'm being stupid here. I'm just tring to get it to use either g++-4.8 or a modern version of clang, but I can't seem to have the compile actually use either one of those.

ignisf commented 9 years ago

Will check it out

ignisf commented 9 years ago

I don't believe mkmf takes into account the C and CXX environment variables. I believe it uses the same compiler Ruby was compiled with. You can override by adding

RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['CXX'] if ENV['CXX']

after requre 'mkmf' in extconf.rb.

Also there's a clang-compiled ruby version in Travis, I think.

ignisf commented 9 years ago

Ref. https://github.com/ruby/ruby/blob/a9721a259665149b1b9ff0beabcf5f8dc0136120/lib/mkmf.rb#L62 https://github.com/ruby/ruby/blob/a9721a259665149b1b9ff0beabcf5f8dc0136120/lib/mkmf.rb#L1914

rbconfig.rb is being generated by tool/mkconfig.rb on compile.

Travis rubies http://rubies.travis-ci.org/

cowboyd commented 9 years ago

Looks like the libv8 binary I'm using is corrupted. It could be that it's using absolute paths for the objects in the archive. I seem to recall us running into this issue before. I can't remember the fix, but it's generating correctly in osx.

vagrant@vagrant:~/libv8/vendor/v8$ ar t out/x64.release/obj.target/tools/gyp/libv8_base.a
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/allocation.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/allocation-site-scopes.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/allocation-tracker.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/api.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/api-natives.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/arguments.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/assembler.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/assert-scope.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/ast-value-factory.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/ast-literal-reindexer.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/ast-numbering.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/ast.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/background-parsing-task.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/bailout-reason.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/basic-block-profiler.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/bignum-dtoa.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/bignum.o
/home/vagrant/libv8/vendor/v8/out/x64.release/obj.target/v8_base/src/bit-vector.o
......
cowboyd commented 9 years ago

Ah, right, I remember now. It was generating thin archives on linux, but not mac for some reason.

ignisf commented 9 years ago
[ignisf@clarity therubyracer]$ bundle exec rspec spec/c
.........................................

Finished in 0.12006 seconds
41 examples, 0 failures
[ignisf@clarity therubyracer]$
cowboyd commented 9 years ago

hallelujah!