servo / webrender

A GPU-based renderer for the web
https://doc.servo.org/webrender/
Mozilla Public License 2.0
3.12k stars 276 forks source link

error when build build staticlib #3688

Open patrickkh7788 opened 5 years ago

patrickkh7788 commented 5 years ago

I try build a static lib file libwebrender.a to be used with cpp project with RUSTFLAGS="--crate-type=staticlib" cargo build --release --lib

   Compiling unicode-xid v0.1.0
   Compiling nodrop v0.1.12
   Compiling cfg-if v0.1.3
   Compiling memoffset v0.2.1
   Compiling lazy_static v1.0.0
   Compiling scopeguard v0.3.3
   Compiling byte-tools v0.3.0
   Compiling khronos_api v3.1.0
error: `#[panic_handler]` function required, but not found

error: `#[panic_handler]` function required, but not found

error: `#[panic_handler]` function required, but not found

error: aborting due to previous error

error: aborting due to previous error

error: `#[panic_handler]` function required, but not found
error: `#[panic_handler]` function required, but not found

error: language item required, but not found: `eh_personality`

error: Could not compile `cfg-if`.
warning: build failed, waiting for other jobs to finish...
error: Could not compile `memoffset`.
warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error

error: Could not compile `nodrop`.
warning: build failed, waiting for other jobs to finish...
error: `#[panic_handler]` function required, but not found

error: language item required, but not found: `eh_personality`

error: aborting due to 2 previous errors

error: Could not compile `byte-tools`.
warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error

error: aborting due to 2 previous errors

error: Could not compile `scopeguard`.
warning: build failed, waiting for other jobs to finish...
error: Could not compile `unicode-xid`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Is this the correct way to build static lib ?

is there a c/cpp header file for the rust api to be used for cpp project?

kvark commented 5 years ago

You'd want to look at webrender_bindings, which is the Gecko wrapper around WR that exposes a C API. Gecko build system then runs cbindgen on it in order to obtain the C header.