Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Instant crash on ARM64 (possibly incompatible DLL) #127

Open
jbgski opened this issue Jan 3, 2025 · 2 comments
Open

[Windows] Instant crash on ARM64 (possibly incompatible DLL) #127

jbgski opened this issue Jan 3, 2025 · 2 comments
Labels
P1 High priority issue. Windows

Comments

@jbgski
Copy link

jbgski commented Jan 3, 2025

This is a breaking issue, as it affects all Windows apps with this library right on launch.

Tested configurations

I used a UWP (now legacy) project in React Native Windows and tested it on a native ARM machine (Parallels)

  • React Native v. 0.75 - debug/release mode - instant crash on ARM64
  • React Native v. 0.76 - debug/release mode - instant crash
  • react-native-static-server on v. 0.17.0

More details

Any app using react-native-windows and this library is crashing instantly right after opening on ARM, even if no code related to the server is executed.

After doing a bit of debugging, I found that the crash originates from the LoadLighttpdDll function in Server.cpp. After commenting out the terminate function, Visual Studio reports that the lighttpd1.4 DLL is “not a proper Win32 binary” (or something similar, I don't use VS in English).

These errors do not happen on x64 (haven't tested x86), so I assume the root cause is the .DLL binary not having ARM support, removing the library from my project (or even just commenting out loading the DLLs and the terminate function) makes the project work correctly

I assume the "simplest" fix would be to recompile lighttpd1.4 for ARM64, although I'm not entirely sure how complicated that actually is.

Let me know if you need additional information or steps! Thanks for maintaining this library.

@birdofpreyru birdofpreyru added the P1 High priority issue. label Jan 3, 2025
@birdofpreyru
Copy link
Owner

so I assume the root cause is the .DLL binary not having ARM support

Yeah, I guess, this is the problem. The currently distributed DLL is built for x86_64 architecture.

I assume the "simplest" fix would be to recompile lighttpd1.4 for ARM64, although I'm not entirely sure how complicated that actually is.

Well, to compile it for x86_64 there is a shell script, with brief instructions in the repo: https://github.com/birdofpreyru/react-native-static-server/blob/master/windows/mingw.sh

I don't know, out of my head, what exactly should be changed for ARM64 build, but I guess just some environment variable(s) that specifies the target, different versions of dependencies, and then the same script will work? Also, not sure how to support both architectures? I guess, it will be necessary to build two versions of DLLs, ones for each architecture, and then to modify the loader code to pick up the right one?

@birdofpreyru
Copy link
Owner

Yeah, in that script there is this comment:

# - Check-out the correct code version in the /lighttpd1.4 folder (the master
#   branch of Lighttpd repo does not support MinGW build yet, you need some
#   commit from the win32-exp branch).

I am not 100% sure now, but I believe it is outdated, and master branch should be used now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority issue. Windows
Projects
None yet
Development

No branches or pull requests

2 participants