birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
142 stars 22 forks source link

npm run android failing at `dr.pogodin_react-native-static-server:buildCMakeDebug` #51

Closed qwertynik closed 1 year ago

qwertynik commented 1 year ago

Encountering the below error when running npm run android in the React Native app v0.72, on Windows.

Execution failed for task ':d
r.pogodin_react-native-static-server:buildCMakeDebug

Full details

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dr.pogodin_react-native-static-server:buildCMakeDebug[arm64-v8a][lighttpd]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `D:\ReactNativeProjects\LocalRender\node_modules\@dr.pogodin\react-native-static-server\android\.cxx\Debug\m703zm5e\arm64-v8a'
  [1/1] Linking C shared library ..\..\..\..\build\intermediates\cxx\Debug\m703zm5e\obj\arm64-v8a\liblighttpd.so
  FAILED: ../../../../build/intermediates/cxx/Debug/m703zm5e/obj/arm64-v8a/liblighttpd.so
  cmd.exe /C "cd . && D:\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=aarch64-none-linux-android21 --sysroot=D:/AppData/Local/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -DPCRE2_CODE_UNIT_WIDTH=8 -ID:/ReactNativeProjects/LocalRender/node_modules/@dr.pogodin/react-native-static-server/android/.cxx/Debug/m703zm5e/arm64-v8a/sysroot/include -LD:/ReactNativeProjects/LocalRender/node_modules/@dr.pogodin/react-native-static-server/android/.cxx/Debug/m703zm5e/arm64-v8a/sysroot/lib -pipe -Wall -g -Wshadow -W -pedantic  -g  -fno-limit-debug-info       -O0  -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Qunused-arguments -Wl,--no-undefined  -Wl,--gc-sections      -Wl,-export-dynamic -shared -Wl,-soname,liblighttpd.so -o ..\..\..\..\build\intermediates\cxx\Debug\m703zm5e\obj\arm64-v8a\liblighttpd.so @CMakeFiles\lighttpd.rsp  && cd ."
  ld: error: undefined symbol: glob
  >>> referenced by configfile.c:2375 (D:/ReactNativeProjects/LocalRender/node_modules/@dr.pogodin/react-native-static-server/lighttpd1.4/src\configfile.c:2375)
  >>>               lighttpd1.4/build/CMakeFiles/lighttpd.dir/configfile.c.o:(config_parse_file)

  ld: error: undefined symbol: globfree
  >>> referenced by configfile.c:2381 (D:/ReactNativeProjects/LocalRender/node_modules/@dr.pogodin/react-native-static-server/lighttpd1.4/src\configfile.c:2381)
  >>>               lighttpd1.4/build/CMakeFiles/lighttpd.dir/configfile.c.o:(config_parse_file)
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      @echo off
      "D:\\AppData\\Local\\Android\\Sdk\\cmake\\3.22.1\\bin\\ninja.exe" ^
        -C ^
        "D:\\ReactNativeProjects\\LocalRender\\node_modules\\@dr.pogodin\\react-native-static-server\\android\\.cxx\\Debug\\m703zm5e\\arm64-v8a" ^
        lighttpd
    from D:\ReactNativeProjects\LocalRender\node_modules\@dr.pogodin\react-native-static-server\android

npx react-native info

System:
  OS: Windows 10 10.0.19045
  CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
  Memory: 3.74 GB / 15.77 GB
Binaries:
  Node:
    version: 18.16.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 9.5.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowAllTrustedApps: Disabled
    AllowDevelopmentWithoutDevLicense: Enabled
    Versions:
      - 10.0.17763.0
      - 10.0.19041.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 16.11.31624.102 (Visual Studio Community 2019)
Languages:
  Java: 11.0.18
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.1
    wanted: 0.72.1
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Note: Android SDK and Android Studio are setup in D: drive, due to limited space on C: drive.

Would appreciate your guidance in resolving this same.

birdofpreyru commented 1 year ago

Hey @qwertynik , complaigns about glob sound like you missed to set minSdkVersion to 28 or larger. Also, the last time I tried to build for Android on Windows, it did not work if using RN's New Architecture (see #20 for details).

qwertynik commented 1 year ago

Thanks for your response @birdofpreyru. Had typed in my response, but for some reason didn't send it!

glob sound like you missed to set minSdkVersion to 28

Yes. This was the problem. Nice catch. After resolving this, fixing other self-explanatory issues, the server is up and running.