Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command PhaseScriptExecution failed with a nonzero exit code #23

Closed
jpv3dts opened this issue Mar 13, 2023 · 16 comments
Closed

Command PhaseScriptExecution failed with a nonzero exit code #23

jpv3dts opened this issue Mar 13, 2023 · 16 comments
Labels
P1 High priority issue. Ready Ready for release.

Comments

@jpv3dts
Copy link

jpv3dts commented Mar 13, 2023

My React Native app works fine in both the iOS and Android simulators, but when I try to build and install the app via Xcode onto an actual iPhone, I get this error:

dr-pogodin-react-native-static-server
Command PhaseScriptExecution failed with a nonzero exit code

Can anyone help me with this?

@birdofpreyru
Copy link
Owner

Hey @jpv3dts , please provide the log output from the failed command. It sounds like an error in the library build setup, I am still working on getting it right across all systems.

@birdofpreyru birdofpreyru added the P1 High priority issue. label Mar 13, 2023
@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

I did not build it using a command. I tried to build it in Xcode. The output in my initial message is all that I can see. Is there a way to get more detailed output? Because I'd be more than happy to provide it.

@birdofpreyru
Copy link
Owner

Yes. I don't have Xcode in front of me right now; but when you go into selected build logs, on each log message you see in the main panel, I believe there is a small icon in the right part with three horizontal bars, clicking on which will expand that message showing you all underlying output of that command / step; also there is a filter to see only messages from errored-out steps.

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

I'll check and get back to you.

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

Do you want the output from All Messages, All Issues or Errors Only?

@birdofpreyru
Copy link
Owner

Click Errors Only, then you'll be able to easily find that "Command PhaseScriptExecution" operation that failed. Expand it, and give me the full output from that specific failed command.

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

/Users/jpvisser/Library/Developer/Xcode/DerivedData/local_server-etujkujuudxjgccctkepmxuqqhdk/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/dr-pogodin-react-native-static-server.build/Script-46EB2E00019540.sh: line 3: cmake: command not found
Command PhaseScriptExecution failed with a nonzero exit code

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

Here you go.

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

I see that it can't find CMake, which does not make sense to me, because I have it installed. Is it perhaps necessary to set a path somewhere?

@birdofpreyru
Copy link
Owner

Yeah... correct, it can't execute CMake. Does not make much sense to me either, as you say that it works for you when building for iOS simulator. Though, I guess, it should be something about your setup / user permissions on your machine that makes it fail.

It looks like you have to to troubleshoot it yourself. Look, the stuff you copied above, you can copy it (starting from export ACTION=build) into your console, and thus run this step alone, as XCode would try to execute it. That stuff is a definition of all environment variables XCode environment has, followed by execution of shell script for that failing step: /Users/jpvisser/Library/Developer/Xcode/DerivedData/local_server-etujkujuudxjgccctkepmxuqqhdk/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/dr-pogodin-react-native-static-server.build/Script-46EB2E00019540.sh. The script itself shoul be just a copy of this code from the library. That code just uses CMake to build PCRE2 and Lighttpd from sources. So, I suggest you to play with it, to figure out why it can't find CMake there. Probably its location is not in PATH in that case, or there something wrong with permissions, etc.

On my machine the current library version builds fine for real iOS device, and I have XCode installed in the most standard way, and CMake I have installed via Homebrew, also in the most standard way.

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

I resolved the issue by replacing "cmake" in the build script with the absolute path to the CMake executable, but now I get this error:

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
.
.
.
CMake Error at lighttpd1.4/src/CMakeLists.txt:574 (message):
pcre2.h couldn't be found

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

It appears that it can't find pkg-config. Would it be possible to set the absolute path to it somewhere as well?

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

Or a better question: Do you have any idea why my Xcode cannot find the executables that your package uses? 😂

@birdofpreyru
Copy link
Owner

I solved the issue of CMake not being found by specifiying the absolute path to it.

Well, that script is re-generated on each build, thus to really solve it, I guess you should ensure CMake location is added to your system's PATH.

It appears that it can't find pkg-config. Would it be possible to set the absolute path to it somewhere as well?

Probably, it is fine and iPhone SDK indeed does not have pkg-config. The library, kind of, still supposed to find and link in the PCRE2 library it builds from sources itself, but that piece is fragile — depending on how stuff is installed on each system, it seems to break easily. I am currently re-implementing that piece trying to resolve #20 , so hopefully the next release will solve issues with PCRE2 linking. In the meantime you can workaround adding -DWITH_PCRE2=OFF argument here (or directly into the script you was editing earlier; mind, if you edit it in .podspec in library sources in your node_modules, then you should do pod install in ios folder of your project to cause XCode to re-generate that build script).

@jpv3dts
Copy link
Author

jpv3dts commented Mar 13, 2023

Thank you, this works. Thank you very much for the help, I really appreciate it.

Also, thank you for maintaining this project. Besides this issue, this is one of the more niche packages that's been the most hassle free to use.

@birdofpreyru birdofpreyru added In Progress The issue is actively worked upon Ready Ready for release. and removed In Progress The issue is actively worked upon labels Mar 13, 2023
@birdofpreyru
Copy link
Owner

v0.7.2 (just released), presumably, fixes the issue with PCRE2 linking (at least, I re-worked the way it happens, and tested it works for me, in particular, for iOS builds on Mac; however, the previous setup also worked fine on my system, thus don't hesitate to open a new issue if it still does not work for you). The problem with CMake, in my current understanding, was due to its location absent in your PATH, thus not a problem with the library. Thus, I guess, this issue is probably resolved, and I'll close it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority issue. Ready Ready for release.
Projects
None yet
Development

No branches or pull requests

2 participants