raphlinus / font-rs

Apache License 2.0
756 stars 49 forks source link

Binary? #38

Open baerbock opened 5 years ago

baerbock commented 5 years ago

What should I do with the output of cargo build --release? I only get a libfont_rs.rlib

kpp commented 5 years ago

font-rs is not a binary crate, it's a library. Use cargo build --release --examples to build all examples or --example draw_shape or --example render to build only specific examples.

baerbock commented 5 years ago

Thanks for your answer.

I will have to learn more about Rust, since for me ./render fails with thread 'main' panicked at 'calledOption::unwrap()on aNonevalue', libcore/option.rs:355:21

kpp commented 5 years ago

You don't need to build with --release. Please provide the output of:

$ RUST_BACKTRACE=1 cargo run --example render
ArniDagur commented 5 years ago

I get the following output:

[arni@arni-pc][~/OpenSource/font-rs]% RUST_BACKTRACE=1 cargo run --example render
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/examples/render`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:345:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:381
   6: rust_begin_unwind
             at src/libstd/panicking.rs:308
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   8: core::panicking::panic
             at src/libcore/panicking.rs:49
   9: <core::option::Option<T>>::unwrap
             at /rustc/2a65cbeea78c2c79b1030a0012cdea475104a44f/src/libcore/macros.rs:10
  10: render::main
             at examples/render.rs:33
  11: std::rt::lang_start::{{closure}}
             at /rustc/2a65cbeea78c2c79b1030a0012cdea475104a44f/src/libstd/rt.rs:64
  12: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:293
  13: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  14: std::rt::lang_start_internal
             at src/libstd/panicking.rs:272
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  15: std::rt::lang_start
             at /rustc/2a65cbeea78c2c79b1030a0012cdea475104a44f/src/libstd/rt.rs:64
  16: main
  17: __libc_start_main
  18: _start
kpp commented 5 years ago

Error:

  10: render::main
             at examples/render.rs:33

Code:

30: fn main() {
31:     let mut args = std::env::args();
32:     let _ = args.next();
33:     let filename = args.next().unwrap();
34:     let glyph_id: u16 = args.next().unwrap().parse().unwrap();
35:     let out_filename = args.next().unwrap();

You have to pass args to run the example =)