From c0d118f41a3a66ab76a553f184efe431524b952d Mon Sep 17 00:00:00 2001 From: Jun Aruga 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. --- test/fiddle/helper.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb index ad43e3d678..57ded4951f 100644 --- a/test/fiddle/helper.rb +++ b/test/fiddle/helper.rb @@ -22,7 +22,16 @@ when /linux/ 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)) 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 v1.2.3