Skip to content

Support for custom targets #770

@davidskidmore

Description

@davidskidmore

I'm having difficulty using bazel with a custom target based on x86_64-unknown-linux-gnu. In theory, given a simple library:

#![no_std]

#[no_mangle]
pub extern "C" fn rust_function() {}

After bootstrapping libcore and friends I can now build the library for my new target:

rustc --crate-type=lib foo.rs --target x86_64-unknown-none.json \
  -L dependency=~/rust_libs/ \
  --extern 'noprelude:core=~/rust_libs/libcore-7363d577ba15c1d7.rmeta' \
  --extern 'noprelude:compiler_builtins=~/rust_libs/libcompiler_builtins-b774e5dde03423fb.rmeta' \
  -Z unstable-options

I'm aware of how to accomplish the cross build with cargo, but I'm not sure how to do this with bazel. There doesn't seem to be a way for me to pass my target JSON through a new rust_toolchain definition.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions