-
Notifications
You must be signed in to change notification settings - Fork 120
Add -Wno-unused-variable
flag to OS X clang flag
#124
Conversation
Without this flag, it's unable to compile libv8 on OS X 10.10 due to this error message: ruby ext/libv8/extconf.rb creating Makefile HEAD is now at 7ce3fe1... Version 3.16.14 Using existing [svn-remote "svn"] HEAD is now at f7bc250... Make gyp/win32 compatible with upstream ninja. Compiling v8 for x64 Using python 2.7.6 Using compiler: /usr/bin/c++ (clang version 5.1) ../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable] static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); ^ 1 error generated. make[1]: *** [/Users/sikachu/Projects/libv8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o] Error 1 make: *** [x64.release] Error 2 GYP_GENERATORS=make \ build/gyp/gyp --generator-output="out" build/all.gyp \ -Ibuild/standalone.gypi --depth=. \ -Dv8_target_arch=x64 \ -S.x64 -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 CXX(target) /Users/sikachu/Projects/libv8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o CXX(target) /Users/sikachu/Projects/libv8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o CXX(target) /Users/sikachu/Projects/libv8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o CXX(target) /Users/sikachu/Projects/libv8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o CXX(target) /Users/sikachu/Projects/libv8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o This has been tested against this version of clang and OS X: $ g++ -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin14.0.0 Thread model: posix This should fix rubyjs#123
Wow, literally 2 min before me. I had the same thing committed on a local branch. Anyway LGTM. 👍 |
Building off of your fork on this under 10.10 ran successfully for me — and because of it, I was able to install |
@nixpulvis thanks! I actually was pulling my hair out about 2 hours before this patch is completed ... >_< The build is error because of outdated version of rbx, and it should be fixed after #125 got merged. |
Thanks! |
Add `-Wno-unused-variable` flag to OS X clang flag
hey @kreeger how'd you get |
Gah |
@nixpulvis I just cloned the source for the |
Thanks guys. Got it all worked out. |
For those poor souls like me that need to build libv8 for an old ruby: brew edit gcc # see https://github.com/Homebrew/homebrew/issues/29845#issuecomment-50105819
brew install gcc # brings in 4.9.1
CC=gcc-4.9 rbenv install 1.8.7-p374
rbenv local 1.8.7-p374 # outside libv8 as `rake clean` removes `.ruby-version`
gem install bundler
git clone https://github.com/cowboyd/libv8
cd libv8
git checkout v3.16.14.3
cat >> Gemfile
# newer versions need ruby 1.9+
gem 'rubyzip', '< 1.0.0'
gem 'rake-compiler', '<0.9'
^D
bundle install
rake checkout
curl https://raw.githubusercontent.com/sikachu/libv8/20093a74bfc77bd5ef772d8173f14e603682c373/patches/clang51/no-unused-variable.patch -o patches/no-unused-variable.patch
git add patches/no-unused-variable.patch # otherwise it gets `git clean`ed by `rake clean`
rake install |
@lloeki thanks a lot for the above. It was my last resort and it worked for me. For anybody else with the same problem, I changed the above to look like this:
|
When might this be released? Looks like the last release was 9 months ago. |
@cowboyd, do you think we should release 3.16.14.4? |
@ignisf 👍 to that. This would be great to release |
Can do, and certainly with a source release.@ignisf Do you have access to the rubygem? |
yes, I do, I'd have done it, but I have no way of creating MacOS binaries, can take care of various linux and freebsd binaries though |
Hmm. Yeah, and I can't generate any OSX binaries on any other version but 10.9. It would be really nice if there were a Virtualization/CI story that could do multiple OSX versions, but wasn't hugely expensive to maintain. |
Let's go ahead and release the source version, and the binaries we can. I'll release the binary for 10.9 |
Source gem is up as well as linux x86_64 binary |
Dammit (Yosemite PB3, ruby 2.1.2, libv8 3.16.14.7):
Manual build and install of 3.16.14.7 (as described above) worked fine. |
This should no longer happen, as I explicitly disabled |
@lloeki, please check why is this patch not affecting your system and why doesn't the |
I was seeing the following error when running `bundle install`: Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher Using compiler: g++ This then seems to have resulted in the following compilation error: ../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable] static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); ^ I believe the problem was fixed [1] between version 3.16.14.3 and version 3.16.14.7 of libv8 and a simple `bundle update libv8` seems to have done the trick. [1]: rubyjs/libv8#124
I was seeing the following error when running `bundle install`: Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher Using compiler: g++ This then seems to have resulted in the following compilation error: ../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable] static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); ^ I believe the problem was fixed [1] between version 3.16.14.3 and version 3.16.14.7 of `libv8`. Relaxing the Gemfile constraint on `therubyracer` and bundle updating `therubyracer` & `libv8` seems to have done the trick. See also a similar fix for the `static` app [2]. [1]: rubyjs/libv8#124 [2]: alphagov/static#570
Without this flag, it's unable to compile libv8 on OS X 10.10 due to this error message:
This has been tested against this version of clang and OS X:
This should fix #123
I'm really not sure if this is the right way to fix this issue, and I would rather have v8 devs fix the warning. However, this make the gems works on OS X 10.10, and it would be great if you could accept this patch.
Thank you.