3

Installing gitlab into my odroid went just fine... Using the steps from https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md until this command

sudo -u git -H bundle install --deployment --without development test postgres aws

but that just failed to install therubyracer 0.12.0 (actually, what failed was compiling v8, because it requires the -fPIC flag). Here's the error message

/usr/bin/ld: /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/libv8-3.16.14.3/vendor/v8/out/arm.release/obj.target/tools/gyp/libv8_base.a(api.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/libv8-3.16.14.3/vendor/v8/out/arm.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

So... I installed v8 on the system by cloning https://github.com/v8/v8 and doing a checkout of the commit 7ce3fe106a37826dc23189a78dcb9000a1b3fa06 (b/c that's what's used on libv8 on the tag v3.16.14.3 and that's the one Gitlab needs).

The missing flag is -fPIC, so after doing make dependencies I did this change (doing it as a patch so that's easier to see... I just added -fPIC whenever -Wall is used)

--- build/standalone.gypi.original  2014-02-09 21:58:48.627732201 +0000
+++ build/standalone.gypi   2014-02-09 22:02:27.236682523 +0000
@@ -96,7 +96,7 @@
     ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
        or OS=="netbsd"', {
       'target_defaults': {
-        'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
+        'cflags': [ '-fPIC', '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
                     '-Wnon-virtual-dtor', '-pthread', '-fno-rtti',
                     '-fno-exceptions', '-pedantic' ],
         'ldflags': [ '-pthread', ],
@@ -206,7 +206,7 @@
             '-fno-strict-aliasing',
           ],
           'WARNING_CFLAGS': [
-            '-Wall',
+            '-fPIC', '-Wall',
             '-Wendif-labels',
             '-W',
             '-Wno-unused-parameter',

then ran make arm.release hardfp=on library=shared -j4 and waited... when it finished I just did sudo cp out/arm.release/lib.target/libv8.so /usr/lib/libv8.so to have the lib available. I also did sudo cp include /usr/ so that the include files are available.

Checking which gems I have installed I get

odroid@odroid-server:~/v8$ gem query --local

*** LOCAL GEMS ***

bundler (1.5.3)
ref (1.0.5)

So, I executed sudo gem install libv8:3.16.14.3 -- --with-system-v8

And you can see that it's installed

odroid@odroid-server:~/v8/out/arm.release$ gem query --local

*** LOCAL GEMS ***

bundler (1.5.3)
libv8 (3.16.14.3)
ref (1.0.5)

But now, when I go to the /home/git/gitlab folder an run

sudo -u git -H bundle install --deployment --without development test postgres aws

Fails again... then, I read about bundle config, so I run

sudo -u git -H bundle config build.libv8 --with-system-v8
sudo -u git -H bundle install --deployment --without development test postgres aws

And voilá!

but... then this

odroid@odroid-server:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
ruby: symbol lookup error: /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/therubyracer-0.12.0/ext/v8/init.so: undefined symbol: _ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_

I tried copying everything from v8/out/arm.release/obj.target/tools/gyp to /usr/lib or even to /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/therubyracer-0.12.0/ext/v8/ without luck

Does anyone have any idea of how to make the v8 library available? I think that's the last bit of info I need to have it working.

Thanks!!!

g3rv4
  • 19,750
  • 4
  • 36
  • 58

3 Answers3

4

Yeap! That's a common issue with libv8. But there is an alternative to install nodejs and ommit the therubyracer gem from the Gemfile. Check this github issue and this post.

Steps:

  1. Stop gitlab service
  2. Edit Gemfile and remove the line gem "therubyracer".
  3. Move bundle config with: mv /home/git/gitlab/.bundle/config{,.orig}
  4. Move Gemfile.lock with: mv /home/git/gitlab/Gemfile.lock{,.orig}
  5. Run sudo -u git -H bundle install --path vendor/bundle to recreate the Gemfile.lock
  6. Install nodejs
  7. Restart gitlab service

Now, you have a new Gemfile.lock and all gems installed in vendor/bundle. If you want to save space, clean it up or sth, you can remove the vendor/bundle folder and run the known command for deployment:

sudo -u git -H bundle install --deployment --without development test postgres aws

This will pull only the relevant gems. Perhaps there is an easier way because now you have to have installed the devel packages for both mysql and postgres etc, but that's what came in mind right now.

Nodejs is a perfect replacement and should work without a problem. Since rails uses execjs, you can see in the Readme that node is supported as a javascript runtime.

kyrofa
  • 1,759
  • 1
  • 14
  • 19
axil
  • 797
  • 2
  • 7
  • 15
  • If I tweak the gemfile (and the lock) I get `You are trying to install in deployment mode after changing your Gemfile. Run bundle install elsewhere and add the updated Gemfile.lock to version control.` should I fork it and do the change on my repo? – g3rv4 Feb 10 '14 at 11:32
  • Remove `/home/git/gitlab/.bundle/config` and `Gemfile.lock` and run just `bundle install` so that the Gemfile.lock gets recreated. Then run the known bundle command with the deployment flag. I'll also edit my comment above to be more clear. – axil Feb 10 '14 at 14:52
  • I didn't really have luck... I have node.js running, deleted libv8 and therubyracer, generated the Gemfile.lock, added it to source control, ran bundle install and running the command to generate the tables ends with `rake aborted! cannot load such file -- rack/mount` – g3rv4 Feb 10 '14 at 14:59
  • I know it's against the SO policies... but after being stuck for 3 days, trying everything I could think about... that's exactly what I needed. Just installing node.js and changing the Gemfile.lock. THANKS!!!!!!!! – g3rv4 Feb 10 '14 at 16:00
  • Glad you worked it out :) I also tried it on Centos without a problem! Now you have to be careful during updates since you will have different Gemfile. You could create a different branch and run gitlab from there. Then on updates checkout to master/stable, merge it, checkout back to yours branch and do a rebase on master/stable. – axil Feb 10 '14 at 20:29
  • You da real MVP guy !! Will Gitlab work like a charm without 'therubyracer or it will cause some trouble? – F4T4liS Jul 04 '14 at 13:35
  • I edit my answer above to reflect your concerns :) Nodejs is a drop-in replacement of rubyracer, so fear nothing. – axil Jul 04 '14 at 13:54
  • You mention it briefly, but not really as an required dependency: I needed the libmysqlclient-dev debian package for the gems to install. – Chaos_99 Nov 02 '14 at 10:06
1

GitLab no longer has therubyracer as a dependency so changing Gemfile.lock is no longer necessary. You can just install nodejs and do the regular bundle install command.

Max
  • 86
  • 3
  • That is correct... this means that the question is no longer relevant. I'm leaving the other answer as accepted, as it does answer the question – g3rv4 Apr 17 '15 at 16:50
-2

Here are the options to create a GitLab installation: https://about.gitlab.com/installation/

Karen
  • 1
  • 1