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
173 stars 29 forks source link

Example on README does not seem to work #57

Closed TomzBench closed 1 year ago

TomzBench commented 1 year ago

Hello,

I followed the example in the readme (to include a manifest) and i get the error:

error RC2135 : file not found : "APP-NAME.EXE.MANIFEST"

searching around the issues, i then tried to copy the app-name.exe.manifest to my OUT_DIR but still no luck. is there something i am missing?

NOTE - that i am in a cargo workspace. Im unsure if that is screwing things up?

TomzBench commented 1 year ago

I pulled my files out of the workspace and still doesn't seem to work for me

nabijaczleweli commented 1 year ago

Tarball to repro?

TomzBench commented 1 year ago

I posted a repo git@github.com:TomzBench/embed_resource_issue_57.git and you can clone and see if it works for you.

Below is the logs from me. (im using rustc 1.69 stable)

❯❯ embed_resource_issue_57 git:(master)                                                                                                                                                                                          2 minutes ago
 cargo build
    Updating crates.io index
   Compiling serde v1.0.162
   Compiling autocfg v1.1.0
   Compiling cc v1.0.79
   Compiling libc v0.2.142
   Compiling hashbrown v0.12.3
   Compiling semver v1.0.17
   Compiling winapi v0.3.9
   Compiling winnow v0.4.6
   Compiling indexmap v1.9.3
   Compiling cfg-if v1.0.0
   Compiling winsafe v0.0.15
   Compiling rustc_version v0.4.0
   Compiling vswhom-sys v0.1.2
   Compiling vswhom v0.1.0
   Compiling winreg v0.11.0
   Compiling toml_datetime v0.6.1
   Compiling serde_spanned v0.6.1
   Compiling toml v0.5.11
   Compiling toml_edit v0.19.8
   Compiling winres v0.1.12
   Compiling toml v0.7.3
   Compiling embed-resource v2.1.1
   Compiling foo v0.1.0 (C:\Users\thomas\Git\embed_resource_issue_57)
error: failed to run custom build command for `foo v0.1.0 (C:\Users\thomas\Git\embed_resource_issue_57)`

Caused by:
  process didn't exit successfully: `C:\Users\thomas\Git\embed_resource_issue_57\target\debug\build\foo-a148342ea512e434\build-script-build` (exit code: 101)
  --- stdout
  Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
  Copyright (C) Microsoft Corporation.  All rights reserved.

  cargo:rustc-link-arg-bins=C:\Users\thomas\Git\embed_resource_issue_57\target\debug\build\foo-d3f0a338b9bd8a65\out/atxlogo.lib
  Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
  Copyright (C) Microsoft Corporation.  All rights reserved.

  foo-manifest.rc(3) : error RC2135 : file not found: "FOO.EXE.MANIFEST"

  --- stderr
  Final verdict: crate has binaries: true
  thread 'main' panicked at 'RC.EXE failed to compile specified resource file', C:\Users\thomas\.cargo\registry\src\index.crates.io-6f17d22bba15001f\embed-resource-2.1.1\src\windows_msvc.rs:39:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
nabijaczleweli commented 1 year ago

under stable-x86_64-pc-windows-gnu cargo 1.68.2 (6feb7c9cf 2023-03-26) applying this patch (which, notably, brings this in line to what the README specs) makes it build:

diff --git a/build.rs b/build.rs
index 0b36404..a936ba5 100644
--- a/build.rs
+++ b/build.rs
@@ -1,4 +1,3 @@
 fn main() {
-    embed_resource::compile("resources/atxlogo.ico", embed_resource::NONE);
     embed_resource::compile("foo-manifest.rc", embed_resource::NONE);
 }
diff --git a/foo-manifest.rc b/foo-manifest.rc
index d9d7bdc..75d7faa 100644
--- a/foo-manifest.rc
+++ b/foo-manifest.rc
@@ -1,2 +1,2 @@
 #define RT_MANIFEST 24
-RT_MANIFEST "foo.exe.manifest"
+1 RT_MANIFEST "foo.exe.manifest"

apply this and try again. Then there's a potential issue.

TomzBench commented 1 year ago

Sorry about that,

The 1 in the rc file seemed invisible to me, i think i saw it as a line number or something, which doesn't make sense but I completely missed it.

Thanks for fixing for me