Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountered errors when Docker build #21

Closed
Stamp9 opened this issue Jul 25, 2023 · 7 comments
Closed

Encountered errors when Docker build #21

Stamp9 opened this issue Jul 25, 2023 · 7 comments

Comments

@Stamp9
Copy link

Stamp9 commented Jul 25, 2023

Hi,

Hey, I am trying to install ILF from a local clone by following the instructions in the README file, but encountered some errors.
I am using a Macbook with Apple M1 Pro chip, the operating system is macOS Monterey 12.4.
Any suggestion is appreciated, thanks in advance!

(base) ➜  ilf git:(master) docker build -t ilf .
[+] Building 60.0s (38/44)                                                      
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 2.19kB                                     0.0s
 => [internal] load .dockerignore                                          0.0s
...

 => ERROR [33/40] RUN pip3 install -r requirements.txt --no-cache-dir     11.7s
...
#0 5.200 Collecting persistent (from -r requirements.txt (line 7))
#0 5.422   Downloading https://files.pythonhosted.org/packages/ea/22/7fd2e6926f86d080c2dca58b93de3701e56914021e2c6ea8bac151657bde/persistent-4.9.3.tar.gz (134kB)
#0 11.50     Complete output from command python setup.py egg_info:
#0 11.50     c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#0 11.50      #include <ffi.h>
#0 11.50               ^~~~~~~
#0 11.50     compilation terminated.
...

The info on some dependencies that may related can be seen below:

(base) ➜  ilf git:(master) pip3 install cffi
Requirement already satisfied: cffi in /Users/rr/anaconda3/lib/python3.10/site-packages (1.15.1)
Requirement already satisfied: pycparser in /Users/rr/anaconda3/lib/python3.10/site-packages (from cffi) (2.21)
(base) ➜  ilf git:(master) xcode-select --version
xcode-select version 2395.
(base) ➜  ilf git:(master) brew info libffi
==> libffi: stable 3.4.4 (bottled), HEAD [keg-only]
Portable Foreign Function Interface library
https://sourceware.org/libffi/
/opt/homebrew/Cellar/libffi/3.4.4 (17 files, 724.8KB)
  Poured from bottle using the formulae.brew.sh API on 2023-07-20 at 15:02:19
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libffi.rb
License: MIT

I will paste the whole output in the comment. Thanks!

@Stamp9
Copy link
Author

Stamp9 commented Jul 25, 2023

(base) ➜  ilf git:(master) docker build -t ilf .
[+] Building 60.0s (38/44)                                                      
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 2.19kB                                     0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/ubuntu:18.04            1.4s
 => [auth] library/ubuntu:pull token for registry-1.docker.io              0.0s
 => [ 1/40] FROM docker.io/library/ubuntu:18.04@sha256:152dc042452c496007  0.0s
 => [internal] load build context                                          0.6s
 => => transferring context: 13.81MB                                       0.6s
 => CACHED [ 2/40] RUN apt-get -y update                                   0.0s
 => CACHED [ 3/40] RUN apt-get -y install     wget     python3     python  0.0s
 => CACHED [ 4/40] RUN curl -sL https://deb.nodesource.com/setup_12.x | b  0.0s
 => CACHED [ 5/40] RUN apt-get -y install nodejs                           0.0s
 => CACHED [ 6/40] RUN npm -g config set user root                         0.0s
 => CACHED [ 7/40] RUN npm install -g truffle web3 ganache-cli             0.0s
 => CACHED [ 8/40] RUN wget https://github.com/ethereum/solidity/releases  0.0s
 => CACHED [ 9/40] RUN mv solc-static-linux /usr/bin/solc                  0.0s
 => CACHED [10/40] RUN chmod +x /usr/bin/solc                              0.0s
 => CACHED [11/40] RUN wget https://dl.google.com/go/go1.10.4.linux-amd64  0.0s
 => CACHED [12/40] RUN tar -xvf go1.10.4.linux-amd64.tar.gz                0.0s
 => CACHED [13/40] RUN mv go /usr/lib/go-1.10                              0.0s
 => CACHED [14/40] RUN mkdir /go                                           0.0s
 => CACHED [15/40] RUN git clone https://github.com/Z3Prover/z3.git        0.0s
 => CACHED [16/40] WORKDIR /z3                                             0.0s
 => CACHED [17/40] RUN git checkout z3-4.8.6                               0.0s
 => CACHED [18/40] RUN python3 scripts/mk_make.py --python                 0.0s
 => CACHED [19/40] WORKDIR /z3/build                                       0.0s
 => CACHED [20/40] RUN make -j7                                            0.0s
 => CACHED [21/40] RUN make install                                        0.0s
 => [22/40] ADD ./ /go/src/ilf/                                            0.2s
 => [23/40] RUN mkdir -p /go/src/github.com/ethereum/                      0.3s
 => [24/40] WORKDIR /go/src/github.com/ethereum/                           0.0s
 => [25/40] RUN git clone https://github.com/ethereum/go-ethereum.git     20.1s
 => [26/40] WORKDIR /go/src/github.com/ethereum/go-ethereum                0.0s
 => [27/40] RUN git checkout 86be91b3e2dff5df28ee53c59df1ecfe9f97e007      1.1s
 => [28/40] RUN git apply /go/src/ilf/script/patch.geth                    0.2s
 => [29/40] WORKDIR /go/src/ilf                                            0.0s
 => [30/40] RUN apt-get -y install autoconf libjpeg-dev zlib1g-dev         2.6s
 => [31/40] RUN pip3 install cython --no-cache-dir                         1.9s
 => [32/40] RUN pip3 install cytoolz --no-cache-dir                       19.7s
 => ERROR [33/40] RUN pip3 install -r requirements.txt --no-cache-dir     11.7s
------
 > [33/40] RUN pip3 install -r requirements.txt --no-cache-dir:
#0 1.065 Collecting pycryptodome>=3.4.7 (from -r requirements.txt (line 1))
#0 1.320   Downloading https://files.pythonhosted.org/packages/b9/05/0e7547c445bbbc96c538d870e6c5c5a69a9fa5df0a9df3e27cb126527196/pycryptodome-3.18.0.tar.gz (4.6MB)
#0 2.343 Collecting pysha3>=1.0.1 (from -r requirements.txt (line 2))
#0 2.410   Downloading https://files.pythonhosted.org/packages/73/bf/978d424ac6c9076d73b8fdc8ab8ad46f98af0c34669d736b1d83c758afee/pysha3-1.0.2.tar.gz (829kB)
#0 2.655 Collecting graphviz (from -r requirements.txt (line 3))
#0 2.719   Downloading https://files.pythonhosted.org/packages/9d/fb/886e8ec7862989afc0c35d15813b6c665fe134cc6027cdde2fa300abe9a2/graphviz-0.19.1-py3-none-any.whl (46kB)
#0 2.741 Collecting numpy (from -r requirements.txt (line 4))
#0 3.058   Downloading https://files.pythonhosted.org/packages/51/60/3f0fe5b7675a461d96b9d6729beecd3532565743278a9c3fe6dd09697fa7/numpy-1.19.5.zip (7.3MB)
#0 3.963 Collecting tqdm (from -r requirements.txt (line 5))
#0 4.054   Downloading https://files.pythonhosted.org/packages/47/bb/849011636c4da2e44f1253cd927cfb20ada4374d8b3a4e425416e84900cc/tqdm-4.64.1-py2.py3-none-any.whl (78kB)
#0 4.079 Collecting scikit-learn==0.22.1 (from -r requirements.txt (line 6))
#0 4.220   Downloading https://files.pythonhosted.org/packages/18/28/5a48b00599b476875415b97bdfdb3849bafb31183c1d785501dbc8a77aa2/scikit-learn-0.22.1.tar.gz (6.9MB)
#0 5.200 Collecting persistent (from -r requirements.txt (line 7))
#0 5.422   Downloading https://files.pythonhosted.org/packages/ea/22/7fd2e6926f86d080c2dca58b93de3701e56914021e2c6ea8bac151657bde/persistent-4.9.3.tar.gz (134kB)
#0 11.50     Complete output from command python setup.py egg_info:
#0 11.50     c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#0 11.50      #include <ffi.h>
#0 11.50               ^~~~~~~
#0 11.50     compilation terminated.
#0 11.50     Traceback (most recent call last):
#0 11.50       File "/usr/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
#0 11.50         extra_postargs)
#0 11.50       File "/usr/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
#0 11.50         spawn(cmd, dry_run=self.dry_run)
#0 11.50       File "/usr/lib/python3.6/distutils/spawn.py", line 36, in spawn
#0 11.50         _spawn_posix(cmd, search_path, dry_run=dry_run)
#0 11.50       File "/usr/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
#0 11.50         % (cmd, exit_status))
#0 11.50     distutils.errors.DistutilsExecError: command 'aarch64-linux-gnu-gcc' failed with exit status 1
#0 11.50     
#0 11.50     During handling of the above exception, another exception occurred:
#0 11.50     
#0 11.50     Traceback (most recent call last):
#0 11.50       File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
#0 11.50         dist.run_commands()
#0 11.50       File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
#0 11.50         self.run_command(cmd)
#0 11.50       File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
#0 11.50         cmd_obj.run()
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 172, in run
#0 11.50         cmd = self.call_command('install_lib', warn_dir=0)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 158, in call_command
#0 11.50         self.run_command(cmdname)
#0 11.50       File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
#0 11.50         self.distribution.run_command(command)
#0 11.50       File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
#0 11.50         cmd_obj.run()
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 24, in run
#0 11.50         self.build()
#0 11.50       File "/usr/lib/python3.6/distutils/command/install_lib.py", line 109, in build
#0 11.50         self.run_command('build_ext')
#0 11.50       File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
#0 11.50         self.distribution.run_command(command)
#0 11.50       File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
#0 11.50         cmd_obj.run()
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 78, in run
#0 11.50         _build_ext.run(self)
#0 11.50       File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
#0 11.50         self.build_extensions()
#0 11.50       File "/usr/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
#0 11.50         self._build_extensions_serial()
#0 11.50       File "/usr/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
#0 11.50         self.build_extension(ext)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 199, in build_extension
#0 11.50         _build_ext.build_extension(self, ext)
#0 11.50       File "/usr/local/lib/python3.6/dist-packages/Cython/Distutils/build_ext.py", line 127, in build_extension
#0 11.50         super(build_ext, self).build_extension(ext)
#0 11.50       File "/usr/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
#0 11.50         depends=ext.depends)
#0 11.50       File "/usr/lib/python3.6/distutils/ccompiler.py", line 574, in compile
#0 11.50         self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
#0 11.50       File "/usr/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
#0 11.50         raise CompileError(msg)
#0 11.50     distutils.errors.CompileError: command 'aarch64-linux-gnu-gcc' failed with exit status 1
#0 11.50     
#0 11.50     During handling of the above exception, another exception occurred:
#0 11.50     
#0 11.50     Traceback (most recent call last):
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
#0 11.50         yield saved
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
#0 11.50         yield
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
#0 11.50         _execfile(setup_script, ns)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
#0 11.50         exec(code, globals, locals)
#0 11.50       File "/tmp/easy_install-3jonaexa/cffi-1.15.1/setup.py", line 242, in <module>
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
#0 11.50         return distutils.core.setup(**attrs)
#0 11.50       File "/usr/lib/python3.6/distutils/core.py", line 163, in setup
#0 11.50         raise SystemExit("error: " + str(msg))
#0 11.50     SystemExit: error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
#0 11.50     
#0 11.50     During handling of the above exception, another exception occurred:
#0 11.50     
#0 11.50     Traceback (most recent call last):
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1163, in run_setup
#0 11.50         run_setup(setup_script, args)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
#0 11.50         raise
#0 11.50       File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
#0 11.50         self.gen.throw(type, value, traceback)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
#0 11.50         yield
#0 11.50       File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
#0 11.50         self.gen.throw(type, value, traceback)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
#0 11.50         saved_exc.resume()
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
#0 11.50         six.reraise(type, exc, self._tb)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
#0 11.50         raise value.with_traceback(tb)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
#0 11.50         yield saved
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
#0 11.50         yield
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
#0 11.50         _execfile(setup_script, ns)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
#0 11.50         exec(code, globals, locals)
#0 11.50       File "/tmp/easy_install-3jonaexa/cffi-1.15.1/setup.py", line 242, in <module>
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
#0 11.50         return distutils.core.setup(**attrs)
#0 11.50       File "/usr/lib/python3.6/distutils/core.py", line 163, in setup
#0 11.50         raise SystemExit("error: " + str(msg))
#0 11.50     SystemExit: error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
#0 11.50     
#0 11.50     During handling of the above exception, another exception occurred:
#0 11.50     
#0 11.50     Traceback (most recent call last):
#0 11.50       File "<string>", line 1, in <module>
#0 11.50       File "/tmp/pip-build-v3j71eel/persistent/setup.py", line 149, in <module>
#0 11.50         entry_points={})
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 128, in setup
#0 11.50         _install_setup_requires(attrs)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 123, in _install_setup_requires
#0 11.50         dist.fetch_build_eggs(dist.setup_requires)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 513, in fetch_build_eggs
#0 11.50         replace_conflicting=True,
#0 11.50       File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 774, in resolve
#0 11.50         replace_conflicting=replace_conflicting
#0 11.50       File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1057, in best_match
#0 11.50         return self.obtain(req, installer)
#0 11.50       File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1069, in obtain
#0 11.50         return installer(requirement)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 580, in fetch_build_egg
#0 11.50         return cmd.easy_install(req)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 698, in easy_install
#0 11.50         return self.install_item(spec, dist.location, tmpdir, deps)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 724, in install_item
#0 11.50         dists = self.install_eggs(spec, download, tmpdir)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 909, in install_eggs
#0 11.50         return self.build_and_install(setup_script, setup_base)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1177, in build_and_install
#0 11.50         self.run_setup(setup_script, setup_base, args)
#0 11.50       File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1165, in run_setup
#0 11.50         raise DistutilsError("Setup script exited with %s" % (v.args[0],))
#0 11.50     distutils.errors.DistutilsError: Setup script exited with error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
#0 11.50     
#0 11.50     ----------------------------------------
#0 11.60 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-v3j71eel/persistent/
------
Dockerfile:62
--------------------
  60 |     RUN pip3 install cython --no-cache-dir
  61 |     RUN pip3 install cytoolz --no-cache-dir
  62 | >>> RUN pip3 install -r requirements.txt --no-cache-dir
  63 |     RUN pip3 install torch==1.10.2+cpu torchvision==0.11.3+cpu torchaudio==0.10.2+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
  64 |     RUN go build -o execution.so -buildmode=c-shared export/execution.go
--------------------
ERROR: failed to solve: process "/bin/sh -c pip3 install -r requirements.txt --no-cache-dir" did not complete successfully: exit code: 1

@LostBenjamin
Copy link
Collaborator

Hi,

FIrst of all, I have just updated the Dockerfile to fix some other errors. Please also update on your side.

The Docker build now works for me, i.e., I cannot reproduce your error. My machine is a Mac with Intel chips. I searched a bit online and found that this post might be helpful. Can you try it and let me know if it works?

Best,
Jingxuan

@Stamp9
Copy link
Author

Stamp9 commented Jul 26, 2023

Hi, Jingxuan

Thanks for your quick reply!
I updated the dockerfile today and tried again, but it still didn't work for me. So I spent some time to figure it out, turned out that the ffi.h issue can be solved by add apt-get install libffi-dev in the dockerfile.
I also encountered some other errors later:

  1. RUN pip3 install -r requirements.txt --no-cache-dir
  • scipy
#0 46.00       File "/tmp/easy_install-xiqffze_/numpy-1.25.1/setup.py", line 22, in <module>
#0 46.00         import sys
#0 46.00     RuntimeError: Python version >= 3.9 required.

Solved by installing Python 3.10

  • pkg-config
#0 39.02   make[1]: Leaving directory '/tmp/pip-install-xu9zzjvg/coincurve_48d9f7112a5646d0a98e786629a47f81/build/temp.linux-aarch64-3.6'
#0 39.02   error: [Errno 2] No such file or directory: 'pkg-config': 'pkg-config'
#0 39.02   ----------------------------------------
#0 39.02   ERROR: Failed building wheel for coincurve

Solved by adding apt-get install pkg-config in the dockerfile.

  1. RUN pip3 install torch==1.10.2+cpu torchvision==0.11.3+cpu torchaudio==0.10.2+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
 > [42/50] RUN pip3 install torch==1.10.2+cpu torchvision==0.11.3+cpu torchaudio==0.10.2+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html:
#0 0.859 Looking in links: https://download.pytorch.org/whl/cpu/torch_stable.html
#0 2.010 ERROR: Could not find a version that satisfies the requirement torch==1.10.2+cpu (from versions: 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.10.0, 1.10.1, 1.10.2)
#0 2.010 ERROR: No matching distribution found for torch==1.10.2+cpu

Solved by changing the line to RUN pip3 install torch==1.10.2 torchvision==0.11.3 torchaudio==0.10.2 -f https://download.pytorch.org/whl/cpu/torch_stable.html

  1. RUN go build -o execution.so -buildmode=c-shared export/execution.go
> [43/50] RUN go build -o execution.so -buildmode=c-shared export/execution.go:
#0 0.487 qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

Solved by using docker build --platform linux/x86_64 -t ilf . , inspired by this post.


I modified the Dockerfile and built ILF successfully, but it took almost 2 hours to finish and it might becausedocker build --platform linux/x86_64 use emulation.
Then I tested the ILF a bit by docker run --platform linux/x86_64 -it ilf & python3 -m ilf --proj ./example/crowdsale/ --contract Crowdsale --fuzzer imitation --model ./model/ --limit 2000 according to the instruction and luckily it works well.

Hope this error information would be helpful :>
Please let me know if there is any better solution! Thanks again!


Below is the Dockerfile I used to build.

FROM ubuntu:18.04


RUN apt-get -y update
RUN apt-get -y install \
    wget \
    python3-pip \
    libssl-dev \
    libffi-dev \
    pkg-config \
    libc6-dev \
    curl \
    git

RUN wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
RUN tar -xvf Python-3.10.0.tgz
WORKDIR Python-3.10.0

# Configure, compile, and install Python 3.10
RUN ./configure --enable-optimizations
RUN make -j 8

# Clean up
WORKDIR /
RUN rm -rf Python-3.10.0
RUN rm Python-3.10.0.tgz

RUN python3 -m pip install --upgrade pip

# install nodejs truffle web3 ganache-cli
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get -y install nodejs
RUN npm -g config set user root
RUN npm install -g truffle@5.0.35 web3@1.2.2 ganache-cli@6.7.0

# install solc
RUN wget https://github.com/ethereum/solidity/releases/download/v0.4.25/solc-static-linux
RUN mv solc-static-linux /usr/bin/solc
RUN chmod +x /usr/bin/solc

# install go
RUN wget https://dl.google.com/go/go1.10.4.linux-amd64.tar.gz
RUN tar -xvf go1.10.4.linux-amd64.tar.gz
RUN mv go /usr/lib/go-1.10
RUN mkdir /go
ENV GOPATH=/go
ENV GOROOT=/usr/lib/go-1.10
ENV PATH=$PATH:$GOPATH/bin
ENV PATH=$PATH:$GOROOT/bin

# install z3
RUN git clone https://github.com/Z3Prover/z3.git
WORKDIR /z3
RUN git checkout z3-4.8.6
RUN python3 scripts/mk_make.py --python
WORKDIR /z3/build
RUN make -j7
RUN make install

# copy ilf
ADD ./ /go/src/ilf/

# install go-ethereum
RUN mkdir -p /go/src/github.com/ethereum/
WORKDIR /go/src/github.com/ethereum/
RUN git clone https://github.com/ethereum/go-ethereum.git
WORKDIR /go/src/github.com/ethereum/go-ethereum
RUN git checkout 86be91b3e2dff5df28ee53c59df1ecfe9f97e007
RUN git apply /go/src/ilf/script/patch.geth
# RUN go get github.com/ethereum/go-ethereum
# WORKDIR /go/src/github.com/ethereum/go-ethereum
# RUN git checkout 86be91b3e2dff5df28ee53c59df1ecfe9f97e007
# RUN git apply /go/src/ilf/script/patch.geth

WORKDIR /go/src/ilf
# install python dependencies
RUN apt-get -y install autoconf libjpeg-dev zlib1g-dev
RUN pip3 install "cython<3.0.0" --no-cache-dir
RUN pip3 install cytoolz --no-cache-dir
RUN pip3 install -r requirements.txt --no-cache-dir
RUN pip3 install torch==1.10.2 torchvision==0.11.3 torchaudio==0.10.2 -f https://download.pytorch.org/whl/cpu/torch_stable.html
RUN go build -o execution.so -buildmode=c-shared export/execution.go

# install pyethereum
WORKDIR /
RUN git clone https://github.com/ethereum/pyethereum.git
WORKDIR /pyethereum
RUN git checkout v2.3.2
RUN python3 setup.py install

WORKDIR /go/src/ilf

ENTRYPOINT [ "/bin/bash" ]

@LostBenjamin
Copy link
Collaborator

Hi @Stamp9 ,

Thank you for sharing your experience on building ILF dockerfile on Apple M1 Pro chips! The original Dockefile should work straightly on Intel chips. I am closing this now.

Best,
Jingxuan

@ghazi1987
Copy link

Hey, I am trying to install ILF from a Docker by following the instructions in the README file but encountered some errors.
I use ubuntu operating system.the message error bellow

[+] Building 0.4s (2/2) FINISHED docker:default
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 2B 0.0s
ERROR: failed to solve: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount4099367306/Dockerfile: no such file or directory

@LostBenjamin
Copy link
Collaborator

Hi @ghazi1987,

This error does seem to come from our side. Please search the error message online and try to find a solution. Here is something I found.

Best,
Jingxuan

@Stamp9
Copy link
Author

Stamp9 commented Aug 15, 2023

Hey, by the way, all the errors caused by M1 can be easily solved by specifying the platform, that's the only change needed.
E.g. Changing FROM ubuntu:18.04 to FROM --platform=linux/amd64 ubuntu:18.04 (linux/x86_64 also works I think) in Dockerfile and then it would work smoothly.
Then run docker run --platform linux/x86_64 -it ilf to use it.

Best,
Raphina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants