2017-07-20 75 views
5

我们在Ubuntu 14.04上运行,使用Gitlab 9.3.7,它工作正常。我们正在努力更新到Gitlab v9.3.8的最新安全补丁,但它给我们这个错误:将Gitlab从9.3.7更新到9.3.8获得错误安装re2

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/re2-1.0.0/ext/re2 
/usr/local/bin/ruby -r ./siteconf20170720-19622-15i0edf.rb extconf.rb 
checking for main() in -lstdc++... yes 
checking for stdint.h... yes 
checking for rb_str_sublen()... yes 
checking for main() in -lre2... no 
You must have re2 installed and specified with --with-re2-dir, please see https://github.com/google/re2/wiki/Install 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary 
libraries and/or headers. Check the mkmf.log file for more details. You may 
need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/local/bin/$(RUBY_BASE_NAME) 
    --with-re2-dir 
    --without-re2-dir 
    --with-re2-include 
    --without-re2-include=${re2-dir}/include 
    --with-re2-lib 
    --without-re2-lib=${re2-dir}/lib 
    --with-stdc++lib 
    --without-stdc++lib 
    --with-re2lib 
    --without-re2lib 

To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /home/git/gitlab/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/re2-1.0.0/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/re2-1.0.0 for inspection. 
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/re2-1.0.0/gem_make.out 

An error occurred while installing re2 (1.0.0), and Bundler cannot continue. 
Make sure that `gem install re2 -v '1.0.0'` succeeds before bundling. 

In Gemfile: 
    re2 

的mkmf.log文件包含:

have_library: checking for main() in -lstdc++... -------------------- yes 

"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic  -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lpthread -ldl -lcrypt -lm -lc" 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: int main(int argc, char **argv) 
4: { 
5: return 0; 
6: } 
/* end */ 

"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic  -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lstdc++ -lpthread -ldl -lcrypt -lm -lc" 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: /*top*/ 
4: extern int t(void); 
5: int main(int argc, char **argv) 
6: { 
7: if (argc > 1000000) { 
8:  printf("%p", &t); 
9: } 
10: 
11: return 0; 
12: } 
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return !p; } 
/* end */ 

-------------------- 

have_header: checking for stdint.h... -------------------- yes 

"gcc -E -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wall -Wextra -funroll-loops conftest.c -o conftest.i" 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: #include <stdint.h> 
/* end */ 

-------------------- 

have_func: checking for rb_str_sublen()... -------------------- yes 

"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -lstdc++ -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lstdc++ -lpthread -ldl -lcrypt -lm -lc" 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: /*top*/ 
4: extern int t(void); 
5: int main(int argc, char **argv) 
6: { 
7: if (argc > 1000000) { 
8:  printf("%p", &t); 
9: } 
10: 
11: return 0; 
12: } 
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_str_sublen; return !p; } 
/* end */ 

-------------------- 

have_library: checking for main() in -lre2... -------------------- no 

"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -lstdc++ -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lre2 -lstdc++ -lpthread -ldl -lcrypt -lm -lc" 
/usr/bin/ld: cannot find -lre2 
collect2: error: ld returned 1 exit status 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: /*top*/ 
4: extern int t(void); 
5: int main(int argc, char **argv) 
6: { 
7: if (argc > 1000000) { 
8:  printf("%p", &t); 
9: } 
10: 
11: return 0; 
12: } 
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return !p; } 
/* end */ 

"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -lstdc++ -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lre2 -lstdc++ -lpthread -ldl -lcrypt -lm -lc" 
conftest.c:13:13: error: conflicting types for ‘main’ 
extern void main(); 
      ^
conftest.c:5:5: note: previous definition of ‘main’ was here 
int main(int argc, char **argv) 
    ^
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: /*top*/ 
4: extern int t(void); 
5: int main(int argc, char **argv) 
6: { 
7: if (argc > 1000000) { 
8:  printf("%p", &t); 
9: } 
10: 
11: return 0; 
12: } 
13: extern void main(); 
14: int t(void) { main(); return 0; } 
/* end */ 

-------------------- 

我试着加入红宝石因为我们使用的是Ruby 2.3,所以-dev和ruby2.3-dev。更新中没有更改。由于这是一个相当新的补丁,Gitlab在他们的网站上没有进一步的信息,并且re2的安装说明没有帮助。

回答

5

我有同样的问题
这对我的作品,尝试在你自己的风险

的Ubuntu 14.04没有libre2-dev
https://launchpad.net/ubuntu/+source/re2

我安装了它从源
https://github.com/google/re2/wiki/Install

cd /tmp git clone https://github.com/google/re2.git cd re2/ make make test sudo checkinstall -D --install=no sudo dpkg -i re2_20170720-1_amd64.deb

然后运行
ldconfig

+0

在我们的Ubuntu 14.04上安装libre2-dev时没有问题等待一个安静的时刻来测试Gitlab v9.3.8 with re2喜欢这个在我们的虚拟机上假设checkinstall的默认值是否可以安全地安装? –

+0

以上述方式安装的软件包可以正常工作 –

+0

请在错误发生时在答案中关注wiki页面。答案真的有用。 –

0

嗨,我刚刚遇到同样的错误。至少我们不是唯一的一个。

我做的GitLab一个问题:https://gitlab.com/gitlab-org/gitlab-ce/issues/35342

+0

相同的修订是在Gitlab问题跟踪提到@ SERG-B建议如下。感谢您发布错误!我也开始创建一个错误,并在我的睡眠剥夺了头脑,从未击中提交:( –

4

我能够安装的lib之后安装RE2-宝石:

apt-get install libre2-dev 
+0

我们已经尝试了此修复程序,但14.04似乎没有libre2-dev。我没有进一步检查,如果它是可用的 –

+0

我在Ubuntu 16.04上遇到同样的错误 按照这个答案安装库解决了我的问题 – Tarator