Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

building for windows with dependencies #1535

Answered by Emilgardis
skadefro asked this question in Q&A
Discussion options

I'm sorry if this is a basic easy question, but I've been fighting with this for 3 days and I just cannot figure out how to do this ( it feels like it's not a "cross" problem, but a "understanding cargo build" problem, but ....

I have a project in rust, I have setup a build script that compiles for 10 different targets (linux, macos, windows)
It works perfect ( thank you so much for this project !!! it's a life saver )

But now i need to use napi-rs ... that works fine on all targets except windows. ( if i go to a windows machine with nodejs and visual studio installed rust compiles without any issues ) But with cross, it fails with

 = note: x86_64-w64-mingw32-gcc-posix: error: delayimp.lib: No such file or directory
 x86_64-w64-mingw32-gcc-posix: error: /DELAYLOAD:node.exe: No such file or directory

I assumed i need to find those files and "map" them into cross by adding a

[build.env]
volumes = [ ]

section but from here I'm lost ... I tried extracting a windows nodejs installation and the folder containing delayimp.lib from a windows machine with visual studio installed, but it's like rust does not find them.

I guess my question is.
If we have dependencies, we can easily add those using something like

[build]
pre-build = [
 "apt-get update && apt-get install --assume-yes protobuf-compiler"
]

but this only works for linux. Is there a way to easily add things to the wine installation, when building for windows ?
How do we add dependencies for/on windows ?
Has anyone else tried making cross work with the napi-build/napi crates on windows ?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Try using their alpha release which includes napi-rs/napi-rs#2026

You must be logged in to vote
1 reply
Comment options

oh my god, i feel stupid.
So i had already tested using the alpha , but i was using napi-build = "1" ... as soon as i "bumped" that up to napi-build = "2.1.3" it started working on all my targets.

Answer selected by skadefro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /