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

docker/ci: fix rust installation #636

Closed
wants to merge 3 commits into from
Closed

docker/ci: fix rust installation #636

wants to merge 3 commits into from

Conversation

kr
Copy link
Contributor

@kr kr commented Feb 28, 2017

No description provided.

@kr kr added the PTAL label Feb 28, 2017
@kr
Copy link
Contributor Author

kr commented Feb 28, 2017

PTAL

@kr
Copy link
Contributor Author

kr commented Feb 28, 2017

This can be tested with docker build ..

&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2017-02-25 \
&& ~/.cargo/bin/cargo install rustfmt \
&& ~/.cargo/bin/cargo install clippy \
&& ~/.cargo/bin/cargo install cargo-audit \
Copy link
Contributor

@bobg bobg Mar 1, 2017

Choose a reason for hiding this comment

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

Remove trailing final backslash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would actually prefer to keep the trailing backslash to try to make typos less likely in the future. If we're adding lines onto the end and we imitate the final line, it'll do the right thing instead of leaving off the backslash.

Also, even when we do the right thing, it reduces diff noise — it doesn't generate a spurious difference on the existing line just to add a backslash.

@kr kr changed the title docker/ci: fix typo docker/ci: fix rust installation Mar 1, 2017
@kr
Copy link
Contributor Author

kr commented Mar 1, 2017

Adding in a couple more dependencies makes it get further, but it's still hung up on the following error:

:; docker build .
Sending build context to Docker daemon 15.87 kB
Step 1/5 : FROM golang:1.7.4-alpine
 ---> 00371bbb49d5
Step 2/5 : RUN apk --no-cache add bash clang git g++ make nodejs openjdk8 python perl     ruby ruby-bigdecimal ruby-bundler ruby-io-console ruby-irb ruby-json openssl ca-certificates     curl     && echo "http://dl-cdn.alpinelinux.org/alpine/v3.5/main" >> /etc/apk/repositories     && apk --no-cache add "protobuf>3.1.0"     && go get -u github.com/golang/protobuf/proto     && go get -u github.com/golang/protobuf/protoc-gen-go     && go get -u google.golang.org/grpc     && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub     && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk     && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-bin-2.23-r3.apk     && apk add glibc-2.23-r3.apk glibc-bin-2.23-r3.apk     && MAVEN_VERSION=3.3.9     && cd /usr/share     && wget -q http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz -O - | tar xzf -     && mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven     && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn     && git clone https://github.com/GoASTScanner/gas $(go env GOPATH)/src/github.com/GoASTScanner/gas     && cd $(go env GOPATH)/src/github.com/GoASTScanner/gas     && git reset --hard d30c5cde3613e9ba0129febda849e4d4df1d57cd     && go install github.com/GoASTScanner/gas     && curl -Ls -o zlib.tar.gz https://www.archlinux.org/packages/core/x86_64/zlib/download/     && mkdir -p /usr/zlib-compat     && tar -C /usr/zlib-compat -xvf zlib.tar.gz     && rm zlib.tar.gz     && rm /usr/glibc-compat/etc/ld.so.conf     && echo /usr/zlib-compat/usr/lib >> /usr/glibc-compat/etc/ld.so.conf     && echo /usr/lib >> /usr/glibc-compat/etc/ld.so.conf     && echo /lib >> /usr/glibc-compat/etc/ld.so.conf     && /usr/glibc-compat/sbin/ldconfig     && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2017-02-25     && ~/.cargo/bin/cargo install rustfmt     && ~/.cargo/bin/cargo install clippy     && ~/.cargo/bin/cargo install cargo-audit ADD bin /usr/bin
 ---> Running in f270bd86f143
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/70) Installing ncurses-terminfo-base (6.0-r7)
(2/70) Installing ncurses-terminfo (6.0-r7)
(3/70) Installing ncurses-libs (6.0-r7)
(4/70) Installing readline (6.3.008-r4)
(5/70) Installing bash (4.3.42-r5)
Executing bash-4.3.42-r5.post-install
(6/70) Installing libgcc (5.3.0-r0)
(7/70) Installing libstdc++ (5.3.0-r0)
(8/70) Installing clang-libs (3.8.0-r0)
(9/70) Installing libxml2 (2.9.4-r0)
(10/70) Installing clang (3.8.0-r0)
(11/70) Installing libssh2 (1.7.0-r0)
(12/70) Installing libcurl (7.52.1-r1)
(13/70) Installing curl (7.52.1-r1)
(14/70) Installing binutils-libs (2.26-r0)
(15/70) Installing binutils (2.26-r0)
(16/70) Installing gmp (6.1.0-r0)
(17/70) Installing isl (0.14.1-r0)
(18/70) Installing libgomp (5.3.0-r0)
(19/70) Installing libatomic (5.3.0-r0)
(20/70) Installing pkgconf (0.9.12-r0)
(21/70) Installing pkgconfig (0.25-r1)
(22/70) Installing mpfr3 (3.1.2-r0)
(23/70) Installing mpc1 (1.0.3-r0)
(24/70) Installing gcc (5.3.0-r0)
(25/70) Installing musl-dev (1.1.14-r14)
(26/70) Installing libc-dev (0.7-r0)
(27/70) Installing g++ (5.3.0-r0)
(28/70) Installing expat (2.2.0-r0)
(29/70) Installing pcre (8.38-r1)
(30/70) Installing git (2.8.3-r0)
(31/70) Installing make (4.1-r1)
(32/70) Installing libuv (1.9.1-r0)
(33/70) Installing nodejs (6.7.0-r0)
(34/70) Installing libffi (3.2.1-r2)
(35/70) Installing libtasn1 (4.8-r0)
(36/70) Installing p11-kit (0.23.2-r0)
(37/70) Installing p11-kit-trust (0.23.2-r0)
(38/70) Installing java-cacerts (1.0-r0)
(39/70) Installing libxau (1.0.8-r1)
(40/70) Installing libxdmcp (1.1.2-r1)
(41/70) Installing libxcb (1.11.1-r0)
(42/70) Installing libx11 (1.6.4-r0)
(43/70) Installing libxext (1.3.3-r1)
(44/70) Installing libxi (1.7.7-r0)
(45/70) Installing libxrender (0.9.10-r0)
(46/70) Installing libxtst (1.2.3-r0)
(47/70) Installing libpng (1.6.21-r0)
(48/70) Installing freetype (2.6.3-r0)
(49/70) Installing giflib (5.1.4-r1)
(50/70) Installing openjdk8-jre-lib (8.111.14-r0)
(51/70) Installing java-common (0.1-r0)
(52/70) Installing alsa-lib (1.1.1-r3)
(53/70) Installing openjdk8-jre-base (8.111.14-r0)
(54/70) Installing openjdk8-jre (8.111.14-r0)
(55/70) Installing openjdk8 (8.111.14-r0)
(56/70) Installing openssl (1.0.2k-r0)
(57/70) Installing perl (5.22.2-r0)
(58/70) Installing libbz2 (1.0.6-r5)
(59/70) Installing gdbm (1.11-r1)
(60/70) Installing sqlite-libs (3.13.0-r0)
(61/70) Installing python (2.7.12-r0)
(62/70) Installing libedit (20150325.3.1-r3)
(63/70) Installing yaml (0.1.6-r1)
(64/70) Installing ruby-libs (2.3.1-r0)
(65/70) Installing ruby (2.3.1-r0)
(66/70) Installing ruby-bigdecimal (2.3.1-r0)
(67/70) Installing ruby-io-console (2.3.1-r0)
(68/70) Installing ruby-bundler (1.12.5-r0)
(69/70) Installing ruby-irb (2.3.1-r0)
(70/70) Installing ruby-json (2.3.1-r0)
Executing busybox-1.24.2-r12.trigger
Executing ca-certificates-20160104-r4.trigger
Executing java-common-0.1-r0.trigger
OK: 610 MiB in 82 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
(1/1) Installing protobuf (3.1.0-r1)
Executing busybox-1.24.2-r12.trigger
OK: 614 MiB in 83 packages
Connecting to github.com (192.30.253.112:443)
Connecting to github-cloud.s3.amazonaws.com (52.216.17.16:443)
glibc-2.23-r3.apk    100% |*******************************|  2874k  0:00:00 ETA
Connecting to github.com (192.30.253.112:443)
Connecting to github-cloud.s3.amazonaws.com (52.216.17.16:443)
glibc-bin-2.23-r3.ap 100% |*******************************|  1710k  0:00:00 ETA
WARNING: Ignoring APKINDEX.167438ca.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.a2e6dac0.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.c51f8f92.tar.gz: No such file or directory
(1/2) Installing glibc (2.23-r3)
(2/2) Installing glibc-bin (2.23-r3)
Executing glibc-bin-2.23-r3.trigger
OK: 621 MiB in 85 packages
Cloning into '/go/src/github.com/GoASTScanner/gas'...
HEAD is now at d30c5cd Merge pull request #91 from GoASTScanner/experimental
.PKGINFO
.BUILDINFO
.MTREE
usr/
usr/include/
usr/share/
usr/lib/
usr/lib/libz.a
usr/lib/libz.so.1.2.11
usr/lib/libz.so.1
usr/lib/libz.so
usr/lib/pkgconfig/
usr/lib/pkgconfig/zlib.pc
usr/share/licenses/
usr/share/man/
usr/share/man/man3/
usr/share/man/man3/zlib.3.gz
usr/share/licenses/zlib/
usr/share/licenses/zlib/LICENSE
usr/include/zconf.h
usr/include/zlib.h
info: downloading installer
info: syncing channel updates for 'nightly-2017-02-25-x86_64-unknown-linux-gnu'
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'

info: default toolchain set to 'nightly-2017-02-25'
  nightly-2017-02-25 installed - rustc 1.17.0-nightly (08230775a 2017-02-24)

    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading rustfmt v0.7.1
  Installing rustfmt v0.7.1
 Downloading unicode-segmentation v1.1.0
 Downloading syntex_syntax v0.56.2
 Downloading env_logger v0.3.5
 Downloading multimap v0.3.0
 Downloading toml v0.2.1
 Downloading rustc-serialize v0.3.22
 Downloading strings v0.0.1
 Downloading diff v0.1.9
 Downloading regex v0.1.80
 Downloading log v0.3.6
 Downloading syntex_errors v0.56.0
 Downloading itertools v0.5.9
 Downloading getopts v0.2.14
 Downloading term v0.4.5
 Downloading libc v0.2.20
 Downloading bitflags v0.7.0
 Downloading syntex_pos v0.56.0
 Downloading unicode-xid v0.0.4
 Downloading utf8-ranges v0.1.3
 Downloading thread_local v0.2.7
 Downloading aho-corasick v0.5.3
 Downloading regex-syntax v0.3.9
 Downloading memchr v0.1.11
 Downloading thread-id v2.0.0
 Downloading kernel32-sys v0.2.2
 Downloading winapi v0.2.8
 Downloading winapi-build v0.1.1
 Downloading either v1.0.3
 Downloading walkdir v1.0.7
 Downloading same-file v0.1.3
   Compiling utf8-ranges v0.1.3
   Compiling regex-syntax v0.3.9
   Compiling winapi v0.2.8
   Compiling libc v0.2.20
   Compiling memchr v0.1.11
   Compiling bitflags v0.7.0
   Compiling rustc-serialize v0.3.22
   Compiling unicode-segmentation v1.1.0
   Compiling aho-corasick v0.5.3
   Compiling term v0.4.5
   Compiling toml v0.2.1
   Compiling diff v0.1.9
   Compiling unicode-xid v0.0.4
   Compiling winapi-build v0.1.1
   Compiling multimap v0.3.0
   Compiling getopts v0.2.14
   Compiling kernel32-sys v0.2.2
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-install.37VQyNXK8LLV/release/build/kernel32-sys-d671a552ab2eb593/build_script_build-d671a552ab2eb593.0.o" "-o" "/tmp/cargo-install.37VQyNXK8LLV/release/build/kernel32-sys-d671a552ab2eb593/build_script_build-d671a552ab2eb593" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-install.37VQyNXK8LLV/release/deps" "-L" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/cargo-install.37VQyNXK8LLV/release/deps/libbuild-81e04b6e93e8cd67.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-9a66b6a343d52844.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-6bc49e032a89c77d.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-a2a467c3ca3b6479.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-e54225ff8f33e08f.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-9d79f761aa668a33.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-2beb731af7a6faec.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-ce7b9706e1719f27.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-4b74d6f2808677d3.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-95af4192ed69a1c8.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-cd0ca85e71f914ca.rlib" "/root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-0bf24067248742a8.rlib" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /root/.rustup/toolchains/nightly-2017-02-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-4b74d6f2808677d3.rlib(ctl.pic.o): In function `ctl_lookup':
          /checkout/src/liballoc_jemalloc/../jemalloc/src/ctl.c:894: undefined reference to `__rawmemchr'
          /checkout/src/liballoc_jemalloc/../jemalloc/src/ctl.c:818: undefined reference to `__rawmemchr'
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: Could not compile `kernel32-sys`.
Build failed, waiting for other jobs to finish...
error: failed to compile `rustfmt v0.7.1`, intermediate artifacts can be found at `/tmp/cargo-install.37VQyNXK8LLV`

Caused by:
  build failed
The command '/bin/sh -c apk --no-cache add bash clang git g++ make nodejs openjdk8 python perl     ruby ruby-bigdecimal ruby-bundler ruby-io-console ruby-irb ruby-json openssl ca-certificates     curl     && echo "http://dl-cdn.alpinelinux.org/alpine/v3.5/main" >> /etc/apk/repositories     && apk --no-cache add "protobuf>3.1.0"     && go get -u github.com/golang/protobuf/proto     && go get -u github.com/golang/protobuf/protoc-gen-go     && go get -u google.golang.org/grpc     && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub     && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk     && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-bin-2.23-r3.apk     && apk add glibc-2.23-r3.apk glibc-bin-2.23-r3.apk     && MAVEN_VERSION=3.3.9     && cd /usr/share     && wget -q http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz -O - | tar xzf -     && mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven     && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn     && git clone https://github.com/GoASTScanner/gas $(go env GOPATH)/src/github.com/GoASTScanner/gas     && cd $(go env GOPATH)/src/github.com/GoASTScanner/gas     && git reset --hard d30c5cde3613e9ba0129febda849e4d4df1d57cd     && go install github.com/GoASTScanner/gas     && curl -Ls -o zlib.tar.gz https://www.archlinux.org/packages/core/x86_64/zlib/download/     && mkdir -p /usr/zlib-compat     && tar -C /usr/zlib-compat -xvf zlib.tar.gz     && rm zlib.tar.gz     && rm /usr/glibc-compat/etc/ld.so.conf     && echo /usr/zlib-compat/usr/lib >> /usr/glibc-compat/etc/ld.so.conf     && echo /usr/lib >> /usr/glibc-compat/etc/ld.so.conf     && echo /lib >> /usr/glibc-compat/etc/ld.so.conf     && /usr/glibc-compat/sbin/ldconfig     && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2017-02-25     && ~/.cargo/bin/cargo install rustfmt     && ~/.cargo/bin/cargo install clippy     && ~/.cargo/bin/cargo install cargo-audit ADD bin /usr/bin' returned a non-zero code: 101
:; 

We can keep poking around at this, but if we can't figure it out in a day or two I think maybe we should back out the previous commit and look at other options. (Maybe switching to ubuntu as the base system?)

@tonychain
Copy link
Contributor

This seems relevant... looks like they're using musl instead of glibc? gliderlabs/docker-alpine#168

Also: gliderlabs/docker-alpine#11

I'd think the happy path here would be to switch to Ubuntu. No worries if you want to back out this change until you do that.

@kr
Copy link
Contributor Author

kr commented Mar 1, 2017

Yeah alpine is using musl for sure; and it looks like rust doesn't really play nice with musl. It would also be fine to run a static build of rust but it looks like such a thing isn't available.

We tried installing a glibc alongside musl in the image, but haven't dug around in the rust build system enough to make sure it's picking up the glibc files instead of the musl files.

@kr
Copy link
Contributor Author

kr commented Mar 1, 2017

Ok thank you!

@tarcieri
Copy link
Contributor

tarcieri commented Mar 1, 2017

Looks like there's a project that supports building Rust with musl:

https://github.com/emk/rust-musl-builder

@boymanjor
Copy link
Contributor

If we end up migrating from Alpine, it seems like a good opportunity to use a CentOS based image. Most of our clients will be running RHEL.

@kr
Copy link
Contributor Author

kr commented Mar 2, 2017

Yeah okay, it doesn't seem like a straightforward fix any more, so I'd like to back out 58c1cd0 for now, and then we can try again with either the musl-builder or CentOS.

@kr kr closed this Mar 2, 2017
@kr kr deleted the typo branch March 2, 2017 00:44
kr added a commit that referenced this pull request Mar 2, 2017
This reverts commit 58c1cd0.

Since Alpine uses musl and Rust doesn't easily work with
musl out of the box, it'll take some more work to get
this up and running. See also #636 for some discussion.

So let's back this out for now and we can try again.
iampogo pushed a commit that referenced this pull request Mar 2, 2017
This reverts commit 58c1cd0.

Since Alpine uses musl and Rust doesn't easily work with
musl out of the box, it'll take some more work to get
this up and running. See also #636 for some discussion.

So let's back this out for now and we can try again.

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

Successfully merging this pull request may close these issues.

5 participants