gauntlt / gauntlt-docker

the docker for gauntlt
86 stars 68 forks source link

Docker build error while installing ffi version 1.9.18 - script failed to recognize operating system you are using. #24

Open mfathy1 opened 1 year ago

mfathy1 commented 1 year ago

I am getting the following error when I clone the repository and run "make build".

I am not sure if it is related but I am using MacOS venture 13.2.1 (22D68) with iTerm2 Build 3.4.19

I searched the web for someone having a similar issue, but looks like I am the first lucky one to get it :)

% git clone https://github.com/gauntlt/gauntlt-docker.git
Cloning into 'gauntlt-docker'...
remote: Enumerating objects: 90, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 90 (delta 1), reused 4 (delta 1), pack-reused 84
Receiving objects: 100% (90/90), 1.79 MiB | 6.31 MiB/s, done.
Resolving deltas: 100% (38/38), done.

% cd gauntlt-docker

% make build
Building docker container...
[+] Building 3.5s (8/19)
 => [internal] load build definition from Dockerfile                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 2.08kB                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                                        1.6s
 => [ 1/15] FROM docker.io/library/ubuntu:20.04@sha256:4a45212e9518f35983a976eead0de5eecc555a2f047134e9dd2cfc589076a00d                                                                                                                0.0s
 => [internal] load build context                                                                                                                                                                                                      0.1s
 => => transferring context: 2.05MB                                                                                                                                                                                                    0.1s
 => CACHED [ 2/15] RUN apt-get update &&     apt-get install -y build-essential       bzip2       ca-certificates       curl       gcc       git       libcurl4       libcurl4-openssl-dev       wget       zlib1g-dev       libfontc  0.0s
 => CACHED [ 3/15] RUN gem install rake                                                                                                                                                                                                0.0s
 => ERROR [ 4/15] RUN gem install ffi -v 1.9.18                                                                                                                                                                                        1.9s
------
 > [ 4/15] RUN gem install ffi -v 1.9.18:
#7 1.020 Building native extensions. This could take a while...
#7 1.836 ERROR:  Error installing ffi:
#7 1.836    ERROR: Failed to build gem native extension.
#7 1.836
#7 1.836     current directory: /var/lib/gems/2.7.0/gems/ffi-1.9.18/ext/ffi_c
#7 1.836 /usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20230220-7-1ywi83s.rb extconf.rb
#7 1.836 checking for ffi.h... no
#7 1.836 checking for ffi.h in /usr/local/include,/usr/include/ffi... no
#7 1.836 checking for shlwapi.h... no
#7 1.836 checking for rb_thread_blocking_region()... no
#7 1.836 checking for rb_thread_call_with_gvl()... yes
#7 1.836 checking for rb_thread_call_without_gvl()... yes
#7 1.836 checking for ffi_prep_cif_var()... no
#7 1.836 creating extconf.h
#7 1.836 creating Makefile
#7 1.836
#7 1.836 current directory: /var/lib/gems/2.7.0/gems/ffi-1.9.18/ext/ffi_c
#7 1.836 make "DESTDIR=" clean
#7 1.836
#7 1.836 current directory: /var/lib/gems/2.7.0/gems/ffi-1.9.18/ext/ffi_c
#7 1.836 make "DESTDIR="
#7 1.836 Configuring libffi
#7 1.836 /var/lib/gems/2.7.0/gems/ffi-1.9.18/ext/ffi_c/libffi/config.guess: unable to guess system type
#7 1.836
#7 1.836 This script, last modified 2009-11-20, has failed to recognize
#7 1.836 the operating system you are using. It is advised that you
#7 1.836 download the most up to date version of the config scripts from
#7 1.836
#7 1.836   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#7 1.836 and
#7 1.836   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
#7 1.836
#7 1.836 If the version you run (/var/lib/gems/2.7.0/gems/ffi-1.9.18/ext/ffi_c/libffi/config.guess) is already up to date, please
#7 1.836 send the following data and any information you think might be
#7 1.836 pertinent to <config-patches@gnu.org> in order to provide the needed
#7 1.836 information to handle your system.
#7 1.836
#7 1.836 config.guess timestamp = 2009-11-20
#7 1.836
#7 1.836 uname -m = aarch64
#7 1.836 uname -r = 5.10.124-linuxkit
#7 1.836 uname -s = Linux
#7 1.836 uname -v = #1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022
#7 1.836
#7 1.836 /usr/bin/uname -p = aarch64
#7 1.836 /bin/uname -X     =
#7 1.836
#7 1.836 hostinfo               =
#7 1.836 /bin/universe          =
#7 1.836 /usr/bin/arch -k       =
#7 1.836 /bin/arch              = aarch64
#7 1.836 /usr/bin/oslevel       =
#7 1.836 /usr/convex/getsysinfo =
#7 1.836
#7 1.836 UNAME_MACHINE = aarch64
#7 1.836 UNAME_RELEASE = 5.10.124-linuxkit
#7 1.836 UNAME_SYSTEM  = Linux
#7 1.836 UNAME_VERSION = #1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022
#7 1.836 configure: error: cannot guess build type; you must specify one
#7 1.836 make: *** [libffi.mk:7: "/var/lib/gems/2.7.0/gems/ffi-1.9.18/ext/ffi_c/libffi-aarch64-linux-gnu"/.libs/libffi_convenience.a] Error 1
#7 1.836
#7 1.836 make failed, exit code 2
#7 1.836
#7 1.836 Gem files will remain installed in /var/lib/gems/2.7.0/gems/ffi-1.9.18 for inspection.
#7 1.836 Results logged to /var/lib/gems/2.7.0/extensions/aarch64-linux/2.7.0/ffi-1.9.18/gem_make.out
------
executor failed running [/bin/sh -c gem install ffi -v 1.9.18]: exit code: 1
make: *** [build] Error 1
adaugherity commented 1 year ago

I also ran into this issue -- it has to deal with arm64 (aka aarch64). (The Dockerfile just specifies Ubuntu 20.04, which will match the host architecture.). As seen in your build log, it fails to build a native ruby extension for ffi, because of the missing system package (libffi-dev). The fallback uses a bundled libffi which is quite ancient and doesn't support arm64:

#7 1.836 /var/lib/gems/2.7.0/gems/ffi-1.9.18/ext/ffi_c/libffi/config.guess: unable to guess system type
#7 1.836 UNAME_MACHINE = aarch64
#7 1.836 UNAME_RELEASE = 5.10.124-linuxkit
#7 1.836 UNAME_SYSTEM  = Linux
#7 1.836 UNAME_VERSION = #1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022
#7 1.836 configure: error: cannot guess build type; you must specify one

I submitted PR #26 to apt-get install libffi-dev, which solves this immediate issue. (Perhaps this should also use a newer ffi gem as 1.9.18 is quite old, but it at least builds fine when the system libffi is present.)

There are still two remaining issues for arm64 support:

An alternative would be to force using the x86_64 version of Ubuntu, but that would be slower.