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

CMake v3.30.0 is not supported. Compatibility with future CMake versions is to be verified.

Open harrymash2006 opened this issue 1 year ago • 16 comments

const prepareAssets = async () => { try { const fileDir = resolveAssetsPath('webroot'); const filePath = fileDir + '/index.html'; if (Platform.OS === 'ios') { await modifyContent(filePath); } if (Platform.OS === 'android') { console.log('fileDir:: inside android::', fileDir); const alreadyExtracted = await exists(fileDir); console.log('fileDir:: alreadyExtracted::', alreadyExtracted); if (alreadyExtracted) { await unlink(fileDir); } console.log('fileDir:: before copy assets::'); await copyFileAssets('webroot', fileDir); console.log('fileDir:: before read file::'); await modifyContent(filePath); } return fileDir; } catch (e) { console.log('fileDir:: exception::', e); } return null; };

Please help.

harrymash2006 avatar Jul 09 '24 17:07 harrymash2006

It reads like you failed to follow README and correctly bundle in the webroot asset folder you are trying to access. In addition to README the repo contains Example App demonstrating how to do it correctly.

birdofpreyru avatar Jul 10 '24 07:07 birdofpreyru

Hi @birdofpreyru I followed the same instructions and did the same code as the example app but I am getting the same issues. I ended up using a document directory thing and writing things manually to that path and then using that path for the server and got it working.

I am facing some other issue that is unrelated to this but when I try to build the app after selecting "Any iOS Device (arm64)" option I get the following error:

CMake Error at /opt/homebrew/Cellar/cmake/3.30.0/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:129 (message):
  The C compiler targets architectures:

    "arm64"

  but CMAKE_OSX_ARCHITECTURES is

    "arm64;x86_64"

Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.30.0/share/cmake/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
  CMakeLists.txt:109 (project)


-- Configuring incomplete, errors occurred!
CMake Error at CMakeLists.txt:72 (execute_process):
  execute_process failed command indexes:

    1: "Child return code: 1"

can you please help @birdofpreyru?

thanks, I really appreciate it.

harrymash2006 avatar Jul 10 '24 10:07 harrymash2006

Does the Example app build for you?

birdofpreyru avatar Jul 10 '24 10:07 birdofpreyru

No, actually I am getting some different errors when running sample app on simulator.

My app works fine on simulator but I get this error when I try to run it on a real device or try to build for publishing for the store which uses only arm64, where CMAKE_OSX_ARCHITECTURES expects architecture "arm64;x86_64"

harrymash2006 avatar Jul 10 '24 10:07 harrymash2006

No, actually I am getting some different errors when running sample app on simulator.

What errors do you get when running the sample app?

My app works fine on simulator but I get this error when I try to run it on a real device or try to build for publishing for the store which uses only arm64, where CMAKE_OSX_ARCHITECTURES expects architecture "arm64;x86_64"

Any errors in your app, which aren't present in the Example App, are your problems to solve — I am not going to do your development work for you for free.

birdofpreyru avatar Jul 10 '24 10:07 birdofpreyru

Screenshot 2024-07-10 at 4 36 20 PM

I am getting the above error in the sample app as well, when I try to run the app on a real device.

harrymash2006 avatar Jul 10 '24 11:07 harrymash2006

Hi @birdofpreyru any update on the above?

harrymash2006 avatar Jul 10 '24 11:07 harrymash2006

Do you get this error when building the Example app?

birdofpreyru avatar Jul 10 '24 12:07 birdofpreyru

yes Thanks, Hardik Mashru Expert Mobile Developer | React Native, Android, iOS, Flutter, Java, J2EE, Restful Web Services, Core PHP, Struts, Hibernate

On Wed, Jul 10, 2024 at 6:04 PM Dr. Sergey Pogodin @.***> wrote:

Do you get this error when building the Example app?

— Reply to this email directly, view it on GitHub https://github.com/birdofpreyru/react-native-static-server/issues/111#issuecomment-2220398101, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNOPDAB6CBYLUP2L4XTL7DZLUS4PAVCNFSM6AAAAABKTJMSCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRQGM4TQMJQGE . You are receiving this because you authored the thread.Message ID: @.***>

harrymash2006 avatar Jul 10 '24 12:07 harrymash2006

Ok, I’ll re-recheck example app build for iOS when I find time.

birdofpreyru avatar Jul 10 '24 12:07 birdofpreyru

Though, are you trying to build it for Android on macOS host machine?

birdofpreyru avatar Jul 10 '24 12:07 birdofpreyru

Android build is working fine, only having issues with iOS. I am trying on macOS machine.

harrymash2006 avatar Jul 10 '24 12:07 harrymash2006

We're also facing the issue, it sounds like a regression bug with the latest CMake version (3.30) & Xcode builds: https://gitlab.kitware.com/cmake/cmake/-/issues/26128

Downgrading to CMake 3.29.6 solves the issue. ;)

martinezleoml avatar Jul 13 '24 08:07 martinezleoml

Yes, it seems to be a regression in CMake 3.30.0:

  • A thread in CMake forum: https://discourse.cmake.org/t/cmake-3-30-doesnt-let-me-use-archs-standard-to-set-cmake-osx-architectures/11209
  • The issue in CMake repo: https://gitlab.kitware.com/cmake/cmake/-/issues/26128

birdofpreyru avatar Jul 13 '24 13:07 birdofpreyru

Ok, starting with v0.15.1 this library will refuse to be built with CMake v3.30.0 on all platforms, with a clear error message pointing back to this issue.

l keep this issue ticket open, and marked as In Progress and On Hold, to remind myself to check back if the issue is resolved in future CMake versions.

birdofpreyru avatar Jul 13 '24 14:07 birdofpreyru

Heads-up: it seems to be still broken with CMake v3.30.1; and, presumably, it is aimed to be fixed in CMake v3.30.2.

birdofpreyru avatar Jul 28 '24 12:07 birdofpreyru

This is reproduced on CMake v3.30.2 installed via Homebrew.

niryuu avatar Aug 11 '24 21:08 niryuu

I do not know well about CMake, and why we need ESCAPED_ARCHS, but modifying CMakeLists.txt as below works. from -DCMAKE_OSX_ARCHITECTURES=${ESCAPED_ARCHS} to -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} Environment: macOS 14.3.1 XCode 15.4.0 CMake v3.30.2

niryuu avatar Aug 11 '24 22:08 niryuu

Yeah, as the CMake ticket is closed now, I guess we need some corrections in our CMakeLists.txt.

why we need ESCAPED_ARCHS

as the comment says, without an escape of ; CMake replaced it by a whitespace when EXTRA_BUILD_ARGS was added to the COMMAND piece of execute_process(), thus effectively the command was run with -DCMAKE_OSX_ARCHITECTURES=arm64 x86_64 instead of -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64, which resulted in PCRE2 built only for the first arch in the list, rather than for each one, and an error down the line when the built failed to link against PCRE2 built for the target architecture.

So, although the change you did seemingly worked, you really want to verify for what architectures PCRE2 library got built, and perhaps a different change is needed. I am not an expert in CMake either, though, so can't give much help, until I find a moment to dive into it myself.

birdofpreyru avatar Aug 12 '24 08:08 birdofpreyru

FYI: It works on CMake 3.30.3. Hence This problems seems to occur only on 3.30.0-2.

niryuu avatar Sep 25 '24 05:09 niryuu

Yes, that's why I closed this ticket after fixing the config to work for CMake v3.30.2 and above in the last v0.17.1 release of this library ;)

birdofpreyru avatar Sep 25 '24 07:09 birdofpreyru