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.
This commit is contained in:
Jun Aruga 2019-12-05 06:17:16 +01:00 коммит произвёл NARUSE, Yui
Родитель ed5d032ea3
Коммит c0d118f41a
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -304,6 +304,7 @@ env:
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:
- <<: *CALL_THREADED_CODE
- <<: *NO_THREADED_CODE
allow_failures:
- name: arm32-linux
- name: -fsanitize=address
- name: -fsanitize=memory
- name: -fsanitize=undefined

Просмотреть файл

@ -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