代码之家  ›  专栏  ›  技术社区  ›  Out of Control

将Gitlab从9.3.7更新到9.3.8安装re2时出错

  •  6
  • Out of Control  · 技术社区  · 7 年前

    我们运行的是Ubuntu 14.04和Gitlab 9.3.7,运行良好。我们正在尝试更新到Gitlab v9.3.8的最新安全补丁,但它给我们带来了以下错误:

    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。日志文件包含:

    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时,我尝试添加ruby dev和ruby2.3-dev。更新中没有任何更改。由于这是一个相当新的补丁,Gitlab在其站点上没有进一步的信息,re2的安装说明也没有帮助。

    4 回复  |  直到 7 年前
        1
  •  6
  •   ur5    7 年前

    在安装lib之后,我能够安装re2 gem:

    apt-get install libre2-dev
    
        2
  •  5
  •   Serg B    7 年前


    这对我有用,你自己试试看

    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

        3
  •  1
  •   IvanHuang    3 年前

    我在macOS Big Sur上也有同样的错误。下面安装解决问题

    brew install re2
    
        4
  •  0
  •   maikel    7 年前

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

    https://gitlab.com/gitlab-org/gitlab-ce/issues/35342