Skip to content

"cant find crate std" error when trying to build DLL #330

@fschutt

Description

@fschutt

I'm trying to remove any panic!() macros from my build to see how much the resulting size of the binary is affected.

cargo install xargo
rustup component add rust-src
git clone https://github.com/fschutt/azul
cd azul/azul-dll
xargo clean
xargo build --release xargo build --release --target x86_64-unknown-linux-gnu

gives:

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /home/felix/Development/azul/azul-dll/Cargo.toml
workspace: /home/felix/Development/azul/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /home/felix/Development/azul/azulc/Cargo.toml
workspace: /home/felix/Development/azul/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /home/felix/Development/azul/azul-dll/Cargo.toml
workspace: /home/felix/Development/azul/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /home/felix/Development/azul/azulc/Cargo.toml
workspace: /home/felix/Development/azul/Cargo.toml
warning: output filename collision.
The lib target `azul` in package `azul-dll v0.0.1 (/home/felix/Development/azul/azul-dll)` has the same output filename as the lib target `azul` in package `azul v1.0.0-beta1 (/home/felix/Development/azul/api/rust)`.
Colliding filename is: /home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/libazul.rlib
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
   Compiling autocfg v1.1.0
   Compiling libc v0.2.117
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.86
   Compiling cfg-if v1.0.0
   Compiling lazy_static v1.4.0
   Compiling serde_derive v1.0.136
   Compiling crossbeam-utils v0.8.7
   Compiling log v0.4.14
error[E0463]: can't find crate for `std`
 --> /home/felix/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:9:1
  |
9 | extern crate std;
  | ^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `lazy_static`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

verbose build:

+ "rustc" "--print" "sysroot"
+ RUSTFLAGS="--sysroot /home/felix/.xargo/HOST"
+ "cargo" "build" "--release" "--verbose" "--target" "x86_64-unknown-linux-gnu"
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /home/felix/Development/azul/azul-dll/Cargo.toml
workspace: /home/felix/Development/azul/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /home/felix/Development/azul/azulc/Cargo.toml
workspace: /home/felix/Development/azul/Cargo.toml
warning: output filename collision.
The lib target `azul` in package `azul-dll v0.0.1 (/home/felix/Development/azul/azul-dll)` has the same output filename as the lib target `azul` in package `azul v1.0.0-beta1 (/home/felix/Development/azul/api/rust)`.
Colliding filename is: /home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/libazul.rlib
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
       Fresh autocfg v1.1.0
       Fresh unicode-xid v0.2.2
   Compiling lazy_static v1.4.0
   Compiling serde v1.0.136
   Compiling crc32fast v1.3.2
     Running `rustc --crate-name lazy_static /home/felix/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=z -C panic=abort -C embed-bitcode=no -C codegen-units=16 -C metadata=cbcf0a382251c772 -C extra-filename=-cbcf0a382251c772 --out-dir /home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/felix/Development/azul/target/release/deps --cap-lints allow --sysroot /home/felix/.xargo/HOST`
     Running `rustc --crate-name build_script_build /home/felix/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.136/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="rc"' --cfg 'feature="serde_derive"' --cfg 'feature="std"' -C metadata=c352340d54173480 -C extra-filename=-c352340d54173480 --out-dir /home/felix/Development/azul/target/release/build/serde-c352340d54173480 -L dependency=/home/felix/Development/azul/target/release/deps --cap-lints allow`
   Compiling byteorder v1.4.3
     Running `rustc --crate-name build_script_build /home/felix/.cargo/registry/src/github.com-1ecc6299db9ec823/crc32fast-1.3.2/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=39a6adb869985925 -C extra-filename=-39a6adb869985925 --out-dir /home/felix/Development/azul/target/release/build/crc32fast-39a6adb869985925 -L dependency=/home/felix/Development/azul/target/release/deps --cap-lints allow`
     Running `rustc --crate-name byteorder --edition=2018 /home/felix/.cargo/registry/src/github.com-1ecc6299db9ec823/byteorder-1.4.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=z -C panic=abort -C embed-bitcode=no -C codegen-units=16 --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=e5620588a900a310 -C extra-filename=-e5620588a900a310 --out-dir /home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/felix/Development/azul/target/release/deps --cap-lints allow --sysroot /home/felix/.xargo/HOST`
error[E0463]: can't find crate for `std`
 --> /home/felix/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:9:1
  |
9 | extern crate std;
  | ^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `lazy_static`

Caused by:
  process didn't exit successfully: `rustc --crate-name lazy_static /home/felix/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=z -C panic=abort -C embed-bitcode=no -C codegen-units=16 -C metadata=cbcf0a382251c772 -C extra-filename=-cbcf0a382251c772 --out-dir /home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/felix/Development/azul/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/felix/Development/azul/target/release/deps --cap-lints allow --sysroot /home/felix/.xargo/HOST` (exit status: 1)
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: build failed

I want to use a custom std with panic!() macros replaced by abort():

[dependencies]
std = { default-features=false, features=["panic_immediate_abort"] }
core = { default-features=false, features=["panic_immediate_abort"] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions