-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
--dep-info doesn't reflect real output filename when using -c or --emit-llvm #11667
Comments
I imagine that the restructuring of #7791 will address much of this. Right now dep-info doesn't track any dependencies, and I think that's more of a job for a package manager rather than rustc itself. I don't know what the makefile target dependency would be named. In theory it could be |
This also doesn't work if the dependency is also built as part of the build process. E.g. a library might have some examples which depend on the library being built. |
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib, --lib, and --bin flags from rustc, adding the following flags: * --emit=[asm,ir,bc,obj,link] * --crate-type=[dylib,rlib,staticlib,bin,lib] The -o option has also been redefined to be used for *all* flavors of outputs. This means that we no longer ignore it for libraries. The --out-dir remains the same as before. The new logic for files that rustc emits is as follows: 1. Output types are dictated by the --emit flag. The default value is --emit=link, and this option can be passed multiple times and have all options stacked on one another. 2. Crate types are dictated by the --crate-type flag and the #[crate_type] attribute. The flags can be passed many times and stack with the crate attribute. 3. If the -o flag is specified, and only one output type is specified, the output will be emitted at this location. If more than one output type is specified, then the filename of -o is ignored, and all output goes in the directory that -o specifies. The -o option always ignores the --out-dir option. 4. If the --out-dir flag is specified, all output goes in this directory. 5. If -o and --out-dir are both not present, all output goes in the directory of the crate file. 6. When multiple output types are specified, the filestem of all output is the same as the name of the CrateId (derived from a crate attribute or from the filestem of the crate file). Closes #7791 Closes #11056 Closes #11667
Usually,
--dep-info
would be used to generate dependency information to be included in a Makefile. However, when using the-c
or--emit-llvm
flags, along with--out-dir
, the generated info doesn't have the correct names for the output files. When-c
is used to compilefoo.rs
, it's output asfoo.o
, and when--emit-llvm
is used, asfoo.bc
. On both cases the dependency info lists the full library name as it would've been output if none of the option were given. For example:Outputs
obj/main.bc
, butobj/main.d
has the following contents:The dependency info should be change to reflect the name of the files actually being output by the compiler for the given command.
EDIT: Realized it also doesn't track any external modules used by the crate as dependencies. (In this case
libcore-2e829c2f-0.0.rlib
andlibextensions-d5bbcef2-0.0.so
.) This might be on purpose, but doesn't seem ideal to me.The text was updated successfully, but these errors were encountered: