Skip to content

Providing the compiler crates as rlib? #55741

Open
@swiftcoder

Description

@swiftcoder

I'd like to embed rustc_driver in a static library (for complicated embedded deployment reasons that aren't entirely relevant). Dependencies of a static library seem to have to be in rlib format so the compile can read metadata.

Unfortunately, most of the compiler crates are only building dylibs, causing cargo to refuse to build a staticlib:

error: crate `rustc_driver` required to be available in rlib format, but was not found in this form
error: crate `arena` required to be available in rlib format, but was not found in this form
error: crate `rustc_data_structures` required to be available in rlib format, but was not found in this form
error: crate `graphviz` required to be available in rlib format, but was not found in this form
error: crate `rustc_cratesio_shim` required to be available in rlib format, but was not found in this for
error: crate `rustc` required to be available in rlib format, but was not found in this form
error: crate `fmt_macros` required to be available in rlib format, but was not found in this form
error: crate `rustc_target` required to be available in rlib format, but was not found in this form
error: crate `rustc_errors` required to be available in rlib format, but was not found in this form
error: crate `syntax_pos` required to be available in rlib format, but was not found in this form
error: crate `syntax` required to be available in rlib format, but was not found in this form
error: crate `proc_macro` required to be available in rlib format, but was not found in this form
error: crate `rustc_fs_util` required to be available in rlib format, but was not found in this form
error: crate `rustc_allocator` required to be available in rlib format, but was not found in this form
error: crate `rustc_borrowck` required to be available in rlib format, but was not found in this form
error: crate `rustc_mir` required to be available in rlib format, but was not found in this form
error: crate `rustc_passes` required to be available in rlib format, but was not found in this form
error: crate `rustc_lint` required to be available in rlib format, but was not found in this form
error: crate `rustc_plugin` required to be available in rlib format, but was not found in this form
error: crate `rustc_metadata` required to be available in rlib format, but was not found in this form
error: crate `syntax_ext` required to be available in rlib format, but was not found in this form
error: crate `rustc_privacy` required to be available in rlib format, but was not found in this form
error: crate `rustc_typeck` required to be available in rlib format, but was not found in this form
error: crate `rustc_platform_intrinsics` required to be available in rlib format, but was not found in this form
error: crate `rustc_incremental` required to be available in rlib format, but was not found in this form
error: crate `rustc_resolve` required to be available in rlib format, but was not found in this form
error: crate `rustc_save_analysis` required to be available in rlib format, but was not found in this form
error: crate `rustc_codegen_utils` required to be available in rlib format, but was not found in this form
error: crate `rustc_traits` required to be available in rlib format, but was not found in this form

error: aborting due to 29 previous errors

Is there a technical reason why these are all only built as dylib, or is this just because no one has thus far needed to embed them in a staticlib? Would it be a reasonable ask to configure these projects to build both flavours?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions