nabijaczleweli / rust-embed-resource

A Cargo build script library to handle compilation and inclusion of Windows resources, in the most resilient fashion imaginable
MIT License
166 stars 29 forks source link

No longer works in library crates #43

Closed leo60228 closed 2 years ago

leo60228 commented 2 years ago

The fix for #42 regresses crates that don't have a binary target:

error: invalid instruction `cargo:rustc-link-arg-bins` from build script of `ui-sys v0.2.1 (https://github.com/rust-native-ui/libui-rs.git?branch=trunk#6ff94425)`
Error: The package ui-sys v0.2.1 (https://github.com/rust-native-ui/libui-rs.git?branch=trunk#6ff94425) does not have a bin target.
Error: The process 'C:\Users\runneradmin\.cargo\bin\cargo.exe' failed with exit code 101
nabijaczleweli commented 2 years ago

Hm. This is what I feared would happen. I've yanked 1.6.6 for the time being and should have a solution later today (but so long as no-one upgraded to 1.7.x without building and still specs =1.6, this should fix it for now); soz!

nabijaczleweli commented 2 years ago

I haven't been able to build the crate to the end due to

  running: "clang++" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "--target=x86_64-pc-windows-gnu" "-I" "libui//common" "-I" "libui//windows" "-Wall" "-Wextra" "-o" "T:\\libui-rs\\target\\debug\\build\\ui-sys-de9fe2796c2cc100\\out\\libui/windows/areadraw.o" "-c" "libui/windows/areadraw.cpp"
  cargo:warning=libui/windows/areadraw.cpp:81:7: error: case value evaluates to 2291728396, which cannot be narrowed to type 'HRESULT' (aka 'long') [-Wc++11-narrowing]
  cargo:warning=        case D2DERR_RECREATE_TARGET:
  cargo:warning=             ^
  cargo:warning=d:/Programy/Programowanie/msys2/mingw64/x86_64-w64-mingw32/include/d2derr.h:30:33: note: expanded from macro 'D2DERR_RECREATE_TARGET'
  cargo:warning=#define D2DERR_RECREATE_TARGET   0x8899000C
  cargo:warning=                                 ^
  cargo:warning=libui/windows/areadraw.cpp:108:61: warning: unused parameter 'lParam' [-Wunused-parameter]
  cargo:warning=BOOL areaDoDraw(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
  cargo:warning=                                                            ^
  cargo:warning=1 warning and 1 error generated.
  exit code: 1

but by inserting a panic at the right time I've proved well enough, for me, that it works as-expected now – i.e. links to library iff there are no binaries. If you could validate this by trying on your machine that accepts the aforementioned error and goes to completion by pointing it at the master branch (at least b39869d15e9fc3283a26c4b6ddbb1a7db083bad8), I'll release this as 1.7.1, yank 1.7.0 and backport to 1.6.7.

leo60228 commented 2 years ago

Yep, it works!

nabijaczleweli commented 2 years ago

Ace; released in v1.7.1, backported to v1.6.7, v1.7.0 yanked.