3

将 gitlab 安装到我的 odroid 中就好了......使用https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md中的步骤,直到这个命令

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

但这只是未能安装 therubyracer 0.12.0(实际上,失败的是编译 v8,因为它需要 -fPIC 标志)。这是错误消息

/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

所以...我通过克隆https://github.com/v8/v8并检查提交 7ce3fe106a37826dc23189a78dcb9000a1b3fa06在系统上安装了 v8 (b/c 这就是标签 v3.16.14.3 上 libv8 上使用的内容,这就是Gitlab 需要的那个)。

缺少的标志是-fPIC,所以在这样做之后make dependencies我做了这个改变(把它作为一个补丁来做这样更容易看到......我只是在使用-Wall时添加了-fPIC)

--- 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',

然后跑了make arm.release hardfp=on library=shared -j4,等待......当它完成时,我只是sudo cp out/arm.release/lib.target/libv8.so /usr/lib/libv8.so让 lib 可用。我也这样sudo cp include /usr/做了,以便包含文件可用。

检查我安装了哪些 gem

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

*** LOCAL GEMS ***

bundler (1.5.3)
ref (1.0.5)

所以,我执行了sudo gem install libv8:3.16.14.3 -- --with-system-v8

你可以看到它已安装

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)

但是现在,当我去 /home/git/gitlab 文件夹运行

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

再次失败......然后,我阅读了有关捆绑配置的信息,所以我运行

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

瞧!

但是……那么这个

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_

我尝试将所有内容从 v8/out/arm.release/obj.target/tools/gyp 复制到 /usr/lib 甚至复制到 /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/therubyracer-0.12 .0/ext/v8/ 没有运气

有谁知道如何使 v8 库可用?我认为这是我需要让它工作的最后一点信息。

谢谢!!!

4

3 回答 3

4

是的!这是 libv8 的一个常见问题。但是有一种替代方法可以安装 nodejs 并therubyracer从 Gemfile 中省略 gem。检查这个github 问题和这个帖子

脚步:

  1. 停止 gitlab 服务
  2. 编辑 Gemfile 并删除该行gem "therubyracer"
  3. 移动捆绑配置:mv /home/git/gitlab/.bundle/config{,.orig}
  4. 移动 Gemfile.lock :mv /home/git/gitlab/Gemfile.lock{,.orig}
  5. 运行sudo -u git -H bundle install --path vendor/bundle以重新创建 Gemfile.lock
  6. 安装nodejs
  7. 重启gitlab服务

现在,您有一个新的 Gemfile.lock 和安装在 vendor/bundle 中的所有gem。如果您想节省空间,清理它或某事,您可以删除 vendor/bundle 文件夹并运行已知命令进行部署:

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

这只会拉出相关的宝石。也许有一种更简单的方法,因为现在您必须为 mysql 和 postgres 等安装开发包,但这就是现在想到的。

Nodejs 是一个完美的替代品,应该可以毫无问题地工作。由于 rails 使用execjs,您可以在自述文件中看到节点被支持作为 javascript 运行时。

于 2014-02-10T10:56:16.043 回答
1

GitLab 不再将 ruby​​racer 作为依赖项,因此不再需要更改 Gemfile.lock。您可以只安装 nodejs 并执行常规的 bundle install 命令。

于 2015-04-17T08:27:54.917 回答
-2

以下是创建 GitLab 安装的选项:https ://about.gitlab.com/installation/

于 2015-04-18T05:11:02.253 回答