gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.36k stars 546 forks source link

gfx_backend_gl and metal: can't find create #3746

Open str0yd opened 3 years ago

str0yd commented 3 years ago

Short info header:

I just cloed the hal-0.8 branch but i can't compile the project with the gl or metal backend. Vulkan and dx12 work without problems.

cargo run --bin quad --features=metal --verbose

...

 Compiling hal-examples v0.1.0 (C:\Users\woppe\Documents\Rust\gfx\examples)
     Running `rustc --crate-name quad --edition=2018 examples\quad/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C 
debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"gfx-backend-metal\"" --cfg "feature=\"metal\"" -C metadata=f4746ad78445d47e --out-dir C:\Users\woppe\Documents\Rust\gfx\target\debug\deps -C incremental=C:\Users\woppe\Documents\Rust\gfx\target\debug\incremental -L dependency=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps --extern env_logger=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libenv_logger-8093f0d2061d370e.rlib --extern auxil=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_auxil-e01f05fbe3fa2e9e.rlib --extern gfx_backend_empty=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_backend_empty-9a2421f8c1e1762b.rlib --extern hal=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_hal-dbb4ed462378e6d2.rlib --extern glsl_to_spirv=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libglsl_to_spirv-594eb747adb46adf.rlib --extern image=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libimage-39ea8928c1c74296.rlib --extern log=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\liblog-63efc7b73bb752d4.rlib --extern winit=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libwinit-bd2eed038f4d40eb.rlib -L native=C:\Users\woppe\Documents\Rust\gfx\target\debug\build\spirv_cross-20e5095eddfd2691\out`
error[E0463]: can't find crate for `gfx_backend_metal`
  --> examples\quad/main.rs:16:1
   |
16 | extern crate gfx_backend_metal as back;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

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

Caused by:
  process didn't exit successfully: `rustc --crate-name quad --edition=2018 examples\quad/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link 
-C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"gfx-backend-metal\"" --cfg "feature=\"metal\"" -C metadata=f4746ad78445d47e --out-dir C:\Users\woppe\Documents\Rust\gfx\target\debug\deps -C incremental=C:\Users\woppe\Documents\Rust\gfx\target\debug\incremental -L dependency=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps --extern env_logger=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libenv_logger-8093f0d2061d370e.rlib --extern auxil=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_auxil-e01f05fbe3fa2e9e.rlib --extern gfx_backend_empty=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_backend_empty-9a2421f8c1e1762b.rlib --extern hal=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_hal-dbb4ed462378e6d2.rlib --extern glsl_to_spirv=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libglsl_to_spirv-594eb747adb46adf.rlib --extern image=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libimage-39ea8928c1c74296.rlib --extern log=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\liblog-63efc7b73bb752d4.rlib --extern winit=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libwinit-bd2eed038f4d40eb.rlib -L native=C:\Users\woppe\Documents\Rust\gfx\target\debug\build\spirv_cross-20e5095eddfd2691\out` (exit code: 1)
cargo run --bin quad --features=gl --verbose 

...

Compiling hal-examples v0.1.0 (C:\Users\woppe\Documents\Rust\gfx\examples)
     Running `rustc --crate-name quad --edition=2018 examples\quad/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C 
debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"gfx-backend-gl\"" --cfg "feature=\"gl\"" -C metadata=f4746ad78445d47e --out-dir C:\Users\woppe\Documents\Rust\gfx\target\debug\deps -C incremental=C:\Users\woppe\Documents\Rust\gfx\target\debug\incremental -L dependency=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps --extern env_logger=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libenv_logger-8093f0d2061d370e.rlib --extern auxil=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_auxil-7e99373e38da53e7.rlib --extern gfx_backend_empty=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_backend_empty-4045f1e1c2eb80ab.rlib --extern hal=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_hal-43eeb2f3535dda60.rlib --extern glsl_to_spirv=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libglsl_to_spirv-594eb747adb46adf.rlib --extern image=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libimage-39ea8928c1c74296.rlib --extern log=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\liblog-63efc7b73bb752d4.rlib --extern winit=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libwinit-bd2eed038f4d40eb.rlib -L native=C:\Users\woppe\Documents\Rust\gfx\target\debug\build\spirv_cross-6c122e85c970c048\out`
error[E0463]: can't find crate for `gfx_backend_gl`
  --> examples\quad/main.rs:14:1
   |
14 | extern crate gfx_backend_gl as back;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

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

Caused by:
  process didn't exit successfully: `rustc --crate-name quad --edition=2018 examples\quad/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link 
-C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"gfx-backend-gl\"" --cfg "feature=\"gl\"" -C metadata=f4746ad78445d47e --out-dir C:\Users\woppe\Documents\Rust\gfx\target\debug\deps -C incremental=C:\Users\woppe\Documents\Rust\gfx\target\debug\incremental -L dependency=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps --extern env_logger=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libenv_logger-8093f0d2061d370e.rlib --extern auxil=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_auxil-7e99373e38da53e7.rlib --extern gfx_backend_empty=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_backend_empty-4045f1e1c2eb80ab.rlib --extern hal=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libgfx_hal-43eeb2f3535dda60.rlib --extern glsl_to_spirv=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libglsl_to_spirv-594eb747adb46adf.rlib --extern image=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libimage-39ea8928c1c74296.rlib --extern log=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\liblog-63efc7b73bb752d4.rlib --extern winit=C:\Users\woppe\Documents\Rust\gfx\target\debug\deps\libwinit-bd2eed038f4d40eb.rlib -L native=C:\Users\woppe\Documents\Rust\gfx\target\debug\build\spirv_cross-6c122e85c970c048\out` (exit code: 1)
kvark commented 3 years ago

Each backend is available only on selected platforms. Metal backend - only when building for macOS/iOS. OpenGL backend - only when building for Linux. Closing this, but please feel free to continue discussion (or jump to #gfx:matrix.org)

str0yd commented 3 years ago

Thanks for the information, could not find it anywhere else. Maybe you should state this somewhere in the examples section.

kvark commented 3 years ago

I agree it would be good to add some better error message if you attempted to build examples with a feature that's not available on your platform. Or at least in https://github.com/gfx-rs/gfx/tree/master/examples.