gpt4 book ai didi

ruby - 在 odroid 上安装 Gitlab 时出现问题(v8 库不可用?)

转载 作者:数据小太阳 更新时间:2023-10-29 08:00:03 26 4
gpt4 key购买 nike

将 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,因为它需要 -fPIcflags)。这是错误信息

/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

所以...我通过克隆在系统上安装了 v8 https://github.com/v8/v8并检查提交 7ce3fe106a37826dc23189a78dcb9000a1b3fa06(b/c 这就是 libv8 在标签 v3.16.14.3 上使用的内容,也是 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

再次失败...然后,我阅读了有关 bundle config 的信息,所以我运行

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 库可用吗?我认为这是让它正常工作所需的最后一点信息。

谢谢!!!

最佳答案

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

步骤:

  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服务

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

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

这将只提取相关的 gem。也许有更简单的方法,因为现在您必须为 mysql 和 postgres 等安装开发包,但这就是现在想到的。

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

关于ruby - 在 odroid 上安装 Gitlab 时出现问题(v8 库不可用?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21666379/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com