serenity-kit/react-native-libsodium

Can't compile empty RN project with v1.1.0 for Android

limpbrains opened this issue · 1 comments

Steps to reproduce:

npx react-native@latest init libsodium
cd libsodium
yarn add react-native-libsodium
npx react-native run-android

I'm on macos / m1

Error message:

> Task :react-native-libsodium:configureCMakeDebug[arm64-v8a] FAILED
C/C++: CMake Warning (dev) in CMakeLists.txt:
C/C++:   No project() command is present.  The top-level CMakeLists.txt file must
C/C++:   contain a literal, direct call to the project() command.  Add a line of
C/C++:   code such as
C/C++:     project(ProjectName)
C/C++:   near the top of the file, but after cmake_minimum_required().
C/C++:   CMake is pretending there is a "project(Project)" command on the first
C/C++:   line.
C/C++: This warning is for project developers.  Use -Wno-dev to suppress it.
C/C++: CMake Error at CMakeLists.txt:34 (add_library):
C/C++:   Cannot find source file:
C/C++:     ../node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp
C/C++:   Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
C/C++:   .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
C/C++: CMake Error at CMakeLists.txt:34 (add_library):
C/C++:   No SOURCES given to target: libsodium
C/C++: CMake Generate step failed.  Build files cannot be regenerated correctly.
38 actionable tasks: 16 executed, 22 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-libsodium:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using /Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/CMakeLists.txt: -- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
  -- Android: Selected unified Clang toolchain
  -- The C compiler identification is Clang 12.0.8
  -- The CXX compiler identification is Clang 12.0.8
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Users/limp/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Users/limp/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done

  C++ build system [configure] failed while executing:
      /Users/limp/Library/Android/sdk/cmake/3.22.1/bin/cmake \
        -H/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android \
        -DCMAKE_SYSTEM_NAME=Android \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DCMAKE_SYSTEM_VERSION=21 \
        -DANDROID_PLATFORM=android-21 \
        -DANDROID_ABI=arm64-v8a \
        -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
        -DANDROID_NDK=/Users/limp/Library/Android/sdk/ndk/23.1.7779620 \
        -DCMAKE_ANDROID_NDK=/Users/limp/Library/Android/sdk/ndk/23.1.7779620 \
        -DCMAKE_TOOLCHAIN_FILE=/Users/limp/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake \
        -DCMAKE_MAKE_PROGRAM=/Users/limp/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        "-DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -fstack-protector-all" \
        -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/build/intermediates/cxx/Debug/06e91x1b/obj/arm64-v8a \
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/build/intermediates/cxx/Debug/06e91x1b/obj/arm64-v8a \
        -DCMAKE_BUILD_TYPE=Debug \
        -B/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/.cxx/Debug/06e91x1b/arm64-v8a \
        -GNinja \
        -DANDROID_STL=c++_shared
    from /Users/limp/dev/libsodium/node_modules/react-native-libsodium/android
  CMake Warning (dev) in CMakeLists.txt:
    No project() command is present.  The top-level CMakeLists.txt file must
    contain a literal, direct call to the project() command.  Add a line of
    code such as

      project(ProjectName)

    near the top of the file, but after cmake_minimum_required().

    CMake is pretending there is a "project(Project)" command on the first
    line.
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Error at CMakeLists.txt:34 (add_library):
    Cannot find source file:

      ../node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
    .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc


  CMake Error at CMakeLists.txt:34 (add_library):
    No SOURCES given to target: libsodium


  CMake Generate step failed.  Build files cannot be regenerated correctly.

* 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 4s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native-libsodium:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using /Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/CMakeLists.txt: -- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64' -- Android: Selected unified Clang toolchain -- The C compiler identification is Clang 12.0.8 -- The CXX compiler identification is Clang 12.0.8 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Users/limp/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Users/limp/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done C++ build system [configure] failed while executing: /Users/limp/Library/Android/sdk/cmake/3.22.1/bin/cmake \ -H/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android \ -DCMAKE_SYSTEM_NAME=Android \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_SYSTEM_VERSION=21 \ -DANDROID_PLATFORM=android-21 \ -DANDROID_ABI=arm64-v8a \ -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \ -DANDROID_NDK=/Users/limp/Library/Android/sdk/ndk/23.1.7779620 \ -DCMAKE_ANDROID_NDK=/Users/limp/Library/Android/sdk/ndk/23.1.7779620 \ -DCMAKE_TOOLCHAIN_FILE=/Users/limp/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake \ -DCMAKE_MAKE_PROGRAM=/Users/limp/Library/Android/sdk/cmake/3.22.1/bin/ninja \ "-DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -fstack-protector-all" \ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/build/intermediates/cxx/Debug/06e91x1b/obj/arm64-v8a \ -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/build/intermediates/cxx/Debug/06e91x1b/obj/arm64-v8a \ -DCMAKE_BUILD_TYPE=Debug \ -B/Users/limp/dev/libsodium/node_modules/react-native-libsodium/android/.cxx/Debug/06e91x1b/arm64-v8a \ -GNinja \ -DANDROID_STL=c++_shared from /Users/limp/dev/libsodium/node_modules/react-native-libsodium/android CMake Warning (dev) in CMakeLists.txt: No project() command is present. The top-level CMakeLists.txt file must contain a literal, direct call to the project() command. Add a line of code such as project(ProjectName) near the top of the file, but after cmake_minimum_required(). CMake is pretending there is a "project(Project)" command on the first line. This warning is for project developers. Use -Wno-dev to suppress it. CMake Error at CMakeLists.txt:34 (add_library): Cannot find source file: ../node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc CMake Error at CMakeLists.txt:34 (add_library): No SOURCES given to target: libsodium CMake Generate step failed. Build files cannot be regenerated correctly. * 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 4s.
info Run CLI with --verbose flag for more details.

The example project works fine, though; all tests passed.