Open harrymash2006 opened 1 month ago
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.
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.
Does the Example app build for you?
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"
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;x8664"
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.
I am getting the above error in the sample app as well, when I try to run the app on a real device.
Hi @birdofpreyru any update on the above?
Do you get this error when building the Example app?
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: @.***>
Ok, I’ll re-recheck example app build for iOS when I find time.
Though, are you trying to build it for Android on macOS host machine?
Android build is working fine, only having issues with iOS. I am trying on macOS machine.
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. ;)
Yes, it seems to be a regression in CMake 3.30.0:
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.
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.
This is reproduced on CMake v3.30.2 installed via Homebrew.
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
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.
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.