ERROR at //build/config/ios/ios_sdk.gni:100:21: Script returned non-zero exit code - ios

ERROR at //build/config/ios/ios_sdk.gni:100:21: Script returned non-zero exit code.
_ios_sdk_result = exec_script(script_name, ios_sdk_info_args, "scope")
^----------
Current dir: /Users/niu/New_OWT/src/out/Release-device-arm64/
Command: python /Users/niu/New_OWT/src/build/config/mac/sdk_info.py iphoneos
Returned 127.
See //build/config/ios/rules.gni:5:1: whence it was imported.
import("//build/config/ios/ios_sdk.gni")
^--------------------------------------
See //third_party/webrtc/webrtc.gni:31:3: whence it was imported.
import("//build/config/ios/rules.gni")
^------------------------------------
See //BUILD.gn:4:1: whence it was imported.
import("third_party/webrtc/webrtc.gni")
^-------------------------------------
I've executed sudo xcode-select -s /Applications/Xcode.app/Contents/Developer But still wrong

Related

Unable to build electron using manual method

I am trying to build electron (master) using the appended script on Ubuntu 22.04. Its throwing the following error (e build doesn't report this error). I am using the latest depot_tools, gn and node.js. Please help:
root#acs-x86-node1-ghatwala-rhel:/electron/src# gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
ERROR at //electron/BUILD.gn:110:20: Script returned non-zero exit code.
electron_version = exec_script("script/print-version.py",
^----------
Current dir: /electron/src/out/Release/
Command: python3 /electron/src/electron/script/print-version.py
Returned 1 and printed out: 0a>\n/electron/src/electron/script/lib/get-version.js:19\n throw new Error('Failed to get current electron version');\n ^\n\nError: Failed to get current electron version\n at module.exports.getElectronVersion (/electron/src/electron/script/lib/get-version.js:19:11)\n at [eval]:1:37\n at Script.runInThisContext (node:vm:129:12)\n at Object.runInThisContext (node:vm:307:38)\n at node:internal/process/execution:83:21\n at [eval]-wrapper:6:24\n at runScript (node:internal/process/execution:82:62)\n at evalScript (node:internal/process/execution:104:10)\n at node:internal/main/eval_string:50:3\n\nNode.js v19.3.0\n"
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['node', '-p', 'require("./script/lib/get-version").getElectronVersion()']' returned non-zero exit status 1.
See //electron/build/args/all.gn:2:21: which caused the file to be included.
root_extra_deps = [ "//electron" ]
^-----------
mkdir electron && cd electron
gclient config --name "src/electron" --unmanaged https://github.com/electron/electron
gclient sync --with_branch_heads --with_tags --no-history
cd src
export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
ninja -C out/Release electron

cordova build error when `node cordova/lib/copy-www-build-step.js` in build phase

I am a web developer with no experience in iOS development. Now I'm using Cordova to build iOS app. Because I have no knowledge about iOS or Xcode, it is very hard for me. I always get error like the following output when I built in Xcode or built in command line.
Error info in Xcode build:
Run custome shell script 'Copy www directory'
PhaseScriptExecution Copy\ www\ directory /Users/jyjin/Library/Developer/Xcode/DerivedData/myios-auhioanpfinvvvcrnvoaioslreyr/Build/Intermediates.noindex/myios.build/Debug-iphonesimulator/myios.build/Script-304B58A110DAC018002A0835.sh (in target: myios)
cd /Users/jyjin/workspace/gitProject/Cordova/FirstProject/platforms/ios
/bin/sh -c /Users/jyjin/Library/Developer/Xcode/DerivedData/myios-auhioanpfinvvvcrnvoaioslreyr/Build/Intermediates.noindex/myios.build/Debug-iphonesimulator/myios.build/Script-304B58A110DAC018002A0835.sh
/Users/jyjin/Library/Developer/Xcode/DerivedData/myios-auhioanpfinvvvcrnvoaioslreyr/Build/Intermediates.noindex/myios.build/Debug-iphonesimulator/myios.build/Script-304B58A110DAC018002A0835.sh: line 2: 27158 Segmentation fault: 11 node cordova/lib/copy-www-build-step.js
Command PhaseScriptExecution failed with a nonzero exit code
Error info in command line build:
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Copy\ www\ directory /Users/jyjin/Library/Developer/Xcode/DerivedData/myios-auhioanpfinvvvcrnvoaioslreyr/Build/Intermediates.noindex/myios.build/Debug-iphonesimulator/myios.build/Script-304B58A110DAC018002A0835.sh
(1 failure)
xcodebuild: Command failed with exit code 65
I have read a lot of solutions on websites, and finally I found that there were some script in build phase:
NODEJS_PATH=/usr/local/bin; NVM_NODE_PATH=~/.nvm/versions/node/`nvm version 2>/dev/null`/bin; N_NODE_PATH=`find /usr/local/n/versions/node/* -maxdepth 0 -type d 2>/dev/null | tail -1`/bin; XCODE_NODE_PATH=`xcode-select --print-path`/usr/share/xcs/Node/bin; PATH=$NODEJS_PATH:$NVM_NODE_PATH:$N_NODE_PATH:$XCODE_NODE_PATH:$PATH && node cordova/lib/copy-www-build-step.js
after checking out the error message several times, I tried to remove && node cordova/lib/copy-www-build-step.js in Build Phases, it builds successfully, but with no page effect expected in html (Cause no www resource copied I think).
and I tried to check out some env PATH value in copy-www-build-step.js,so I wrote some log code in copy-www-build-step.js, but have no idea how to print js logs in Xcode. Then I found cordova-plugin-console, but npm doc said it is duplicated, and contains the last version for Cordova, and mine is also the latest.
Oh, God!One week passed... I just want to build an iOS app. It’s so hard to play. The ghost knows what I experienced:Configuring certificates, profile, building a Cordova app from scratch, even spending $99 to buy an apple developer account...
Just want to play an iOS app by myself in my free time ... Hope someone can help me ~~
-- From a desperate Chinese boy !
just update cordova-ios to latest version:
npm i cordova-ios#latest
you can see this problem being solved in this PR: #600, they changed the script from javascript to the old shell version and fixed the problem.
Workaround without updating the library
Enter in xCode in the Build Phases tab and click on "Copy www directory" phase, so change the script to:
$SRCROOT/__PROJECT_NAME__/Scripts/copy-www-build-step.sh
"__PROJECT_NAME__ " is the name of xCode project.
After this download the copy-www-build-step.sh script and put it inside the "__PROJECT_NAME__/Scripts/" path.
References
https://github.com/apache/cordova-ios/issues/540
https://github.com/apache/cordova-ios/pull/600/files
https://github.com/apache/cordova-ios/pull/146/files
Oh! I have fixed it~
Firstly, check the script:
NODEJS_PATH=/usr/local/bin; NVM_NODE_PATH=~/.nvm/versions/node/`nvm version 2>/dev/null`/bin; N_NODE_PATH=`find /usr/local/n/versions/node/* -maxdepth 0 -type d 2>/dev/null | tail -1`/bin; XCODE_NODE_PATH=`xcode-select --print-path`/usr/share/xcs/Node/bin; PATH=$NODEJS_PATH:$NVM_NODE_PATH:$N_NODE_PATH:$XCODE_NODE_PATH:$PATH && node cordova/lib/copy-www-build-step.js
currently error is xcodebuild: Command failed with exit code 65. This is the first error, the && should be & when running in the mac.
And then, the error turn to be Command /bin/sh failed with exit code 127.And I found xcode error message: node: command not found.
So I run find /usr/local/n/versions/node/* -maxdepth 0 -type d 2>/dev/null | tail -1 in the command line. and get the node result path /usr/local/n/versions/node/11.12.0
run
node -v // v10.15.3
So I remove all script in build_phases, and give it node path for my real nvm node path, change build_phases like below:
/Users/jyjin/.nvm/versions/node/v10.15.3/bin/node cordova/lib/copy-www-build-step.js
Build success!
Summary! cordova auto build_phases script maybe not suit your environment, make sure build phase can get your node path!

Command /bin/sh emitted errors

In xcode it is a good idea to generate documentation during build your library.. I am using headerdoc2HTML command .. to make it run with build phase I've added it to build phase script (shell script) like this:
headerdoc2html -o "outputPath" "myHeader.h"
But it always gives me an error:
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
Even the documentation is generated but it gives me an error .. if I remove this command every thing goes fine!
I checked with -d parameter I did not get where is the error
Any help with that? is there a way to check if the command did not return 0 then don't show error (ignore all warnings and errors)?
EDIT:
I just made sure that the command is ok and no problem with it by doing this check:
if headerdoc2html -q -j -o "outputPath" "myHeader.h"
then
echo "Documents generated successfully!"
fi
While the problem is from the command it self and don't effect the over all build phase so it is good idea to not show the warnings and errors from headerdoc2html command.
The easiest way to do that is to hide any emitted errors from it like by redirect errors to null like this:
headerdoc2html -o "outputPath" "myHeader.h" >/dev/null 2>/dev/null

LCOV code coverage - Exit status 255

When i run the code coverage to output in html, I get the error message:
CalledProcessError: Command 'lcov -r mycoverage.2.temp "/../generated/*" -o mycoverage.2' returned non-zero exit status 255
The gcov -v gives:
gcov (GCC) 3.4.2
I tried to find what exit status 255 means, but with no luck.
Any expert please who might be able to help?

Xcode Build error, arm-apple-darwin11-gcc-4.2.1 execvp: No such file or directory

After upgrading to Xcode 4.3.2. I'm getting a metric ton of build errors.
A whole line of them are error code 255
gcc-4.2: error trying to exec '/usr/bin/arm-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Command /usr/bin/gcc-4.2 failed with exit code 255
I noticed that there is no /usr/bin/arm-apple-darwin11-gcc-4.2.1 file on my machine. Could this be the source of the problem?
What's the output of this command?
$ printenv | grep "CC="
It might be honoring your C Compiler (CC) selection. I was getting similar errors (through cocoapods) and doing an
$ export CC=
fixed it for me.

Resources