[前][次][番号順一覧][スレッド一覧]

ruby-changes:59078

From: Jun <ko1@a...>
Date: Thu, 5 Dec 2019 14:17:43 +0900 (JST)
Subject: [ruby-changes:59078] c0d118f41a (master): Fix "cannot find the function: strcpy()" error on arm32 on Travis CI. (#2686)

https://git.ruby-lang.org/ruby.git/commit/?id=c0d118f41a

From c0d118f41a3a66ab76a553f184efe431524b952d Mon Sep 17 00:00:00 2001
From: Jun Aruga <junaruga@u...>
Date: Thu, 5 Dec 2019 06:17:16 +0100
Subject: Fix "cannot find the function: strcpy()" error on arm32 on Travis CI.
 (#2686)

This issue happened when `libc.so` and `libm.so` path were not found
and `ldd ruby` command also failed to print the shared dependencies
in `test/fiddle/helper.rb`.

See https://travis-ci.org/ruby/ruby/jobs/611483288#L3018
/home/travis/build/ruby/ruby/build/.ext/common/fiddle/import.rb:299:in `import_function': cannot find the function: strcpy() (Fiddle::DLError)

* Set libc6:armhf as a installing dependency explicitly.
* Remove arm32 from allow_failures.

diff --git a/.travis.yml b/.travis.yml
index 3acb0d4..cd8e513 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -304,6 +304,7 @@ env: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L304
         tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install \
           ccache \
           crossbuild-essential-armhf \
+          libc6:armhf \
           libstdc++-5-dev:armhf \
           libffi-dev:armhf \
           libffi6:armhf \
@@ -432,7 +433,6 @@ matrix: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L433
     - <<: *CALL_THREADED_CODE
     - <<: *NO_THREADED_CODE
   allow_failures:
-    - name: arm32-linux
     - name: -fsanitize=address
     - name: -fsanitize=memory
     - name: -fsanitize=undefined
diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
index ad43e3d..57ded49 100644
--- a/test/fiddle/helper.rb
+++ b/test/fiddle/helper.rb
@@ -22,7 +22,16 @@ when /linux/ https://github.com/ruby/ruby/blob/trunk/test/fiddle/helper.rb#L22
   case RbConfig::SIZEOF['void*']
   when 4
     # 32-bit ruby
-    libdir = '/lib32' if File.directory? '/lib32'
+    case RUBY_PLATFORM
+    when /armv\w+-linux/
+      # In the ARM 32-bit libc package such as libc6:armhf libc6:armel,
+      # libc.so and libm.so are installed to /lib/arm-linux-gnu*.
+      # It's not installed to /lib32.
+      dirs = Dir.glob('/lib/arm-linux-gnu*')
+      libdir = dirs[0] if dirs && File.directory?(dirs[0])
+    else
+      libdir = '/lib32' if File.directory? '/lib32'
+    end
   when 8
     # 64-bit ruby
     libdir = '/lib64' if File.directory? '/lib64'
@@ -104,6 +113,9 @@ libm_so = nil if !libm_so || (libm_so[0] == ?/ && !File.file?(libm_so)) https://github.com/ruby/ruby/blob/trunk/test/fiddle/helper.rb#L113
 
 if !libc_so || !libm_so
   ruby = EnvUtil.rubybin
+  # When the ruby binary is 32-bit and the host is 64-bit,
+  # `ldd ruby` outputs "not a dynamic executable" message.
+  # libc_so and libm_so are not set.
   ldd = `ldd #{ruby}`
   #puts ldd
   libc_so = $& if !libc_so && %r{/\S*/libc\.so\S*} =~ ldd
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]