Skip to content

Commit 0d487fa

Browse files
committed
Build fixes for Windows
1 parent 5a388c1 commit 0d487fa

File tree

8 files changed

+19
-7
lines changed

8 files changed

+19
-7
lines changed

CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android|Windows")
100100
set(BUILD_SHARED_LIBS 1)
101101
endif()
102102

103-
# These enforce pkg_check_modules(), find_program(), etc. in Lighttpd CMake
104-
# config to look for local build of PCRE2 in the location it was installed to.
105-
set(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/sysroot")
106-
107-
# TODO: Not sure now, whether this is needed, or already covered by the variable
108-
# above.
109-
set(CMAKE_FIND_ROOT_PATH "${CMAKE_BINARY_DIR}/sysroot")
103+
# Above we have build & installed a local version of PCRE2 library, now we want
104+
# to enforce Lighttpd build to see and use it (rather than any system-wide
105+
# installation of another PCRE2 version). On Ubuntu / macOS it can be done
106+
# by setting
107+
#
108+
# set(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/sysroot")
109+
#
110+
# however when building for Windows inside Msys2 / UCRT64 this just has
111+
# no effect for reasons beyond my understanding. Setting PKG_CONFIG_PATH
112+
# environment variable to the folder with PCRE2 .pc file works though.
113+
set(ENV{PKG_CONFIG_PATH} "${CMAKE_BINARY_DIR}/sysroot/lib/pkgconfig")
110114

111115
add_subdirectory(lighttpd1.4)
112116

windows/ReactNativeStaticServer/Server.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ void LoadLighttpdDll() {
3535
// an UWP app by this library, so failure to locate and load them is
3636
// a fatal crash, meaning there is something wrong with our library,
3737
// and we terminate the app in such case.
38+
//
39+
// NOTE: The next few lines retrieve the failure cause, but don't forward it anywhere,
40+
// for now they can be seen in debugger.
41+
DWORD errcode = GetLastError();
42+
LPSTR errmsg = nullptr;
43+
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
44+
NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)& errmsg, 0, NULL);
45+
3846
terminate();
3947
}
4048
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)