DelSkayn / rquickjs

High level bindings to the quickjs javascript engine
MIT License
434 stars 59 forks source link

No support for target aarch64-pc-windows-msvc #143

Open pcarrier opened 1 year ago

pcarrier commented 1 year ago

Support for this target would be great.

error: couldn't read C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\rquickjs-sys-0.1.7\src\bindings/aarch64-pc-windows-msvc.rs: The system cannot find the file specified. (os error 2)
  --> C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\rquickjs-sys-0.1.7\src\lib.rs:14:1
   |
14 | include!(concat!("bindings/", bindings_env!("TARGET"), ".rs"));
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `rquickjs-sys` due to previous error
warning: build failed, waiting for other jobs to finish...
DelSkayn commented 1 year ago

We don't have pre-generated bindings for that target. Have you tried the bindgen feature? This will generate bindings for targets we didn't include.

pcarrier commented 1 year ago

Thanks for the prompt response! Now running into:

error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.35.32215\\bin\\HostX64\\arm64\\link.exe" "/NOLOGO" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcTYrs31\\symbols.o" "D:\\a\\nur\\nur\\target\\aarch64-pc-windows-msvc\\release\\deps\\nur.nur.158795f2-cgu.0.rcgu.o" "/LIBPATH:D:\\a\\nur\\nur\\target\\aarch64-pc-windows-msvc\\release\\deps" "/LIBPATH:D:\\a\\nur\\nur\\target\\release\\deps" "/LIBPATH:C:\\Users\\runneradmin\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\windows_aarch64_msvc-0.48.0\\lib" "/LIBPATH:C:\\Users\\runneradmin\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\windows_aarch64_msvc-0.42.2\\lib" "/LIBPATH:C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.35.32215\\atlmfc\\lib\\arm64" "/LIBPATH:D:\\a\\nur\\nur\\target\\aarch64-pc-windows-msvc\\release\\build\\libmimalloc-sys-485c41d22fa62d5e\\out" "/LIBPATH:C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.35.32215\\atlmfc\\lib\\arm64" "/LIBPATH:D:\\a\\nur\\nur\\target\\aarch64-pc-windows-msvc\\release\\build\\rquickjs-sys-605acff70bfb7a22\\out" "/LIBPATH:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-pc-windows-msvc\\lib" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcTYrs31\\liblibmimalloc_sys-e23a8661ce771aae.rlib" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcTYrs31\\librquickjs_sys-74a859cdf4d7cddc.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-pc-windows-msvc\\lib\\libcompiler_builtins-ddc388fd2c739db9.rlib" "legacy_stdio_definitions.lib" "bcrypt.lib" "advapi32.lib" "windows.lib" "ntdll.lib" "windows.lib" "advapi32.lib" "cfgmgr32.lib" "fwpuclnt.lib" "gdi32.lib" "kernel32.lib" "msimg32.lib" "ntdll.lib" "user32.lib" "winspool.lib" "ws2_32.lib" "windows.0.48.0.lib" "kernel32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "msvcrt.lib" "legacy_stdio_definitions.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-pc-windows-msvc\\lib" "/OUT:D:\\a\\nur\\nur\\target\\aarch64-pc-windows-msvc\\release\\deps\\nur.exe" "/OPT:REF,ICF" "/DEBUG:NONE"
  = note: librquickjs_sys-74a859cdf4d7cddc.rlib(7e79597c36cc6b43-quickjs.o) : error LNK2019: unresolved external symbol alloca referenced in function JS_CallInternal
          librquickjs_sys-74a859cdf4d7cddc.rlib(7e79597c36cc6b43-libregexp.o) : error LNK2001: unresolved external symbol alloca
          D:\a\nur\nur\target\aarch64-pc-windows-msvc\release\deps\nur.exe : fatal error LNK1120: 1 unresolved externals
DelSkayn commented 1 year ago

Hmm, Official documentation says that alloca function is called _alloca in the msvc c runtime. Weird, we have windows included in our CI but those test compile just fine using alloca.

Support for windows is somewhat unstable as quickjs officially doesn't support it. Rquickjs only supports it via patches.

I have created the msvc_fix branch with a possible fix. I myself don't have access to an aarch64-pc-windows-msvc platform, so if you could try to build the msvc_fix branch I would appreciate it!

pcarrier commented 1 year ago

@DelSkayn I don't either, other than GitHub Actions. Should be reasonably easy to set up: https://github.com/pcarrier/nur/blob/main/.github/workflows/build.yaml#L30C1-L49

It's a link-time issue, so not sure if building rquickjs itself would spot it?

MystiPanda commented 6 months ago

I just tried to use the bindgen feature in GitHub Actions for cross-compiling and encountered the same problem. What else can I try to solve this problem?

mehulmathur001 commented 1 month ago

@MystiPanda @pcarrier @DelSkayn Were you able to fix this issue ?