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

ci: Use rustc docker image for x86_64 and i686 linux #1815

Merged
merged 1 commit into from
May 5, 2019

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Apr 27, 2019

cc @kinnison , @alexcrichton
So the effort of improving CI time is zero for now (#1760)
The next PR might be setting up sccache.

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over-all I like this a lot. It feels right to me to be using the same docker image sources everywhere.

@alexcrichton how do you feel about this? I'm guessing positive?

(tentative approval, but I'd like at least one other docker-conversant person to have final approval)

RUN make -j$(nproc)
RUN make install
FROM rust-i686-unknown-linux-gnu
RUN ln /rustroot/bin/gcc /rustroot/bin/cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a nicer, perhaps package-managery way we can have this work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no package manager involved here.
Setting environment variable CC=/rustroot/bin/gcc should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, setting CC env doesn't seem to work. Maybe cc crate doesn't respect
CC env?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ printenv CC CXX
clang
clang++

CC is set to clang and we still had the build error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the target is explicitly configured: https://github.com/rust-lang/rustup.rs/blob/66c4d10871edc307865db031483f2bd799abbba3/ci/run.sh#L9
So it'd be CC_x86_64-unknown-linux-gnu for x84_64.

I don't know exact error but if it was the linker then RUSTFLAGS="-C linker=gcc" would help but this is getting a bit complex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CC_x86_64-unknown-linux-gnu standard or it's just used by cc crate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message is

     Running `rustc --crate-name semver_parser /src/target/cargo-home/registry/src/github.com-1ecc6299db9ec823/semver-parser-0.7.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=1 -C metadata=c7af5d73bcae4fa9 -C extra-filename=-c7af5d73bcae4fa9 --out-dir /src/target/release/deps -L dependency=/src/target/release/deps --cap-lints allow`
error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CC_x86_64-unknown-linux-gnu standard or it's just used by cc crate?

As far as I can tell it's used by cc-rs and Rust's bootstrap.

The error message is

That's the linker error so RUSTFLAGS="-C linker=gcc" would work.

Copy link
Contributor Author

@tesuji tesuji Apr 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think about it: Why does rustc's docker image have no cc hard link?
It is common that cc hard link to gcc on Linux distro.

@tesuji
Copy link
Contributor Author

tesuji commented Apr 29, 2019

Blocked by rust-lang/rust#60366

bors added a commit to rust-lang/rust that referenced this pull request Apr 29, 2019
build-gcc: Create missing cc hard link

This PR mostly fixes build error caused by using rustc docker images
to build [rustup][1] (with the error: ``linker `cc` not found``).

I don't know why gcc build script doesn't install cc hard link by default.
In build log, with `make SHELL='sh -x' install`, gcc build script installs c++
hard link but not `cc` one:

```bash
if test "" != "yes" ; then \
  rm -f /rustroot/bin/g++; \
  /usr/bin/install -c xg++ /rustroot/bin/g++; \
  chmod a+x /rustroot/bin/g++; \
  rm -f /rustroot/bin/c++; \
  ( cd /rustroot/bin && \
    ln g++ c++ ); \
  if [ -f cc1plus ] ; then \
    if [ ! -f g++-cross ] ; then \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-g++; \
      ( cd /rustroot/bin && \
        ln g++ x86_64-unknown-linux-gnu-g++ ); \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-c++; \
      ( cd /rustroot/bin && \
        ln c++ x86_64-unknown-linux-gnu-c++ ); \
    fi ; \
  fi; \
fi
```

This might be fixed downstream by manually creating cc hard link
or setting `RUSTFLAGS="-C linker=gcc"` as [suggested by @mati865][2].
But I find it better to fix it upstream in this PR.

[1]: rust-lang/rustup#1815
[2]: rust-lang/rustup#1815 (comment)
Centril added a commit to Centril/rust that referenced this pull request May 1, 2019
build-gcc: Create missing cc symlink

This PR mostly fixes build error caused by using rustc docker images
to build [rustup][1] (with the error: ``linker `cc` not found``).

I don't know why gcc build script doesn't install cc hard link by default.
In build log, with `make SHELL='sh -x' install`, gcc build script installs c++
hard link but not `cc` one:

```bash
if test "" != "yes" ; then \
  rm -f /rustroot/bin/g++; \
  /usr/bin/install -c xg++ /rustroot/bin/g++; \
  chmod a+x /rustroot/bin/g++; \
  rm -f /rustroot/bin/c++; \
  ( cd /rustroot/bin && \
    ln g++ c++ ); \
  if [ -f cc1plus ] ; then \
    if [ ! -f g++-cross ] ; then \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-g++; \
      ( cd /rustroot/bin && \
        ln g++ x86_64-unknown-linux-gnu-g++ ); \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-c++; \
      ( cd /rustroot/bin && \
        ln c++ x86_64-unknown-linux-gnu-c++ ); \
    fi ; \
  fi; \
fi
```

This might be fixed downstream by manually creating cc hard link
or setting `RUSTFLAGS="-C linker=gcc"` as [suggested by @mati865][2].
But I find it better to fix it upstream in this PR.

[1]: rust-lang/rustup#1815
[2]: rust-lang/rustup#1815 (comment)
Centril added a commit to Centril/rust that referenced this pull request May 1, 2019
build-gcc: Create missing cc symlink

This PR mostly fixes build error caused by using rustc docker images
to build [rustup][1] (with the error: ``linker `cc` not found``).

I don't know why gcc build script doesn't install cc hard link by default.
In build log, with `make SHELL='sh -x' install`, gcc build script installs c++
hard link but not `cc` one:

```bash
if test "" != "yes" ; then \
  rm -f /rustroot/bin/g++; \
  /usr/bin/install -c xg++ /rustroot/bin/g++; \
  chmod a+x /rustroot/bin/g++; \
  rm -f /rustroot/bin/c++; \
  ( cd /rustroot/bin && \
    ln g++ c++ ); \
  if [ -f cc1plus ] ; then \
    if [ ! -f g++-cross ] ; then \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-g++; \
      ( cd /rustroot/bin && \
        ln g++ x86_64-unknown-linux-gnu-g++ ); \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-c++; \
      ( cd /rustroot/bin && \
        ln c++ x86_64-unknown-linux-gnu-c++ ); \
    fi ; \
  fi; \
fi
```

This might be fixed downstream by manually creating cc hard link
or setting `RUSTFLAGS="-C linker=gcc"` as [suggested by @mati865][2].
But I find it better to fix it upstream in this PR.

[1]: rust-lang/rustup#1815
[2]: rust-lang/rustup#1815 (comment)
Centril added a commit to Centril/rust that referenced this pull request May 1, 2019
build-gcc: Create missing cc symlink

This PR mostly fixes build error caused by using rustc docker images
to build [rustup][1] (with the error: ``linker `cc` not found``).

I don't know why gcc build script doesn't install cc hard link by default.
In build log, with `make SHELL='sh -x' install`, gcc build script installs c++
hard link but not `cc` one:

```bash
if test "" != "yes" ; then \
  rm -f /rustroot/bin/g++; \
  /usr/bin/install -c xg++ /rustroot/bin/g++; \
  chmod a+x /rustroot/bin/g++; \
  rm -f /rustroot/bin/c++; \
  ( cd /rustroot/bin && \
    ln g++ c++ ); \
  if [ -f cc1plus ] ; then \
    if [ ! -f g++-cross ] ; then \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-g++; \
      ( cd /rustroot/bin && \
        ln g++ x86_64-unknown-linux-gnu-g++ ); \
      rm -f /rustroot/bin/x86_64-unknown-linux-gnu-c++; \
      ( cd /rustroot/bin && \
        ln c++ x86_64-unknown-linux-gnu-c++ ); \
    fi ; \
  fi; \
fi
```

This might be fixed downstream by manually creating cc hard link
or setting `RUSTFLAGS="-C linker=gcc"` as [suggested by @mati865][2].
But I find it better to fix it upstream in this PR.

[1]: rust-lang/rustup#1815
[2]: rust-lang/rustup#1815 (comment)
@tesuji
Copy link
Contributor Author

tesuji commented May 1, 2019

Ok. Ready to merge 🎉

@kinnison kinnison merged commit a7460e2 into rust-lang:master May 5, 2019
@tesuji tesuji deleted the rustc-docker branch May 5, 2019 13:58
@rami3l rami3l mentioned this pull request Oct 8, 2023
1 task
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

Successfully merging this pull request may close these issues.

4 participants