react-native icon indicating copy to clipboard operation
react-native copied to clipboard

error C3861: 'localtime_r': identifier not found

Open arasrezaei opened this issue 1 year ago • 4 comments

Description

E:\mochol>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1278 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...

> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
E:\mochol\node_modules\react-native-reanimated\android\react-native-reanimated-69-hermes.aar

> Task :ReactAndroid:downloadBoost UP-TO-DATE
Download https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz

> Task :ReactAndroid:downloadDoubleConversion UP-TO-DATE
Download https://github.com/google/double-conversion/archive/v1.1.6.tar.gz

> Task :ReactAndroid:downloadFmt UP-TO-DATE
Download https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz

> Task :ReactAndroid:downloadFolly UP-TO-DATE
Download https://github.com/facebook/folly/archive/v2021.06.28.00.tar.gz

> Task :ReactAndroid:downloadGlog UP-TO-DATE
Download https://github.com/google/glog/archive/v0.3.5.tar.gz

> Task :ReactAndroid:downloadLibevent UP-TO-DATE
Download https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz

> Task :ReactAndroid:hermes-engine:downloadHermes UP-TO-DATE
Download https://github.com/facebook/hermes/tarball/hermes-2022-05-20-RNv0.69.0-ee8941b8874132b8f83e4486b63ed5c19fc3f111
> Task :ReactAndroid:hermes-engine:configureBuildForHermes
-- Found the following ICU libraries:
--   uc (required)
--   i18n (required)
--   uc (required)
-- The following ICU libraries were not found:
--   data (required)
-- Failed to find all ICU components (missing: ICU_INCLUDE_DIR _ICU_REQUIRED_LIBS_FOUND) (Required is at least version "52")
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR)
-- Threads enabled.
-- Doxygen disabled.
-- Go bindings disabled.
-- Could NOT find Python module pygments
-- Could NOT find Python module pygments.lexers.c_cpp
-- Could NOT find Python module yaml
-- CMAKE_HOST_SYSTEM_NAME = Windows
-- CMAKE_SYSTEM_NAME = Windows
-- HERMES_APPLE_TARGET_PLATFORM =
-- CMAKE_CROSSCOMPILING = FALSE

> Task :ReactAndroid:hermes-engine:buildHermes
[  0%] Built target LLVHDemangle to: E:/mochol/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes
[ 25%] Built target LLVHSupport5s]
[ 38%] Built target hermesOptimizerHermes
[ 38%] Built target hermesFrontEndDefs
[ 41%] Building CXX object lib/Platform/Unicode/CMakeFiles/hermesPlatformUnicode.dir/PlatformUnicodeICU.cpp.obj
PlatformUnicodeICU.cpp
E:\mochol\node_modules\react-native\sdks\hermes\lib\Platform\Unicode\PlatformUnicodeICU.cpp(80): error C3861: 'localtime_r': identifier not found

> Task :ReactAndroid:hermes-engine:buildHermes FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
26 actionable tasks: 2 executed, 24 up-to-date
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


Using Windows 10 built-in ICU
Warning: NMake does not support parallel builds. Ignoring parallel build command line option.
NMAKE : fatal error U1077: 'C:\PROGRA~2\MIB055~1\2022\BUILDT~1\VC\Tools\MSVC\1432~1.313\bin\Hostx86\x86\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:hermes-engine:buildHermes'.
> Process 'command 'cmd'' finished with non-zero exit value 2

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 39s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


Using Windows 10 built-in ICU
Warning: NMake does not support parallel builds. Ignoring parallel build command line option.
NMAKE : fatal error U1077: 'C:\PROGRA~2\MIB055~1\2022\BUILDT~1\VC\Tools\MSVC\1432~1.313\bin\Hostx86\x86\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:hermes-engine:buildHermes'.
> Process 'command 'cmd'' finished with non-zero exit value 2

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 39s

    at makeError (E:\mochol\node_modules\execa\index.js:174:9)
    at E:\mochol\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (E:\mochol\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (E:\mochol\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.


### Version

0.69.2

### Output of `npx react-native info`

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 8.12 GB / 15.89 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: Version     2020.3.0.0 AI-203.7717.56.2031.7935034
    Visual Studio: Not Found
  Languages:
    Java: javac 15 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0
    react-native: 0.69.2 => 0.69.2
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Snack, code example, screenshot, or link to a repository

arasrezaei avatar Jul 21 '22 22:07 arasrezaei

Closing as a reproducer is missing + you should fill the issue template. Please do that and feel free to re-open. Thank you.

cortinico avatar Jul 22 '22 15:07 cortinico

:warning: Missing Required Fields
:information_source: It looks like your issue may be missing some necessary information. GitHub provides an example template whenever a new issue is created. Could you go back and make sure to fill out the template? You may edit this issue, or close it and open a new one.

github-actions[bot] avatar Jul 22 '22 15:07 github-actions[bot]

:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

github-actions[bot] avatar Jul 22 '22 15:07 github-actions[bot]

I'm stuck at the same point. Is there an updated solution?

ugurdalkiran avatar Aug 27 '22 15:08 ugurdalkiran

I used Build Tools for Visual Studio 2022 ran the build using the Developer Command Prompt and encountered the same issue. Using CMake 3.18.1 that is installed via the Android SDK Manager.

For some reason _WINDOWS is not defined which caused localtime_r to be used instead of localtime_s.

I set it using SET CL=/D_WINDOWS=1.

justin-tay avatar Sep 01 '22 14:09 justin-tay

I don't know how and where to write. :/

SET CL=/D_WINDOWS=1

ugurdalkiran avatar Sep 01 '22 14:09 ugurdalkiran

It is just to set an environment variable. You can just run it in the command prompt before you build to see if it works.

https://docs.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions?view=msvc-170

justin-tay avatar Sep 02 '22 15:09 justin-tay

image

unfortunately i didn't pass :/

ugurdalkiran avatar Sep 07 '22 20:09 ugurdalkiran

Same error over here :/

deadlinecode avatar Nov 12 '22 22:11 deadlinecode

$env:cl = "/D_WINDOWS=1" works for powershell

fr-an-k avatar Nov 14 '22 04:11 fr-an-k