Closed shivjm closed 2 years ago
I’ve been experimenting to see if I could implement this, but I don’t think I know enough about linkers or about Nix to proceed.
Fixed in 69dc641ff910f2350480db76d619d2efad318d92
That’s great news, thank you! Is there any way this can work even with proc macro crates? This is the output I get, for example:
rust_async-trait> unpacking sources
rust_async-trait> unpacking source archive /nix/store/gagh6m6s2nrish3rnyvdal4xfd6y7j0r-crate-async-trait-0.1.57.tar.gz
rust_async-trait> source root is async-trait-0.1.57
rust_async-trait> setting SOURCE_DATE_EPOCH to timestamp 1153704088 of file async-trait-0.1.57/tests/ui/unsupported-self.stderr
rust_async-trait> patching sources
rust_async-trait> configuring
rust_async-trait> export OUT_DIR=/nix/store/30ryrbm27b00m0hszsd9l03nj1sih664-rust_async-trait-0.1.57-build/rust-support/out-dir
rust_async-trait> building
rust_async-trait> Building lib: RUSTC 'src/lib.rs' '--out-dir=/nix/store/l5cdqnw8d0fi054g3q571gnsdpagl9q2-rust_async-trait-0.1.57/lib' '--crate-name=async_trait' '--crate-type=proc-macro' '--emit=metadata,link' '-Cextra-filename=-e32805d186f61ce1' '-Copt-level=3' '-Cdebug-assertions=no' '-Coverflow-checks=no' '-Clto=thin' '-Ccodegen-units=1' '--cap-lints=allow' '--color=always' '-Cmetadata=e32805d186f61ce1' '--edition=2018' '--extern=proc_macro' '--extern=proc_macro2=/nix/store/ww3jdgaa70f5ly33853339js0masmz4r-rust_proc-macro2-1.0.43/lib/libproc_macro2-184e1004c4ac269c.rlib' '--extern=quote=/nix/store/q8ilfbznqfgy6dnza70fd8rrr9zvcj4b-rust_quote-1.0.21/lib/libquote-5598a87da415ddfe.rlib' '--extern=syn=/nix/store/4vgjxg6j41g0qw8kqg7w8fdrfwb8cf7f-rust_syn-1.0.99/lib/libsyn-ef320449b0c06c65.rlib' '-Ldependency=/nix/store/8jaycq86y6i17rppd7r4k30papvllijl-rust_async-trait-0.1.57-dev/rust-support/deps-closure'
rust_async-trait> error: lto can only be run for executables, cdylibs and static library outputs
rust_async-trait> error: aborting due to previous error
error: builder for '/nix/store/hg18yyha0lrzjbc4mcfsngqhfyn6da3p-rust_async-trait-0.1.57.drv' failed with exit code 1
Is there any way this can work even with proc macro crates?
Should be fixed in a6681f1aca683a6d190768438fb298e912214e5d.
Also if you run into more problems, please open new issues.
That works. Thank you very much for fixing both things so quickly. And of course, if I have any further issues, I’ll open new… er, issues.
With (thin or fat) LTO enabled in the
release
profile, I immediately get this error:I can see
-Cembed-bitcode=no
is hard-coded:https://github.com/oxalica/nocargo/blob/e3cd8e3396e85966e71f96f93586d64c797f56b9/build-rust-crate/builder-build-script.sh#L44-L51
I’m completely new to Nix; is this required for nocargo to function? Would it be possible to disable that flag or make it optional? Does LTO not make sense in this context?