سؤال

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!!!

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top