OWASP / railsgoat

A vulnerable version of Rails that follows the OWASP Top 10
railsgoat.cktricky.com
MIT License
858 stars 664 forks source link

M1 Mac fails to run "docker-compose build", error "Target architecture x64 is only supported" #428

Closed horvatic closed 1 year ago

horvatic commented 2 years ago

🐞 Problem When running docker-compose build I get the following error:

#12 126.1 Fetching libv8 3.16.14.19
#12 127.1 Installing libv8 3.16.14.19 with native extensions
#12 128.9 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
#12 128.9 
#12 128.9     current directory: /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8
#12 128.9 /usr/local/bin/ruby -I /usr/local/lib/ruby/2.6.0 -r
#12 128.9 ./siteconf20220315-8-6h5frr.rb extconf.rb
#12 128.9 creating Makefile
#12 128.9 Applying
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/patches/disable-building-tests.patch
#12 128.9 Applying
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/patches/disable-werror-on-osx.patch
#12 128.9 Applying
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/patches/disable-xcode-debugging.patch
#12 128.9 Applying
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/patches/do-not-imply-vfp3-and-armv7.patch
#12 128.9 Applying
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/patches/do-not-use-MAP_NORESERVE-on-freebsd.patch
#12 128.9 Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/do-not-use-vfp2.patch
#12 128.9 Applying /usr/local/bundle/gems/libv8-3.16.14.19/patches/fPIC-for-static.patch
#12 128.9 Compiling v8 for x64
#12 128.9 Using python 2.7.16
#12 128.9 Using compiler: c++ (GCC version 8.3.0)
#12 128.9 Beginning compilation. This will take some time.
#12 128.9 Building v8 with env CXX=c++ LINK=c++  /usr/bin/make x64.release
#12 128.9 ARFLAGS.target=crs werror=no
#12 128.9 GYP_GENERATORS=make \
#12 128.9 build/gyp/gyp --generator-output="out" build/all.gyp \
#12 128.9               -Ibuild/standalone.gypi --depth=. \
#12 128.9               -Dv8_target_arch=x64 \
#12 128.9 -S.x64  -Dv8_enable_backtrace=1
#12 128.9 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2
#12 128.9 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
#12 128.9 make[1]: Entering directory
#12 128.9 '/usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out'
#12 128.9 CXX(target)
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
#12 128.9 In file included from ../src/allocation.h:31,
#12 128.9                  from ../src/allocation.cc:28:
#12 128.9 ../src/globals.h:90:2: error: #error Host architecture was not detected as
#12 128.9 supported by v8
#12 128.9  #error Host architecture was not detected as supported by v8
#12 128.9   ^~~~~
#12 128.9 ../src/globals.h:116:2: error: #error Target architecture x64 is only supported
#12 128.9 on x64 host
#12 128.9  #error Target architecture x64 is only supported on x64 host
#12 128.9   ^~~~~
#12 128.9 make[1]: *** [tools/gyp/preparser_lib.target.x64.mk:108:
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o]
#12 128.9 Error 1
#12 128.9 make[1]: Leaving directory
#12 128.9 '/usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out'
#12 128.9 make: *** [Makefile:195: x64.release] Error 2
#12 128.9 /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:36:in `block in
#12 128.9 verify_installation!': libv8 did not install properly, expected binary v8
#12 128.9 archive
#12 128.9 '/usr/local/bundle/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to
#12 128.9 exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
#12 128.9   from /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `each'
#12 128.9 from /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in
#12 128.9 `verify_installation!'
#12 128.9 from /usr/local/bundle/gems/libv8-3.16.14.19/ext/libv8/location.rb:26:in
#12 128.9 `install!'
#12 128.9   from extconf.rb:7:in `<main>'
#12 128.9 
#12 128.9 extconf failed, exit code 1
#12 128.9 
#12 128.9 Gem files will remain installed in /usr/local/bundle/gems/libv8-3.16.14.19 for
#12 128.9 inspection.
#12 128.9 Results logged to
#12 128.9 /usr/local/bundle/extensions/aarch64-linux/2.6.0/libv8-3.16.14.19/gem_make.out
#12 128.9 
#12 128.9 An error occurred while installing libv8 (3.16.14.19), and Bundler cannot
#12 128.9 continue.
#12 128.9 Make sure that `gem install libv8 -v '3.16.14.19' --source
#12 128.9 'https://rubygems.org/'` succeeds before bundling.
#12 128.9 
#12 128.9 In Gemfile:
#12 128.9   therubyracer was resolved to 0.12.3, which depends on
#12 128.9     libv8
------

Calling out this part of the error message: Target architecture x64 is only supported

Mac M1 is a ARM64 system

🎯 Goal Be able to run on an M1 Mac

💡 Possible solutions Update the docs on how to run with an M1 Mac, or update the docker image to work with ARM64

horvatic commented 2 years ago

PR to fix issue: https://github.com/OWASP/railsgoat/pull/429

horvatic commented 1 year ago

PR merged