`deno compile` cross compilation does not work Linux -> Windows
Discussed in https://github.com/denoland/deno/discussions/22685
Originally posted by mabasic March 4, 2024 I'm not opening an issue yet, because I'm typing this on mobile ... here it goes.
I'm using Deno 1.41.1 and when I run deno compile on Linux with target Windows, the command generates a .exe file without issues. But when I copy that file to my windows machine and run it I get a error deno panic something something.
I have tried running it with rust_backtrace="full" but I can't find anything useful in the output. Just a bunch of gibberish.
Things that I have tried:
- deno compile on linux without target (to linux binary) and it works on linux
- deno compile on linux with windows target and it does not work on windows (panics)
-
BUT when I clone the repo to my windows machine and run
deno compilefrom there, it generates a .exe file and the executable works as expected.
This signals to me that the issue is somewhere in the cross compilation, and not in the compilation in general.
I have even reduced the bug in my source code to a specific NPM package: https://github.com/sindresorhus/ink-big-text
When I comment out the import for this package and any related code from my application, the cross compilation works.
Hopefuly, someone will find this info useful. I have tried reading the source code for cli/tools/compile.rs but I can't seem to find anything interesting there, also I'm not a rust programmer yet so maybe that is the issue too 😊
I will try to create a reproduction repository and open a issue in the following week.
@mabasic please provide reproduction commands and the output you get so we can investigate the issue.
@bartlomieju Here is the reproduction repository: https://github.com/govisit/deno-cross-compilation-panic
You will find all the instructions in the README.md file.
I have tested it on Linux and Windows and can recreate the issue every time.
Let me know if I can help somehow.
These are my versions:
Linux:
deno 1.41.2 (release, x86_64-unknown-linux-gnu)
v8 12.1.285.27
typescript 5.3.3
Windows:
deno 1.41.2 (release, x86_64-pc-windows-msvc)
v8 12.1.285.27
typescript 5.3.3
I have just tested and compiling the same program on Windows for Linux, and running on Linux works. So maybe the only direction problematic is Linux -> Windows.
@littledivy please take a look
I've also found this to not work either when trying to compile on Mac (aarch64-apple-darwin), targeting Linux (x86_64-unknown-linux-gnu)