How to allow Jenkins to use usr/bin/security? - ios

I'm building an iPhone app with Jenkins so at some point it needs to use /usr/bin/security. Unfortunately Jenkins can't find that command.
Here's the console log excerpt:
[workspace] $ /usr/bin/security find-identity -p codesigning -v FATAL: Cannot run program "/usr/bin/security" (in directory "/Users/jenkins/.jenkins/jobs/Obfuscated iOS/workspace"): error=2, No such file or directory java.io.IOException: Cannot run program "/usr/bin/security" (in directory "/Users/jenkins/.jenkins/jobs/Obfuscated iOS/workspace"): error=2, No such file or directory
Something like this typically means there is a permissions issue, so I have tried sudo chmod 777 /usr/bin/security but the build yields the same result.
Furthermore, when I try /usr/bin/security find-identity -p codesigning -v from terminal it works just fine.
How do I get Jenkins to be able to use this tool and any other iOS tools it might need?
More info:
The odd part is that other iOS related tools like /usr/bin/xcodebuild and /usr/bin/agvtool work fine as seen below:
[workspace] $ /usr/bin/xcodebuild -version
Xcode 6.4
Build version 6E35b
Fetching marketing version number (CFBundleShortVersionString) from project.
[workspace] $ /usr/bin/agvtool mvers -terse1
Found marketing version (CFBundleShortVersionString): 4.0.0.
Marketing version (CFBundleShortVersionString) found in project configuration: 4.0.0.
Fetching technical version number (CFBundleVersion) from project.
[workspace] $ /usr/bin/agvtool vers -terse
More on permissions:
ls -le yields
-rwxr-xr-x 1 root wheel 224032 Aug 1 20:43 security
This looks normal to me when compared to other tools in the same directory like xcodebuild.
Jenkins PATH
I checked the Jenkins System Configuration page and it lists this for PATH:
/usr/bin:/bin:/usr/sbin:/sbin
Running in a build step works!
If I create a new job with only a build step with the command, /usr/bin/security find-identity -p codesigning -v, then it runs fine.
This suggests that internally the command is being run by another process.

The problem was occurring because of the value used in "Build output directory":
Removing ${WORKSPACE} resolved the issue with calling /usr/bin/security.

Related

Xcode cannot find node

Attempting to use node in a Build Phase in Xcode fails.
Adding a new build Phase with the following script, to a newly create Xcode project:
node -v
Results in the following error when attempting to build the project:
/Users/my-user/Library/Developer/Xcode/DerivedData/NodePlay-gsxizuhznxbjnfcbiujdrclrhknv/Build/Intermediates.noindex/NodePlay.build/Debug-iphonesimulator/NodePlay.build/Script-4E0D44FA2913BD480032430C.sh: line 2: node: command not found
Command PhaseScriptExecution failed with a nonzero exit code
When running which node and node -v in the terminal, I get valid responses. Opening Xcode through the terminal doesn't help. I've installed node through nvm. I've matched my setup with a colleague, that also have node installed in a similar way through nvm. He's able to build a similar new app with out these errors.
Any ideas are much welcome!
Yes, as matt commented, the issue was the difference between PATH in Xcode vs. Terminal. Running echo $PATH in both the Build Phase and the terminal revealed the difference.
Xcode didn't have /Users/my-user/.nvm/versions/node/v16.15.1/bin: in it's PATH which the terminal did.
I resolved the issue by creating a Symlink to the nvm node version inside usr/bin/local like so:
sudo ln -s /Users/my-user/.nvm/versions/node/v16.15.1/bin/node /usr/local/bin/node

Espressif tool chain broken after macOS Monterey 12.3 beta 3 install

After Monterey 12.3 beta 2 installed, the Espressif tool chain is broken. If you compile with platformIO you'll get the following error:
^
Linking .pio/build/esp32dev/firmware.elf
/Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.so: error loading plugin: dlopen(/Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.so, 0x0002): Library not loaded: /opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/libstdc++.6.dylib
Referenced from: /Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.0.so
Reason: tried: '/opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/libstdc++.6.dylib' (no such file)
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1
Looking at my Mac, there is no /opt/osxcross.
I have searched on another Mac with the beta 1 where the tool chain was still working the presence of the folder, and guess what?! there's none!
Any idea what as actually broken by the beta?
Finally, here is a work around: we are going to provide the missing /opt/osxcross folder and contents.
If you do not have gcc installed (this should be unlikely though, install gcc to get the folder content, as follows:
$ brew install gcc
Create the missing /opt/osxcross folder as follows:
$ sudo mkdir -p /opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/
Note that you'll be prompted for your password.
And, finally, copy the folder contents from the gcc build as follows:
$ sudo cp /usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/libstdc++.6.dylib /opt/osxcross/target/x86_64-apple-darwin12/lib/libstdc++.6.dylib
This completes the fix.
You must restart vscode, Arduino IDE or whatever tool you use. And then build your project, which should compile successfully.
And voila.

Bazel doesn't build ios mediapipe examples

I tried to build HandTrackingExample and get this error
ERROR:
/Users/air/Documents/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD:34:16:
ProcessEntitlementsFiles
mediapipe/examples/ios/handtrackinggpu/HandTrackingGpuApp_entitlements.entitlements
failed (Exit 1): plisttool failed: error executing command
bazel-out/host/bin/external/build_bazel_rules_apple/tools/plisttool/plisttool
... (remaining 1 argument(s) skipped)
Note: The failure of target
#build_bazel_rules_apple//tools/plisttool:plisttool (with exit code 1)
may have been caused by the fact that it is running under Python 2
instead of Python 3. Examine the error to determine if that appears to
be the problem. Since this target is built in the host configuration,
the only way to change its version is to set --host_force_python=PY3,
which affects the entire build.
If this error started occurring in Bazel 0.27 and later, it may be
because the Python toolchain now enforces that targets analyzed as PY2
and PY3 run under a Python 2 and Python 3 interpreter, respectively.
See https://github.com/bazelbuild/bazel/issues/7899 for more
information.
I tried build with --host_force_python=PY3 and PY2 but error the same
The link that is given in the error did not find a solution to your problem. How do I build a project correctly?
Try it
$ brew install python
$ sudo ln -s -f /usr/local/bin/python3.7 /usr/local/bin/python
$ python --version
Python 3.7.4
$ pip3 install --user six

Intern on IOS - Unable to launch WebDriverAgent because of xcodebuild failure: not found: carthage

When I am running Intern Standalone
staring appium and then Running Intern Script Script perfectly works
By when I Run same using java Program at that time it gives issue
UnknownError: [POST http://localhost:65505/wd/hub/session / {"desiredCapabilities":{"name":"DS/tests/intern.js","idle-timeout":60,"platformName":"iOS","deviceName":"iPhone 6","bundleId":"com.apple.mobilesafari","automationName":"XCUITest","Simulator":true}}] An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: not found: carthage
at Server.createSession
Carthage is installed correctly
Is there any access issue to it
Please please help
Problem with Carthage Folder, Check in below path /Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent
Carthage Folder
If it is not there, Follow Below steps
Step-1: For Appium 1.15.1 and above
Open below path in Terminal
$ cd /Applications/Appium.app/Contents/Resources/app/node_modules
$ sudo chmod -R 777 . appium-webdriveragent/*
Step-2: goto
1) $ cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent
2) sudo mkdir -p Resources/WebDriverAgent.bundle
3) sudo sh ./Scripts/bootstrap.sh -d
Step-3: Build WebDriverAgent Project with sign
Open below project in XCode
/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj

JENKINS gradle build error with ubuntu 14.04

I am using below configuration and trying to make Jenkins build but I am getting errors.
Note, I am able to make build successfully with command line.
My PC environments:
OS: ubuntu 14.04
Gradle version: 2.14.1.
Jenkins version: 2.25
Java version: java-8-openjdk-amd64
JENKINS BUILD ERRORS:
[workspace] $ /bin/sh -xe /tmp/hudson2322559356105735311.sh
+ cd /home/ekambaramv/Jenkins/workspace/CARMODE_STAR_O-OS/MAIN/
+ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
+ GRADLE_USER_HOME=/home/ekambaramv/Jenkins/gradle-2.14.1/
+ /home/ekambaramv/Jenkins/gradle-2.14.1/bin/gradle clean build
**FAILURE:** Build failed with an exception.
* What went wrong:
Failed to load native library 'libnative-platform.so' for Linux amd64.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Build step 'Execute shell' marked build as failure
Finished: FAILUR
E
I've had similar problems with the JNI libary when using Gradle. It's possible you might be using a version of the JNI library that is incompatible with Gradle.
Try going to the site: https://debian.pkgs.org/9/debian-main-amd64/libnative-platform-jni_0.11-5_amd64.deb.html and downloading the libnative-platform-jni_0.11-5_amd64.deb package onto your machine.
You can either open Nautilus and right click the .deb package and select 'Open with Software Install', or you can navigate the command line to the download directory and run the following:
sudo apt-get install ./libnative-platform-jni_0.11-5_amd64.deb
Next, check to see if Gradle still gives you the same "Failed to load native library..." error message as before by running:
gradle --version
If the problem persists, and you still get the error message, you might want to consider upgrading to a later version of Gradle. I was able to get this working on Gradle 3.2.1, but I know this method isn't always possible.
If you need to back out the changes, just run another sudo apt-get update, and the JNI libraries will be overwritten with the latest version once more.
One More Thing
I mentioned the libraries get overwritten the next time you update your system (apt-get, Software Updater). To prevent this, run the following command:
sudo apt-mark hold libnative-platform-jni
This will force the update software to overlook any later versions of the library. To turn this off, run the opposite command:
sudo apt-mark unhold libnative-platform-jni

Resources