Help building rustc on a Debian host

Hi folks,

I’m trying to build the rust compiler from source using the instructions here and am running into a build issue I’m unable to find an explanation for. Here’s my build setup:

FROM debian:stable-20180716

RUN apt-get update && apt-get update
RUN apt-get install -y build-essential git python

RUN git clone https://github.com/rust-lang/rust.git

WORKDIR /rust
RUN git submodule update --init --recursive --progress
RUN ./x.py build

This is a Dockerfile. If you’re unfamiliar with docker you can reproduce my build issue by placing the above file in a folder, filed named Dockerfile and then run docker build .. The build issue I get is:

...
Step 7/7 : RUN ./x.py build
 ---> Running in fb23993d1f8b
Updating only changed submodules
Submodules updated in 0.10 seconds
Traceback (most recent call last):
  File "./x.py", line 20, in <module>
    bootstrap.main()
  File "/rust/src/bootstrap/bootstrap.py", line 850, in main
    bootstrap(help_triggered)
  File "/rust/src/bootstrap/bootstrap.py", line 824, in bootstrap
    build.download_stage0()
  File "/rust/src/bootstrap/bootstrap.py", line 359, in download_stage0
    self._download_stage0_helper(filename, pattern)
  File "/rust/src/bootstrap/bootstrap.py", line 394, in _download_stage0_helper
    get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
  File "/rust/src/bootstrap/bootstrap.py", line 36, in get
    download(sha_path, sha_url, False, verbose)
  File "/rust/src/bootstrap/bootstrap.py", line 69, in download
    _download(path, url, probably_big, verbose, True)
  File "/rust/src/bootstrap/bootstrap.py", line 96, in _download
    exception=exception)
  File "/rust/src/bootstrap/bootstrap.py", line 146, in run
    ret = subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
The command '/bin/sh -c ./x.py build' returned a non-zero code: 1

Anyone have a sense of where I might be going wrong?

This line is trying to run curl as an external command.

1 Like

Thanks for your help @cuviper. The Dockerfile I ended up with, for future record, was

FROM debian:stable-20180716

RUN apt-get update && apt-get upgrade
RUN apt-get install -y build-essential git python curl cmake

RUN git clone https://github.com/rust-lang/rust.git

WORKDIR /rust
RUN git submodule update --init --recursive --progress
RUN ./x.py build

What’s with doing apt-get update twice? Should one of those be an upgrade?

2 Likes

Yep, goof in the text. Now corrected. Thank you!

1 Like