Azure pipeline fails during xcode build for iOS project - ios

Trying to build iOS project with xcode build. Using -
Xcode 12.4
Agent Specification - macOS-10.15
Workspace or project path - Project.xcworkspace
Configuration - Release (Tried with Debug also, it gives more error)
Scheme -valid name
SDK - iphoneos
Now After xcode build using Azure pipeline give following error.
We can build this xcode on locally and Gitlab too. But same code is failing on Azure Devops.
Kindly help.
2021-05-12T13:00:30.6465950Z ❌ /Users/runner/work/1/s/Project/Framework/csdk_common.framework/Modules/module.modulemap:2:19: umbrella header 'csdk_common.h' not found
2021-05-12T13:00:30.6466920Z
2021-05-12T13:00:30.6468430Z umbrella header "csdk_common.h"
2021-05-12T13:00:30.6471390Z ^
2021-05-12T13:00:30.6471830Z
2021-05-12T13:00:30.6472160Z
2021-05-12T13:00:30.6472470Z
2021-05-12T13:00:30.6473810Z ❌ /Users/runner/work/1/s/Project/TTS/main_internal.swift:2:8: could not build Objective-C module 'csdk_common'
2021-05-12T13:00:30.6474420Z
2021-05-12T13:00:30.6475000Z import csdk_common
2021-05-12T13:00:30.6475580Z ^
2021-05-12T13:00:30.6475930Z
2021-05-12T13:00:30.6476250Z
2021-05-12T13:00:30.6730310Z ** BUILD FAILED **
2021-05-12T13:00:30.6731680Z
2021-05-12T13:00:30.6732100Z
2021-05-12T13:00:30.6732840Z The following build commands failed:
2021-05-12T13:00:30.6733510Z CompileSwift normal arm64
2021-05-12T13:00:30.6740330Z CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
2021-05-12T13:00:30.6746120Z (2 failures)
2021-05-12T13:00:30.7025590Z ##[error]Error: /usr/bin/xcodebuild failed with return code: 65
2021-05-12T13:00:30.7365340Z ##[section]Finishing: Xcode build

Please check the repos branch, and make sure you have added this under framework header file. Maybe you did not push the right project and necessary part into the azure devops repos.
#import "xxx\csdk_common.h"
More info you could check this issue and that.

Related

How to use Fastlane with a CMake generated XCode project with dependency on WebP?

I have a project written in C++ where CMake is used to generate the build system for various platforms including iOS. The project has a dependency on WebP. You can find an example project on GitHub here that can be used to reproduce things & I've included the relevant source files at the end of this post for completeness.
The Xcode build system for iOS is generated using CMake as follows:
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=third_party/ios-cmake/ios.toolchain.cmake -DPLATFORM=OS64 -DDEPLOYMENT_TARGET=15.0 -DENABLE_BITCODE=0 -S . -B cmake-build-release
We can now attempt to build/archive the app using Fastlane with the command from within the generated cmake-build-release directory:
bundle exec fastlane ios beta
However this fails due to being unable to locate various webp object files (that based on console output it appears to have previously successfully compiled):
...
▸ Compiling buffer_dec.c
▸ Compiling alpha_dec.c
▸ Building library libwebpdsp.a
...
** ARCHIVE FAILED **
▸ The following build commands failed:
▸ Libtool /Users/dbotha/Library/Developer/Xcode/DerivedData/CMakeFastlaneWebpTest-dlwvukebfiwjqvaqiepshuxqklhh/ArchiveIntermediates/CMakeFastlaneWebpTest/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libwebpdecoder.a normal (in target 'webpdecoder' from project 'CMakeFastlaneWebpTest')
▸ (1 failure)
▸ ❌ error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/dbotha/CLionProjects/CMakeFastlaneWebpTest/cmake-build-release/third_party/libwebp/CMakeFastlaneWebpTest.build/Release-iphoneos/webpdecode.build/Objects-normal/arm64/alpha_dec.o (No such file or directory)
▸ ❌ error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/dbotha/CLionProjects/CMakeFastlaneWebpTest/cmake-build-release/third_party/libwebp/CMakeFastlaneWebpTest.build/Release-iphoneos/webpdecode.build/Objects-normal/arm64/buffer_dec.o (No such file or directory)
...
Internally Fastlane attempted to build/archive the project with the following command:
xcodebuild -scheme CMakeFastlaneWebpTest -project ./CMakeFastlaneWebpTest.xcodeproj -configuration Release -destination 'generic/platform=iOS' -archivePath ./out.xcarchive archive
Interestingly an archive can be successfully generated if I use the following xcodebuild command (note how -target flag is used instead of -scheme):
xcodebuild -project CMakeFastlaneWebpTest.xcodeproj archive -target CMakeFastlaneWebpTest -configuration Release
After this successful attempt bundle exec fastlane ios beta will now also succeed as the compiled object files are where it expected them to be.
Now I'd happily workaround this issue using my xcodebuild + -target flag approach and then use the fastlane command to push to Testflight, etc. but the real project (not this toy example) takes a very long time to build so building it twice is really wasteful from a cost point of view on CI platforms.
Does anyone have any idea what's going on here & how I can successfully build things in the first instance using fastlane without my own explicit call to xcodebuild first? Or alternatively how can I have Fastlane use the successfully built objects from my workaround so it doesn't need to rebuild the entire project from scratch?
CMakeLists.txt
cmake_minimum_required(VERSION 3.23)
project(CMakeFastlaneWebpTest)
set(CMAKE_CXX_STANDARD 14)
add_executable(CMakeFastlaneWebpTest src/main.cpp)
# Skip building of unused webp tools which fail for me under ios:
set(WEBP_BUILD_ANIM_UTILS OFF)
set(WEBP_BUILD_CWEBP OFF)
set(WEBP_BUILD_DWEBP OFF)
set(WEBP_BUILD_GIF2WEBP OFF)
set(WEBP_BUILD_IMG2WEBP OFF)
set(WEBP_BUILD_VWEBP OFF)
set(WEBP_BUILD_WEBPINFO OFF)
set(WEBP_BUILD_WEBPMUX OFF)
set(WEBP_BUILD_EXTRAS OFF)
set(WEBP_BUILD_WEBP_JS OFF)
add_subdirectory(third_party/libwebp EXCLUDE_FROM_ALL)
target_link_libraries(CMakeFastlaneWebpTest PRIVATE webpdecoder webpdemux)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/third_party/libwebp/src)
configure_file(${CMAKE_SOURCE_DIR}/fastlane/Appfile ${CMAKE_BINARY_DIR}/fastlane/Appfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/fastlane/Fastfile ${CMAKE_BINARY_DIR}/fastlane/Fastfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Gemfile ${CMAKE_BINARY_DIR}/Gemfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Gemfile.lock ${CMAKE_BINARY_DIR}/Gemfile.lock COPYONLY)
set_target_properties(CMakeFastlaneWebpTest PROPERTIES
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/iOS-Info.plist.in
MACOSX_BUNDLE_GUI_IDENTIFIER com.dbotha.CMakeFastlaneWebpTest
MACOSX_BUNDLE_BUNDLE_NAME CMakeFastlaneWebpTest
MACOSX_BUNDLE_BUNDLE_VERSION "0.1"
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
)
set_xcode_property(CMakeFastlaneWebpTest PRODUCT_BUNDLE_IDENTIFIER "com.dbotha.CMakeFastlaneWebpTest" All)
set_xcode_property(CMakeFastlaneWebpTest CODE_SIGN_IDENTITY "iPhone Developer" All)
set_xcode_property(CMakeFastlaneWebpTest DEVELOPMENT_TEAM "GFP63373B2" All)
fastlane/Appfile
app_identifier("com.dbotha.CMakeFastlaneWebpTest") # The bundle identifier of your app
apple_id("REPLACE_ME") # Your Apple Developer Portal username
itc_team_id("REPLACE_ME") # App Store Connect Team ID
team_id("REPLACE_ME") # Developer Portal Team ID
fastlane/Fastfile
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
build_app(scheme: "CMakeFastlaneWebpTest", configuration: "Release")
upload_to_testflight
end
end
src/main.cpp
#include <iostream>
#include <webp/demux.h>
int main() {
WebPAnimDecoderOptions decOptions;
(void)decOptions;
std::cout << "Hello, World!" << std::endl;
return 0;
}
I'm not an expert in this topic but according to the documentation you should provide workspace to build your scheme.
To build an Xcode workspace, you must pass both the -workspace and
-scheme options to define the build. The parameters of the scheme will
control which targets are built and how they are built, although you may
pass other options to xcodebuild to override some parameters of the
scheme.
Scheme controls what target will be build, and guessing by your example, since you do not provide a workspace, it gets lost in the process.
The scheme is not lost anymore if you build the target manually. Since it is already build the scheme does not have to do a thing.
My proposals:
Option 1: Try adding workspace to build_app parameters in Fastfile.
Option 2: Don't bother with building scheme just use target in the
build_app parameters in Fastfile like so: build_app(target: "CMakeFastlaneWebpTest", configuration: "Release")

IOS - Running script '[CP-User] Generate Specs The following build commands failed: PhaseScriptExecution [CP-User]\ Generate\ Specs In Azure Pipeline

I am working with the azure pipeline for CICD for React native app. I am using macOS Big Sur (11.4) and Xcode 12.4 as a local machine to create and test the app. App working fine on the local machine without any warning or issue for ios. However, when I am pushing the code on the Azure pipeline it is giving me errors as below,
2021-07-27T07:16:59.6470190Z ▸ Building library libRCTTypeSafety.a
2021-07-27T07:17:00.2028870Z ▸ Running script '[CP-User] Generate Specs'
2021-07-27T07:17:01.2282870Z ** BUILD FAILED **
2021-07-27T07:17:01.2284310Z
2021-07-27T07:17:01.2284960Z
2021-07-27T07:17:01.2285770Z The following build commands failed:
2021-07-27T07:17:01.2288070Z PhaseScriptExecution [CP-User] Generate\ Specs /Users/runner/Library/Developer/Xcode/DerivedData/QualityGateTest-fpifffctlauicvdetlisjqinofwg/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/FBReactNativeSpec.build/Script-650A047D1ACF74FC1AD8108A78938588.sh
2021-07-27T07:17:01.2289360Z (1 failure)
2021-07-27T07:17:01.2705660Z ##[debug]success of first tool:false
2021-07-27T07:17:01.2787820Z ##[debug]rc:0
2021-07-27T07:17:01.2788560Z ##[debug]success:true
2021-07-27T07:17:01.2807190Z ##[debug]task result: Failed
2021-07-27T07:17:01.2844600Z ##[error]Error: /usr/bin/xcodebuild failed with return code: 65
2021-07-27T07:17:01.2856630Z ##[debug]Processed: ##vso[task.issue type=error;]Error: /usr/bin/xcodebuild failed with return code: 65
2021-07-27T07:17:01.2866680Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: /usr/bin/xcodebuild failed with return code: 65
2021-07-27T07:17:01.2867800Z ##[debug]Agent.Version=2.189.0
My observation is that the Azure pipeline does not have macOS Big Sur as Agent. My local machine changes some configurations during POD install and adds the script to support the latest Xcode and macOS and the azure pipeline agent does not support macOS Big Sur reason it is not able to execute the script.
NOTE: I have tried all clean processes like yarn, pod, or delete node_module.
[azure-devops]
I have got the solution for the issue.
Actually, the latest version of macOS Big Sur (11.4) was not having a node install on VM.
A) I did some changes in the pipeline.
pool:
vmImage: macOS-11
steps:
- checkout: self
persistCredentials: true
clean: true
- task: NodeTool#0
displayName: 'Install Node'
inputs:
versionSpec: 'v16.6.2' # you can use your desired version here
- script: yarn install
displayName: Install Dependencies
B)
Also created patch inside react native lib for version 0.64. by adding "unset PREFIX" on node_modules/react-native/scripts/find-node.sh

Oracle JET : Unable to build ojet hybrid project after upgrading xcode to Version 12.0 (12A7209)

This morning I updated my xcode to Version 12.0 (12A7209) and since then I am not able to build the project for ios
Replication steps
ojet create testapp --template=navbar
cd testapp
ojet add hybrid
ojet build ios
Getting the below error
.........
In module 'Foundation' imported from /Users/hellonuh/Desktop/testapp/hybrid/platforms/ios/build/emulator/include/Cordova/CDVAppDelegate.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURL.h:595:1: note: 'stringByAddingPercentEscapesUsingEncoding:' has been explicitly marked deprecated here
- (nullable NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc API_DEPRECATED("Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.", macos(10.0,10.11), ios(2.0,9.0), watchos(2.0,2.0), tvos(9.0,9.0));
^
3 warnings and 3 errors generated.
Cordova compile finished.
Error: Error: Command failed: cordova compile ios --debug --emulator
** BUILD FAILED **
The following build commands failed:
CompileC /Users/hellonuh/Library/Developer/Xcode/DerivedData/testapp-hfsgwahghfnpzecdcshskgzlpyep/Build/Intermediates.noindex/testapp.build/Debug-iphonesimulator/testapp.build/Objects-normal/x86_64/CDVWKWebViewEngine.o /Users/hellonuh/Desktop/testapp/hybrid/platforms/ios/testapp/Plugins/cordova-plugin-wkwebview-engine/CDVWKWebViewEngine.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65
Please help

Nativescript application builds fine for android but not for IOS

Here is the logs I get when I try to build ios:
Project successfully prepared (ios)
Configure firebase
Building project...
Xcode build...
/Users/me/Desktop/vt/vt_tv/front/Native/App/platforms/ios/Pods/ASBPlayerSubtitling/ASBPlayerSubtitling/ASBPlayerSubtitling.m:41:1: warning:
method possibly missing a [super awakeFromNib] call [-Wobjc-missing-super-calls]
}
^
// Then I get a long list of my icon resources
warning: 'UILaunchImages' has been deprecated, use launch storyboards instead. (in target 'App' from project 'App')
error: cannot parse the debug map for '/Users/me/Desktop/vt/vt-tv/front/Native/App/platforms/ios/build/Debug-iphonesimulator/App.app/App': Is a directory
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/rsync.c(244) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
** BUILD FAILED **

Appcelerator won't create build when I am using card.io module, module from gittio is com.likelysoft.cardio

I have added module com.likelysoft.cardio from gittio and trying to create build but it's showing me following error :
[ERROR] : ** BUILD FAILED **
[ERROR] : The following build commands failed:
[ERROR] : Ld build/---\ --.build/Debug-iphoneos/--\ --.build/Obje normal/arm64/--\ -- normal arm64
[ERROR] : Ld build/--\ --.build/Debug-iphoneos/--\ --.build/Objects-normal/armv7/--\ -- normal armv7
[ERROR] : (2 failures)
But when I am trying to build project by removing this module from tiapp.xml, it works. (it's create build).
Also by adding this module it works on simulator. :(
where Actually I am going wrong ?
Thanks.
I have resolved this problem by Updating my xcode to 7 and Appcelerator SDK to 5.0.2 GA and it's working fine now, and I can create build now. :)

Resources