# The reason why 'shards install' for webview fails under my windows 11 installation

**URL:** <https://forum.crystal-lang.org/t/the-reason-why-shards-install-for-webview-fails-under-my-windows-11-installation/5394>\
**Category:** Help & Support\
**Created:** [February 17, 2023, 9:42am UTC](https://forum.crystal-lang.org/t/the-reason-why-shards-install-for-webview-fails-under-my-windows-11-installation/5394 "2023-02-17T09:42:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![serge-hulne](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/serge-hulne/32/1211_2.png) [@serge-hulne](https://forum.crystal-lang.org/u/serge-hulne)\
**Post date:** [February 17, 2023, 9:42am UTC](https://forum.crystal-lang.org/t/the-reason-why-shards-install-for-webview-fails-under-my-windows-11-installation/5394/1 "2023-02-17T09:42:13Z")

</div>

I explained it at:

> <https://github.com/naqvis/webview/issues/20>
>
> \`\`\`
> Installing webview (0.2.1)
> Postinstall of webview: make
> Failed postinstal…l of webview on make:
> make\[1\]: Entering directory 'C:/Users/serge/Documents/vue-tests/vue-tests-nomodules/crystapp/lib/webview'
> g++ -c -o ext/webview.o -std=c++11 ext/webview.cc
> make\[1\]: Leaving directory 'C:/Users/serge/Documents/vue-tests/vue-tests-nomodules/crystapp/lib/webview'
> In file included from ext/webview.cc:2:
> ext/webview.h:1047:10: fatal error: WebView2.h: No such file or directory
> 1047 | #include "WebView2.h"
> | ^ ~~~~~~~~~~~
> compilation terminated.
> make\[1\]: \*\*\* \[Makefile:23: ext/webview.o\] Error 1
> make: \*\*\* \[makefile:6: init\] Error 1
> \`\`\`

I wonder if I have missed a step in the installation of the prerequisites ?

Here is a copy of the ticket:

I guess, in order to use ` @[Link("webview")]` ( rather than `@[Link(ldflags: "#{ __DIR__ }/webview.lib")] `), webview.lib is supposed to be installed in some standard locations for libraries under Windows 10 or 11 (the equivalent of /usr/local/lib under Linux).

However, in my case, running the install.bat script from [webview/script at master · webview/webview · GitHub](https://github.com/webview/webview/tree/master/script) did build said library webview.lib locally, but did apparently not copy it to a (standard) location which would be accessible by default to Crystal via a simple @[Link(“webview”)] , this is basically why the `shards install` fails and why I had to resort to the alternative : `@[Link(ldflags: "#{ __DIR__ }/webview.lib")]` for Crystal to be able to access Webview (see : [Crystal App with Webview for dummies (template)](https://forum.crystal-lang.org/t/crystal-app-with-webview-for-dummies-template/5391)).

---

<div class="post-metadata">

**Author:** ![npn](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@npn](https://forum.crystal-lang.org/u/npn)\
**Post date:** [February 17, 2023, 3:09pm UTC](https://forum.crystal-lang.org/t/the-reason-why-shards-install-for-webview-fails-under-my-windows-11-installation/5394/2 "2023-02-17T15:09:40Z")

</div>

> I guess, in order to use ` @[Link("webview")]` ( rather than `@[Link(ldflags: "#{ __DIR__ }/webview.lib")] `), webview.lib is supposed to be installed in some standard locations for libraries under Windows 10 or 11 (the equivalent of /usr/local/lib under Linux).

you need to locate which folder crystal is using for the shared library files using `crystal env CRYSTAL_LIBRARY_PATH`. you can put your `.lib` file there.  
personally I think relative path works, too, because you only need it for compiling.

---

<div class="post-metadata">

**Author:** ![serge-hulne](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/serge-hulne/32/1211_2.png) [@serge-hulne](https://forum.crystal-lang.org/u/serge-hulne)\
**Post date:** [February 17, 2023, 3:20pm UTC](https://forum.crystal-lang.org/t/the-reason-why-shards-install-for-webview-fails-under-my-windows-11-installation/5394/3 "2023-02-17T15:20:35Z")

</div>

Thank you I’ll try.

---

<div class="post-metadata">

**Author:** ![konovod](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/konovod/32/229_2.png) [@konovod](https://forum.crystal-lang.org/u/konovod)\
**Post date:** [February 17, 2023, 9:20pm UTC](https://forum.crystal-lang.org/t/the-reason-why-shards-install-for-webview-fails-under-my-windows-11-installation/5394/4 "2023-02-17T21:20:49Z")

</div>

You are right, `@[Link("webview")]` works if you copy `lib` file, that’s why i added `copy webview\dll\x64\webview.lib to <your crystal installation>\lib` in installation steps ([webview/README.md at master · naqvis/webview · GitHub](https://github.com/naqvis/webview/blob/master/README.md))  
The trick with `@[Link(ldflags: "#{ __DIR__ }/webview.lib")]` is nice though, i didn’t know about it. I’m still not sure which way is better. Currently i just copy all `.lib` that i generate to `crystal\lib`.

I think that ideal way is to don’t use `lib` files at all - they don’t carry any info that isn’t present in `.dll`, so they are just additional burden. Under linux, crystal links with `.so` without additional files, that’s why i believe that it should do the same on Windows.

---

<div class="post-metadata">

**Author:** ![serge-hulne](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/serge-hulne/32/1211_2.png) [@serge-hulne](https://forum.crystal-lang.org/u/serge-hulne)\
**Post date:** [February 17, 2023, 10:33pm UTC](https://forum.crystal-lang.org/t/the-reason-why-shards-install-for-webview-fails-under-my-windows-11-installation/5394/5 "2023-02-17T22:33:10Z")

</div>

Apparently in Go, it is now possible to do exactly that : bind Go code to DLLs using Purego : [purego package - github.com/ebitengine/purego - Go Packages](https://pkg.go.dev/github.com/ebitengine/purego) (bypassing the necessity to separately use a .lib archive for development and a .DLL file for distribution). I don’t know if the same is possible at this stage in Crystal.
