Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Unable to install libv8 within docker running on Apple M1 #315

Closed
@hegwin

Description

@hegwin

Hi Team, I'm trying to install libv8 in a docker container running in my MacBook Pro with M1 chip.

I got following logs after executing gem install libv8 -v 3.16.14.19

Building native extensions. This could take a while...
ERROR:  Error installing libv8:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.7.0 -r ./siteconf20210516-15782-1swpaoz.rb extconf.rb
creating Makefile
Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/disable-building-tests.patch
Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/disable-werror-on-osx.patch
Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/disable-xcode-debugging.patch
Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/do-not-imply-vfp3-and-armv7.patch
Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/do-not-use-MAP_NORESERVE-on-freebsd.patch
Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/do-not-use-vfp2.patch
Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/fPIC-for-static.patch
Compiling v8 for x64
Using python 2.7.16
Using compiler: c++ (GCC version 8.3.0)
Beginning compilation. This will take some time.
Building v8 with env CXX=c++ LINK=c++  /usr/bin/make x64.release ARFLAGS.target=crs werror=no
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
              -Ibuild/standalone.gypi --depth=. \
              -Dv8_target_arch=x64 \
              -S.x64  -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
make[1]: Entering directory '/usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out'
  CXX(target) /usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
In file included from ../src/allocation.h:31,
                 from ../src/allocation.cc:28:
../src/globals.h:90:2: error: #error Host architecture was not detected as supported by v8
 #error Host architecture was not detected as supported by v8
  ^~~~~
../src/globals.h:116:2: error: #error Target architecture x64 is only supported on x64 host
 #error Target architecture x64 is only supported on x64 host
  ^~~~~
make[1]: *** [tools/gyp/preparser_lib.target.x64.mk:108: /usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o] Error 1
make[1]: Leaving directory '/usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out'
make: *** [Makefile:195: x64.release] Error 2
/usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
	from /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `each'
	from /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `verify_installation!'
	from /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:26:in `install!'
	from extconf.rb:7:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/libv8-3.16.14.19 for inspection.
Results logged to /usr/local/bundle/extensions/aarch64-linux/2.7.0/libv8-3.16.14.19/gem_make.out

My docker info:

Client:
 Cloud integration: 1.0.14
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.16.3
 Git commit:        370c289
 Built:             Fri Apr  9 22:46:57 2021
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:44:13 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

The image I'm using is ruby:2.7.2.

And in my container:

$ ruby -e 'puts Gem::Platform.local'
aarch64-linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions