问题
I'm trying to create a Docker container to be used for armhf cross compilation.
I've been following the guide at https://wiki.debian.org/CrossToolchains, and from my understanding, the Dockerfile below should be sufficient. Unfortunately it fails, not finding the gcc-arm-linux-gnueabihf and g++-arm-linux-gnueabihf dependencies.
FROM debian:jessie
# Install curl so that we can download the keys
RUN apt-get update && apt-get install -y curl
RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/crosstools.list
RUN curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
RUN dpkg --add-architecture armhf
RUN apt-get update && apt-get install -y cross-gcc-dev
RUN apt-get install -y crossbuild-essential-armhf
BUILD:
sudo docker build .
Sending build context to Docker daemon 113.7kB
Step 1/7 : FROM debian:jessie
---> 5dd74d62fab8
Step 2/7 : RUN apt-get update && apt-get install -y curl
---> Using cache
---> cb5a560dc472
Step 3/7 : RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/crosstools.list
---> Using cache
---> 6674219e5502
Step 4/7 : RUN curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
---> Using cache
---> ce46e0f134a4
Step 5/7 : RUN dpkg --add-architecture armhf
---> Using cache
---> 88e77df3eb4a
Step 6/7 : RUN apt-get update && apt-get install -y cross-gcc-dev
---> Using cache
---> 03982cdb62c7
Step 7/7 : RUN apt-get install -y crossbuild-essential-armhf
---> Running in 6700f9deb70c
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
crossbuild-essential-armhf : Depends: gcc-arm-linux-gnueabihf (>= 4.9.1-1) but it is not going to be installed
Depends: g++-arm-linux-gnueabihf (>= 4.9.1-1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get install -y crossbuild-essential-armhf' returned a non-zero code: 100
How can I fix this? I know that there are other containers out there that already do cross compiling, but it is important for me to create my own.
来源:https://stackoverflow.com/questions/49515264/cross-compiling-the-debianjessie-container