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

Allow using docker for Darwin targets #436

Closed
rpignolet opened this issue Jun 16, 2020 · 3 comments
Closed

Allow using docker for Darwin targets #436

rpignolet opened this issue Jun 16, 2020 · 3 comments

Comments

@rpignolet
Copy link

It is related to #223 but I'm not asking to support Darwin targets, just allow to use docker for Darwin targets from Linux host.

I build myself a docker container which support cross compile from Linux to Darwin but I'm unable to use it with this Cross.toml :

[target.x86_64-apple-darwin]
image = "custom-cross:x86_64-apple-darwin"

When I run cross build --target x86_64-apple-darwin --release -v I don't see the docker run command in the log, cross fallback to cargo on the host.

bors bot added a commit that referenced this issue Feb 20, 2021
489: Add support for more hosts and simplify/unify host support checks r=reitermarkus a=alex-berger

This PR enables more freedom when choosing custom host/target combinations and simplifies (unifies) logic and behavior regarding when to build natively (using local toolchain) and when to use docker image based toolchain. If users explicitly passes `--target ...` option to `cross` it will always use docker image based toolchain (unless a target explicitly opts-out) and only use the local toolchain if `--target` option is not present.

Furthermore, no longer make any assumptions about the host, and let users use any host. It is the user's choice and responsibility to choose a working host platform and `cross` should not artificially limit use cases.

This PR also addresses:
- [436](#436)

Co-authored-by: alex.berger@nexiot.ch <alex.berger@nexiot.ch>
@UebelAndre
Copy link
Contributor

Seems like this work is done? Also @rpignolet would you be willing to share your dockerfile?

@rpignolet
Copy link
Author

I build the file MacOSX10.15.sdk.tar.xz with osxcross and then use this Dockerfile.

FROM ubuntu:18.04

COPY common.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

RUN mkdir /opt/osxcross &&                                      \
    cd /opt &&                                                  \
    git clone https://github.com/tpoechtrager/osxcross.git &&   \
    cd osxcross &&                                              \
    git checkout c2ad5e859d12a295c3f686a15bd7181a165bfa82 &&    \
    ./tools/get_dependencies.sh

ENV OSXCROSS_SDK_VERSION 10.15

COPY MacOSX${OSXCROSS_SDK_VERSION}.sdk.tar.xz /opt/osxcross/tarballs

RUN cd /opt/osxcross && \
    SDK_VERSION=$OSXCROSS_SDK_VERSION UNATTENDED=1 ./build.sh

#RUN cd /opt/osxcross && ./build_compiler_rt.sh

ENV CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/opt/osxcross/target/bin/o64-clang  \
    CC_x86_64_apple_darwin=/opt/osxcross/target/bin/o64-clang                   \
    CXX_x86_64_apple_darwin=/opt/osxcross/target/bin/o64-clang++

bors bot added a commit that referenced this issue Apr 18, 2021
489: Add support for more hosts and simplify/unify host support checks r=burrbull a=alex-berger

This PR enables more freedom when choosing custom host/target combinations and simplifies (unifies) logic and behavior regarding when to build natively (using local toolchain) and when to use docker image based toolchain. If users explicitly passes `--target ...` option to `cross` it will always use docker image based toolchain (unless a target explicitly opts-out) and only use the local toolchain if `--target` option is not present.

Furthermore, no longer make any assumptions about the host, and let users use any host. It is the user's choice and responsibility to choose a working host platform and `cross` should not artificially limit use cases.

This PR also addresses:
- [436](#436)

Co-authored-by: alex.berger@nexiot.ch <alex.berger@nexiot.ch>
Co-authored-by: Alexander Berger <alex-berger@gmx.ch>
@rpignolet
Copy link
Author

Issue is resolved with #489.

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

No branches or pull requests

3 participants