diff options
author | Jun Aruga <junaruga@users.noreply.github.com> | 2019-12-05 06:17:16 +0100 |
---|---|---|
committer | NARUSE, Yui <nurse@users.noreply.github.com> | 2019-12-05 14:17:16 +0900 |
commit | c0d118f41a3a66ab76a553f184efe431524b952d (patch) | |
tree | b7b06923dacef76c01169d2b9d2cc103675255bd /test/fiddle | |
parent | ed5d032ea33a465fd7152a236a4aca0ff5653bf3 (diff) | |
download | ruby-c0d118f41a3a66ab76a553f184efe431524b952d.tar.gz |
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.
Diffstat (limited to 'test/fiddle')
-rw-r--r-- | test/fiddle/helper.rb | 14 |
1 files changed, 13 insertions, 1 deletions
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 |