# HG changeset patch # User Balasankar 'Balu' C <balasankar@gitlab.com> # Date 1649800930 0 # Tue Apr 12 22:02:10 2022 +0000 # Node ID 14266f937d96ba93b81767fa3a117ff439af9fe4 # Parent 133c42bcc39b4ea6b037b7bf073add8c5567320c Recompile nokogiri from source in specific arm platforms On arm-based platforms where glibc version is less than what is required for nokogiri, delete the native extension and recompile it from source. Closes https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/6773 Changelog: fixed Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com> diff --git a/config/software/gitlab-rails.rb b/config/software/gitlab-rails.rb --- a/config/software/gitlab-rails.rb +++ b/config/software/gitlab-rails.rb @@ -87,6 +87,18 @@ env['PKG_CONFIG_PATH'] = OpenSSLHelper.pkg_config_dirs end + gem_source_compile_os = %w[ + el-8-aarch64 + amazon-2-aarch64 + debian-buster-aarch64 + raspbian-buster-aarch64 + ] + + # Currently rake-compiler-dock uses a Ubuntu 20.04 image to create the + # native gem for the aarch64-linux platform. As a result, anything + # using a glibc older than v2.29 will not work. We need to compile + # gems for these platforms. + bundle 'config force_ruby_platform true', env: env if gem_source_compile_os.include?(OhaiHelper.platform_dir) bundle 'config build.gpgme --use-system-libraries', env: env bundle "config build.nokogiri --use-system-libraries --with-xml2-include=#{install_dir}/embedded/include/libxml2 --with-xslt-include=#{install_dir}/embedded/include/libxslt", env: env bundle 'config build.grpc --with-ldflags="-latomic"', env: env if OhaiHelper.os_platform == 'raspbian' @@ -107,10 +119,12 @@ block 'reinstall google-protobuf gem' do require 'fileutils' - current_gem = shellout!("#{embedded_bin('bundle')} show | grep google-protobuf", env: env).stdout - protobuf_version = current_gem[/google-protobuf \((.*)\)/, 1] - shellout!("#{embedded_bin('gem')} uninstall --force google-protobuf", env: env) - shellout!("#{embedded_bin('gem')} install google-protobuf --version #{protobuf_version} --platform=ruby", env: env) + unless gem_source_compile_os.include?(OhaiHelper.platform_dir) + current_gem = shellout!("#{embedded_bin('bundle')} show | grep google-protobuf", env: env).stdout + protobuf_version = current_gem[/google-protobuf \((.*)\)/, 1] + shellout!("#{embedded_bin('gem')} uninstall --force google-protobuf", env: env) + shellout!("#{embedded_bin('gem')} install google-protobuf --version #{protobuf_version} --platform=ruby", env: env) + end # Delete unused shared objects included in grpc gem grpc_path = shellout!("#{embedded_bin('bundle')} show grpc", env: env).stdout.strip