Closed jlc closed 12 years ago
Thanks for the fix, it worked for me too. Hope the change required to libv8 will be applies soon.
Cheers
Guy
It seems that there is a conflict when you have v8 installed in your system already.
Here is what I did to get closer to installing therubyracer:
$ cd /usr/ports/lang/v8
$ sudo make deinstall
$ scons arch=x64
This compiles, but when I run sudo gem install therubyracer
I lose my successful build and it resets the SConstruct...
Any way to get therubyracer to use the system shared v8?
@eddanger : During my previous googling looking for a solution to the problem, it seams that therubyracer is using a separate version of libv8 due to the frequent changes on the lib api which make it difficult to maintain the module (if I got it well).
@turgu1 : As a side note to my previous report, does therubyracer tried to build the libv8 (as shown at the begin of the previous report)?
...v8/libv8.a: No such file or directory
Moreover, if I remermber well my last tests (I cannot recheck right now, but it can be done later if necessary), the "gem install libv8" is building it nicely.
@jlc: I'm still trying to understand the installation process used when building therubyracer. I wanted to fork libv8 to adjust the parameters and propose an easy correction back through github, but I can't see how I could access the version 3.3.10.4 of libv8 used by therubyracer. Following the recipe you gave, I was able to get the installed libv8.a compiled and therubyracer linked, but I still get some errors at run-time that I would like to debug before posting again about it.
My context of use is the following: I'm developing a Ruby on Rails document management application that uses Twitter Bootstrap to build the HTML/Javascript front-end. As bootstrap uses Less as a pre-processing language to produce CSS, it requires therubyracer to support the Less compiler. To integrate bootstrap, I use the twitter-bootstrap-rails gem. Everything goes well under OSX (my development environment) but when I deploy through Capistrano on the targeted FreeBSD production server, I get compiling errors from the bundle process during deployment. On both the development and deployment environment, I use the last stable Ruby version 1.9.3, Ruby on Rails version 3.2.3, RVM to manage the ruby interpreter and PostgreSQL as the database backend (of course, Capistrano to automate the deployment).
Under OSX, therubyracer seems to install a binary version of the libv8 gem(no source found on my development system). Under FreeBSD, the version seems to be related to http://github.com/fractaloop/libv8, but I can't get access to it through github.
The Capistrano process make bundler run and put all gems required by the application at the following place:
/home/edoc2/apps/eDoc2/shared/bundle/ruby/1.9.1/gems
where I found the libv8-3.3.10.4 directory. Using your recipe, I managed to compile libv8.a and make it available to the complete the deployment process. The bundle process didn't tried to compile it again as it was there. But still, I get runtime errors.
Hope all this help!
Cheers!
Guy
Thanks, jlc. While extracting your workaround, I turned it into a script for my own documentation purposes and others who might find it useable.
https://gist.github.com/2621916
Note that this is for a RVM based installation. Amend the paths according to your setup.
@GSI slightly modified for my setup allows me to install:
https://gist.github.com/2623519
But I'm getting a Core dump when using therubyracer in my projects.
I created fork that should works I tested it on freebsd 8.x
@madmax thank you, thank you, thank you!
@madmax thank you for building this but unfortunately libv8-freebsd does not seem to compile for me on FreeBSD 9 amd64, doing a gem install libv8-freebsd --verbose I have the following error:
scons: warning: Ignoring missing SConscript 'obj/test/release/SConscript' File "/usr/home/oggy/.rvm/gems/ruby-1.9.3-p194/gems/libv8-freebsd-3.3.10.4/lib/libv8/build/v8/SConstruct", line 1411, in BuildSpecific src/extensions/externalize-string-extension.cc:55: error: 'uc16' was not declared in this scope src/extensions/externalize-string-extension.cc:55: error: template argument 1 is invalid src/extensions/externalize-string-extension.cc:56: error: invalid type in declaration before ';' token src/extensions/externalize-string-extension.cc: In member function 'virtual v8::Handlev8::FunctionTemplate v8::internal::ExternalizeStringExtension::GetNativeFunction(v8::Handlev8::String)': src/extensions/externalize-string-extension.cc:66: error: 'strcmp' was not declared in this scope src/extensions/externalize-string-extension.cc:69: error: 'ASSERT' was not declared in this scope src/extensions/externalize-string-extension.cc: In static member function 'static v8::Handlev8::Value v8::internal::ExternalizeStringExtension::Externalize(const v8::Arguments&)': src/extensions/externalize-string-extension.cc:91: error: incomplete type 'v8::Utils' used in nested name specifier src/extensions/externalize-string-extension.cc:92: error: 'class v8::String' has no member named 'IsExternalString' src/extensions/externalize-string-extension.cc:96: error: 'class v8::String' has no member named 'IsAsciiRepresentation' src/extensions/externalize-string-extension.cc:97: error: 'class v8::String' has no member named 'length' src/extensions/externalize-string-extension.cc:98: error: 'WriteToFlat' is not a member of 'v8::String' src/extensions/externalize-string-extension.cc:98: error: 'class v8::String' has no member named 'length' src/extensions/externalize-string-extension.cc:100: error: 'class v8::String' has no member named 'length' src/extensions/externalize-string-extension.cc:102: error: 'class v8::String' has no member named 'IsSymbol' src/extensions/externalize-string-extension.cc:103: error: 'HEAP' was not declared in this scope src/extensions/externalize-string-extension.cc:107: error: 'uc16' was not declared in this scope src/extensions/externalize-string-extension.cc:107: error: 'data' was not declared in this scope src/extensions/externalize-string-extension.cc:107: error: expected type-specifier before 'uc16' src/extensions/externalize-string-extension.cc:107: error: expected `;' before 'uc16' src/extensions/externalize-string-extension.cc:108: error: 'WriteToFlat' is not a member of 'v8::String' src/extensions/externalize-string-extension.cc:108: error: 'class v8::String' has no member named 'length' src/extensions/externalize-string-extension.cc:110: error: 'class v8::String' has no member named 'length' src/extensions/externalize-string-extension.cc:110: error: new initializer expression list treated as compound expression src/extensions/externalize-string-extension.cc:111: error: no matching function for call to 'v8::String::MakeExternal(v8::internal::SimpleTwoByteStringResource&)' /usr/local/include/v8.h:1238: note: candidates are: bool v8::String::MakeExternal(v8::String::ExternalStringResource) /usr/local/include/v8.h:1259: note: bool v8::String::MakeExternal(v8::String::ExternalAsciiStringResource) src/extensions/externalize-string-extension.cc:112: error: 'class v8::String' has no member named 'IsSymbol' src/extensions/externalize-string-extension.cc:113: error: 'HEAP' was not declared in this scope src/extensions/externalize-string-extension.cc: In static member function 'static v8::Handlev8::Value v8::internal::ExternalizeStringExtension::IsAscii(const v8::Arguments&)': src/extensions/externalize-string-extension.cc:130: error: incomplete type 'v8::Utils' used in nested name specifier scons: ** [obj/release/extensions/externalize-string-extension.o] Error 1 gmake: *\ [build/v8/libv8.a] Error 2 creating Makefile
Hmm, I tested it on Freebsd 8.2 and 8.1. Did you have ports/lang/v8 installed? If yes try uninstall it.
Try
gem unpack libv8-freebsd cd libv8-freebsd-3.3.10.4/lib/libv8 gmake
What version gcc it use? For me it is cd build/v8 && SHELL=/bin/sh && GCC_VERSION=42 ../scons/install/bin/scons arch=x64
@madmax removed the v8 port and have libv8-freebsd and therubyracer-freebsd installed, thanks.
@madmax So, I was able to get these installed under FreeBSD 9.0, but the issue now is that my Rails project uses the Assets pipeline and I see this in my Gemfile.lock:
less (2.0.12)
commonjs (~> 0.2.0)
therubyracer (~> 0.9.9)
I was able to get around this by manually renaming my installed gems to pose as therubyracer and libv8 (ie. remove the -freebsd), but this doesn't seem like a great solution.
And when running it, I get a similar coredump to @eddanger:
/usr/local/lib/ruby/gems/1.9/gems/therubyracer-freebsd-0.10.1/lib/v8/portal.rb:16: [BUG] Stack consistency error (sp: 309, bp: 310) ruby 1.9.3p125 (2012-02-16 revision 34643) [i386-freebsd9]
:(
@pgib please update less and it should works just fine.
You can also use
gem 'therubyracer', git: "git://github.com/madmax/therubyracer-freebsd.git"
But this old less version require old therubyracer and still it will not work, i suggest update less.
About [BUG] i have no idea, i'm not C guy :)
therubyracer and libv8 builds have been updated on master to fix this and other issues.
Hey Charles,
I came across a building issue of the libv8 gem while installing gitlab in a FreeBSD jail, and would like to share the problem and the solution I have found with you and anyone who might be interested.
The big picture: a) this is the first time ever I'm getting close to ruby, RoR, gem...etc. Excuse me if I'm missing something somewhere. b) uname -a : FreeBSD 9.0-RELEASE #0 amd64 c) gcc --version: gcc (GCC) 4.2.1 20070831 patched [FreeBSD] d) requirement: make gitlab work :)
After I have understood that therubyracer is using a special version of libv8, and that we should not use the one provided by ports (/usr/ports/lang/v8), I tried to run
Which gently install the libv6, however:
Says:
After few mistake (certainly due the lack of sleep...) between the 2 set of code in:
and
I continued with:
Which produces:
Googling this issue point to: http://code.google.com/p/v8/issues/detail?id=744
Which say:
Great! This nicely build libv8.a!
However,
Says:
We then need to add -fPIC into the freebsd section of
Rebuild libv8:
Install therubyracer
Which, finally, says:
I hope it has been clear enough for you to fix it. If you need any tests / help : jl@lo.cx
Wish you a nice day,
Jeanluc