rust-lang / rust-lang/cargo

Cannot have more than one target with the same name

Open
#9,780 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-layout C-feature-request S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Problem

I am trying to build lambda functions for deployment with aws, and have the following project structure:

| - Cargo.toml // workspace root
    | - lambda-1
    | - lambda-2
    | - lambda-3

The problem is that for all of the functions, they must each produce a binary with the name bootstrap. However, if I do this, then only 1 output file is generated with the name bootstrap, and it is random which one it is. There is another issue reported on this. Therefore,
The only workaround I've found is to not rename the output binaries, and instead copy them out to another output and rename them manually.

Possible Solution(s)

Perhaps it could be made possible to tell Cargo to output the files under a sub folder for each crate

i.e.:

| - target
    | - release
        | - lambda_1
            | - bootstrap
        | - lambda_2
            | - bootstrap
        | - lambda_3
            | - bootstrap

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source files or tests. Start by reproducing the workspace build with three crates whose binaries are all named bootstrap, then trace Cargo's release-artifact output handling. Done means each crate produces its own distinct bootstrap file in a predictable location without manual copying.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.