Reputation: 1329
I'm attempting to use rustembedded/cross to cross compile to linux but I need to override the default image since I need clang and the default image doesn't provide that.
According to their documentation, you can provide a dockerfile and a configuration file to accomplish this.
This led me to having a docker file of:
FROM rustembedded/cross:x86_64-unknown-linux-gnu
RUN dpkg --add-architecture x86_64 && apt-get update && \
apt-get install --assume-yes --no-install-recommends \
libclang-dev \
clang
and a Cross.toml configuration file of:
[target.x86_64-unknown-linux-gnu]
image = "linux:v2"
Then, when I build this image with docker build -f ./Dockerfile.x86_64-unknown-linux-gnu -t linux:v2 .
, it gives me an error saying that dkpg
can't be found. Even if I remove that part it tells me that apt-get
can't be found.
I can access the shell of the container that it extends, rustembedded/cross:x86_64-unknown-linux-gnu
, in docker desktop and if I run dpkg
, it shows me the help command. This is confusing since my image extends from it but it doesn't know about dkpg
.
Upvotes: 1
Views: 183
Reputation: 31584
rustembedded/cross:x86_64-unknown-linux-gnu
is based on centos
, not ubuntu
, see its Dockerfile:
FROM ubuntu:16.04
COPY linux-image.sh /
RUN /linux-image.sh x86_64
FROM centos:7
It use multistage build, the last os is centos:7
.
You could also confirm it with next:
$ docker run --rm -it rustembedded/cross:x86_64-unknown-linux-gnu cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
I don't know how you get dpkg
with manual run, definitely something wrong with your steps. But the package system in centos
is yum
, you should find same ways using yum
for your package install.
$ docker run --rm -it rustembedded/cross:x86_64-unknown-linux-gnu yum version
Loaded plugins: fastestmirror, ovl
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Installed: 7/x86_64 213:96cbf4a3c83d0362309d530d515684dce3f40f63
Group-Installed: yum 14:302aa408884b4b89361d6bb1c41ceac40665f80e
version
Upvotes: 1