fastlane: Unable to export ipa on Xcode 9 Beta 6

New Issue Checklist

Issue Description

xcodebuild stops with “Segmentation fault: 11” when trying to export an adHoc build. I am using Xcode 9 beta 6.

Xcode too crashes if I use the export option. So Is it a bug with Xcode? I do not see anything related to it in Release Notes as well or anyone else facing a similar issue online.

here is the Last part of the fastlane output. … …

[15:15:31]: ▸ Copying /Users/akshay/Library/Developer/Xcode/DerivedData/myApp-hahtdhndnvwbxtbrwgdigxtkqpgq/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/AdHoc-iphoneos/DocumentProviderFileProvider.appex [15:15:31]: ▸ Running script ‘[CP] Embed Pods Frameworks’ [15:15:35]: ▸ Running script ‘[CP] Copy Pods Resources’ [15:15:35]: ▸ Running script 'Run Script’myapp [15:15:42]: ▸ Touching myApp.app [15:15:47]: ▸ Signing /Users/akshay/Library/Developer/Xcode/DerivedData/myApp-hahtdhndnvwbxtbrwgdigxtkqpgq/Build/Intermediates.noindex/ArchiveIntermediates/myApp/InstallationBuildProductsLocation/Applications/myApp.app [15:15:51]: ▸ Touching myApp.app.dSYM [15:15:53]: ▸ Archive Succeeded [15:15:53]: Generated plist file with the following values: [15:15:53]: ▸ ----------------------------------------- [15:15:53]: ▸ { [15:15:53]: ▸ “iCloudContainerEnvironment”: “Production”, [15:15:53]: ▸ “provisioningProfiles”: { [15:15:53]: ▸ “com.company.myapp”: “match AdHoc com.company.myapp”, [15:15:53]: ▸ “com.company.myapp.appextension”: “match AdHoc com.company.myapp.appextension”, [15:15:53]: ▸ “com.company.myapp.notificationcontent”: “match AdHoc com.company.myapp.notificationcontent”, [15:15:53]: ▸ “com.company.myapp.notificationservice”: “match AdHoc com.company.myapp.notificationservice”, [15:15:53]: ▸ “com.company.myapp.documentprovider”: “match AdHoc com.company.myapp.documentprovider”, [15:15:53]: ▸ “com.company.myapp.documentfileprovider”: “match AdHoc com.company.myapp.documentfileprovider” [15:15:53]: ▸ }, [15:15:53]: ▸ “method”: “ad-hoc” [15:15:53]: ▸ } [15:15:53]: ▸ ----------------------------------------- [15:15:53]: $ /usr/bin/xcrun /usr/local/lib/ruby/gems/2.4.0/gems/fastlane-2.54.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist ‘/var/folders/bv/tddgsgkd199dln6j0dh29xcr0000gq/T/gym_config20170824-4326-14mlgof.plist’ -archivePath /Users/akshay/Library/Developer/Xcode/Archives/2017-08-24/myApp-720000-AdHoc\ 2017-08-24\ 15.11.14.xcarchive -exportPath ‘/var/folders/bv/tddgsgkd199dln6j0dh29xcr0000gq/T/gym_output20170824-4326-1inacd8’

  • xcodebuild -exportArchive -exportOptionsPlist /var/folders/bv/tddgsgkd199dln6j0dh29xcr0000gq/T/gym_config20170824-4326-14mlgof.plist -archivePath ‘/Users/akshay/Library/Developer/Xcode/Archives/2017-08-24/myApp-720000-AdHoc 2017-08-24 15.11.14.xcarchive’ -exportPath /var/folders/bv/tddgsgkd199dln6j0dh29xcr0000gq/T/gym_output20170824-4326-1inacd8 2017-08-24 15:15:54.110 xcodebuild[10243:5616449] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path ‘/var/folders/bv/tddgsgkd199dln6j0dh29xcr0000gq/T/myApp_2017-08-24_15-15-54.108.xcdistributionlogs’. /usr/local/lib/ruby/gems/2.4.0/gems/fastlane-2.54.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh: line 61: 10243 Segmentation fault: 11 xcodebuild “$@” [15:18:03]: Exit status: 139

±--------------±-----------------------------+ | Build environment | ±--------------±-----------------------------+ | xcode_path | /Applications/Xcode-beta.app | | gym_version | 2.54.0 | | export_method | ad-hoc | | sdk | iPhoneOS11.0.sdk | ±--------------±-----------------------------+

[15:18:03]: ▸ cd /Users/akshay/GIT/myApp/iOS-App-v2-Fork/myApp [15:18:03]: ▸ export PATH=“/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/Users/akshay/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin” [15:18:03]: ▸ /usr/bin/touch -c /Users/akshay/Library/Developer/Xcode/DerivedData/myApp-hahtdhndnvwbxtbrwgdigxtkqpgq/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/AdHoc-iphoneos/myApp.app.dSYM [15:18:03]: ▸ ** ARCHIVE SUCCEEDED ** [15:18:03]: [15:18:03]: ⬆️ Check out the few lines of raw xcodebuild output above for potential hints on how to solve this error [15:18:03]: 📋 For the complete and more detailed error log, check the full log at: [15:18:03]: 📋 /Users/akshay/Library/Logs/gym/myApp-myApp.log [15:18:03]: [15:18:03]: Looks like fastlane ran into a build/archive error with your project [15:18:03]: It’s hard to tell what’s causing the error, so we wrote some guides on how [15:18:03]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/ [15:18:03]: Before submitting an issue on GitHub, please follow the guide above and make [15:18:03]: sure your project is set up correctly. [15:18:03]: fastlane uses xcodebuild commands to generate your binary, you can see the [15:18:03]: the full commands printed out in yellow in the above log. [15:18:03]: Make sure to inspect the output above, as usually you’ll find more error information there [15:18:03]: [15:18:03]: -------------------

Environment

Please run fastlane env and copy the output below. This will help us help you 👍 If you used --capture_output option please remove this block - as it is already included there.

🚫 fastlane environment 🚫

Stack

Key Value
OS 10.12.6
Ruby 2.4.1
Bundler? false
Git git version 2.13.5 (Apple Git-94)
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.12.6 (16G29)
Ruby Lib Dir /usr/local/Cellar/ruby/2.4.1_1/lib
OpenSSL Version OpenSSL 1.0.2k 26 Jan 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode-beta.app/Contents/Developer/
Xcode Version 9.0

System Locale

Error
No Locale with UTF8 found 🚫

fastlane files:

`./fastlane/Fastfile`
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.103.0"

default_platform :ios

platform :ios do
    
    before_all do
        ENV["SLACK_URL"] = “Slack Web Hook URL”
        
        ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t DAV"
        ENV["FASTLANE_XCODE_LIST_TIMEOUT"] = '60'
        ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = '180'
        
        ENV["FL_HOCKEY_API_TOKEN"] =  “token”
        ENV["FL_HOCKEY_PUBLIC_IDENTIFIER"] = “token”

        clear_derived_data

        ensure_git_status_clean

        #make sure we are on master
#        ensure_git_branch(
#                          branch: 'build-generation'
#                          )

#        pull the latest code
        git_pull

        cocoapods

    end
    
    desc "Set Version to 7.2.0"
    desc "- Increment the Build number"
    lane :update_build_number do
    
        #Make Sure we have the right App version
        increment_version_number(
                             version_number: "7.2.0" # Set a specific version number
                             )
                             
        #increment the build number
        increment_build_number
        
    end
    
    desc "Create an ipa for internal distribution purposes"
    desc "- Specify if its for Automation or not using the 'automation' options while running the lane. Defaults to AdHoc."
    lane :internal_build do |options|
        
        #make sure we have the right Profiles.
        match(type: "adhoc", readonly: true)
        
        configuration = options[:automation] ? "Automation" : "AdHoc"

        # Create the ipa name
        outputDir = "fastlane/builds"
        build_number = get_build_number
        ipaName = "myapp-" + build_number + "-" + configuration + ".ipa"
        
        # generate ipa
        gym(
            workspace: "myapp.xcworkspace",
            silent: false,
            clean: false,
            scheme: "myapp",
            configuration: configuration,
            output_name: ipaName,
            output_directory: outputDir,
            include_bitcode: true,
            export_options: {
            iCloudContainerEnvironment: "Production"
            }
            )
                                     
    end
    
    desc "Creates an ipa for the Automation testing"
    desc "- It Create an INternal Build. Pass the option environment as \"dev\" to point to the myapp Dev server on launch."
    desc "- It will not incrememt the Build number."
    lane :automation_build do |options|
        
        options[:environment] == "dev" ? internal_build(automation: true) : internal_build
    end
    
    
    #   Generating Documentation  #############################
    desc "generate Documentation"
    lane :generate_docs do
        jazzy
    end
    
    
    #Commiting and creating a pull request
    desc "Commit the version changes to git"
    desc "- This will not update the build numbers"
    desc "- Creates a new tag with the same build number as its set in the project."
    lane :commit_version_to_git do

    #tag the build
    tag = "builds/#{get_version_number}/v#{get_build_number}"

        if !git_tag_exists(tag: tag)

            #commit the version bump
            commit_version_bump(
                               message: "Version Bump",
                               force: true)
            add_git_tag(tag: tag)
            push_git_tags
            push_to_git_remote
           
        end
    end

    desc "Upload Build to Testflight for Testing. It Does the following"
    desc "- Pass in true/false for option 'release' to enable/disable the developer settings."
    desc "- Sets the Version to 7.2.0 and increments the build Number. You can pass the build number with  build_number option to set a specific build number."
    desc "- Match the appstore provisioning profiles"
    desc "- Create the iPa for the configuration based on the lane options"
    desc "- Read the Changelog.txt and Use pilot to upload a build to testflihght"
    desc "- Refresh the DSYM files, download and upload them to Hockey App"
    desc "- Posts a Message on dev-qa Slack Channel"
    lane :testflight_build  do |options|


        #Make Sure we have the right App version
        increment_version_number(
                         version_number: "7.2.0" # Set a specific version number
                         )
                         

        #increment the build number
        if options[:build_number]
            increment_build_number(build_number: options[:build_number])
        else
            increment_build_number
        end
        
        #make sure we have the right Profiles.
        match(type: "appstore", readonly: true)
        
        #create the ipa for Testflight
        
        # Create the ipa name
        build_number = get_build_number
        ipaName = "myapp-" + build_number + "-Testflight.ipa"
        
        outputDir = "fastlane/builds"
        outputPath = outputDir + "/" + ipaName

        configuration = options[:release] ? "Release" :  "Testflight"
        
        # generate ipa
        gym(
            workspace: "myapp.xcworkspace",
            silent: false,
            clean: false,
            scheme: "myapp",
            configuration: configuration,
            output_name: ipaName,
            output_directory: outputDir,
            include_bitcode: true
            )
            
        #commit to git
        commit_version_to_git
        
        changelog = File.read("Changelog.txt")

        # Upload to testflight
        pilot(
              skip_submission: true,
              distribute_external: false,
              skip_waiting_for_build_processing: false,
              update_build_info_on_upload: true,
              changelog: changelog,
              ipa: $outputPath
              )
        
        #post to Slack
        slack(message: "New build is now Available on TestFlight",
              payload: {
              'Version' => get_version_number,
              'Build' => get_build_number,
              'What\'s new' => changelog,
              },
              success: true,
              default_payloads: []
              )
              
#        #Refresh dsym files
#        refresh_dsyms
    end
   
    desc "Upload a new update to the Hockeyapp and Distribute"
    desc "- It increament the Build number"
    desc "- Creates an AdHoc Build"
    desc "- Commits and tags the version"
    desc "- Uploads to Hockey App for testing"
    desc "- Uploads the DSYMs generated to Hockey App"
    desc "- Posts a Message on dev-qa Slack Channel"
    lane :hockeyapp_build do
        
        update_build_number

        internal_build
        
        commit_version_to_git

        changelog = File.read("Changelog.txt")
        
        hockey(notes: changelog)
        
        slack(message: "A New iOS build is available on HopckeyApp.",
              payload: {
              'Version' => get_version_number,
              'Build' => get_build_number,
              'What\'s new' => changelog,
              'Download' => lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK]
              },
              success: true,
              default_payloads: []
              )

        clean_build_artifacts

    end
    
    
    desc "Refreshing DSYM from the latest testflight build and upload to Hockey App"
    lane :refresh_dsyms do
        
        currentVersion = get_version_number
        buildNumber = latest_testflight_build_number

        download_dsyms(version: currentVersion, build_number: buildNumber.to_s)

        lane_context[SharedValues::DSYM_PATHS].each do | dsym_file |
            hockey(upload_dsym_only: true, dsym: dsym_file)
        end

        clean_build_artifacts
    end
    
    
    after_all do |lane|
        # This block is called, only if the executed lane was successful
        
    end
    
    error do |lane, exception|
         slack(
           message: exception.message,
           success: false,
           default_payloads: []
         )
    end
end


# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md

# fastlane reports which actions are used
# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer
`./fastlane/Appfile`
app_identifier "com.company.myapp" # The bundle identifier of your app
apple_id "akshay@getmyapp.com" # Your Apple email address

team_id “TEAM_ID”  # Developer Portal Team ID

# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md

fastlane gems

Gem Version Update-Status
fastlane 2.54.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.1.0
slack-notifier 1.5.1
rouge 1.11.1
xcpretty 0.2.6
terminal-notifier 1.7.1
unicode-display_width 1.1.3
terminal-table 1.7.3
plist 3.2.0
CFPropertyList 2.3.5
public_suffix 2.0.5
addressable 2.5.1
multipart-post 2.0.0
word_wrap 1.0.0
tty-screen 0.5.0
babosa 1.0.2
colored 1.2
highline 1.7.8
commander-fastlane 4.4.5
excon 0.55.0
faraday 0.12.0.1
unf_ext 0.0.7.2
unf 0.1.4
domain_name 0.5.20170404
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
fastimage 2.1.0
gh_inspector 1.0.3
uber 0.0.15
declarative 0.0.9
declarative-option 0.1.0
representable 3.0.4
retriable 2.1.0
mime-types-data 3.2016.0521
mime-types 3.1
little-plugger 1.1.4
multi_json 1.12.1
logging 2.2.1
jwt 1.5.6
memoist 0.15.0
os 0.9.6
signet 0.7.3
googleauth 0.5.1
httpclient 2.8.3
google-api-client 0.12.0
json 2.0.2
mini_magick 4.5.1
multi_xml 0.6.0
rubyzip 1.2.1
security 0.1.3
xcpretty-travis-formatter 0.0.4
dotenv 2.2.0
bundler 1.14.6
faraday_middleware 0.11.0.1
io-console 0.4.6
openssl 2.0.3
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.3
xcodeproj 1.5.1

generated on: 2017-08-24

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 37 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Same situation here. What helped was to add export_options: { compileBitcode: false } to gym options.

Same issue on the GM, disabling compileBitcode fixes it. Also in Xcode.

It seems like this issue might be related to code signing 🚫

Have you seen our new Code Signing Troubleshooting Guide? It will help you resolve the most common code signing issues 👍

I have the same issue:

  • Bitcode is completely deactivated in xcode project
  • Appstore builds succeeds
  • Adhoc builds fail

But adding export_options(compileBitcode: false) in Gymfile solves this issue

I believe I was having the same issue with Xcode 9 beta 6. For me, it was with an Enterprise build. Command line builds would fail at the same point, after the ** archive succeeded ** message in the log. I too experienced a crash when attempting to export the archive directly from the organizer in Xcode.

For us, I believe it has to do with Bitcode. Haven’t determined why yet, but it may have to do with a framework we are using. To get around the issue, I did the following:

In Xcode, during the export archive process, I unchecked the ‘Rebuild from BitCode’ option. After that, I could successfully export my archive. I would note that if I waited and did nothing on this options screen, I eventually got an error message about Xcode being unable to verify bitcode in a framework we are using. I believe this is the issue.

For Fastlane / command line builds, the equivalent is to use (or add to) an export options.plist with the following key:

	<key>compileBitcode</key>
	<false/>

If the above solution does not work, you may check the details of IDEDistributionPipeline.log located somewhere similar to /var/folders/.../ProjectName_2017-10-15_15-99-99.999.xcdistributionlogs/.

My first problem is that the /usr/bin/xattr -c command does not work. It is because I replaced the OSX pre-installed xattr with PyPi, which is different from the OSX’s own patched xattr. You may download the source and build it yourself (Link).

After that, I meet second problem which is something related to _CodeSignature rsync bla bla bla. To fix it, I added uploadSymbols: false to the gym options like that:

gym(
  scheme: "ProjectName",
  export_xcargs: "-allowProvisioningUpdates",
  export_options: {
    compileBitcode: false,  # let's disable it. Xcode 9.0 is buggy.
    uploadSymbols: false    # symbol extraction in Xcode 9.0 does not work.
  }
) # Build your app - more options available

So is the compileBitcode required now? Should we set it to false by default?

The suggestions here helped with the same issue I was having with Jenkins.

xcodebuild -exportArchive -archivePath archive/myapp.xcarchive -exportPath archive -exportOptionsPlist adHoc.plist

ERROR: Segmentation fault: 11 xcodebuild …

I had to add my provisioning profiles to my adHoc.plist

<key>provisioningProfiles</key>
<dict>
    <key>com.company.myapp</key>
    <string>myapp Ad Hoc Provisioning Profile</string>
</dict>	

then finally I had to add the bitcode key/value

<key>compileBitcode</key>
<false/>

I’d say that it’s related to a known issue in their Release notes: Xcode 9 Release notes

When exporting an ad-hoc or enterprise IPA, Swift symbol stripping requires enabling app thinning or Rebuild from Bitcode. For more information, see Distribution options in Xcode Help. (31737836) Workaround: Enable app thinning or Rebuild from Bitcode when exporting the app.

So, we’ve seen that using Xcode 9 , it crashes if we enable bitcode for Ad-Hoc, and doesn’t for AppStore. Therefore, we are doing the same with the Gymfile. For the lane that exports as AdHoc, we disable Bitcode, and leave it as is for the AppStore one.

For those still stuck…you may want to peek into the xcdistributionlogs directory. It’s location is printed out by xcodebuild.

2017-09-20 16:51:32.210 xcodebuild[96203:5370628] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path ‘/var/folders/p6/kqswm9j13_7d9vwppx1yymzm0000gn/T/Helios_2017-09-20_16-51-32.209.xcdistributionlogs’.

Jump in there and look at the IDEDistributionPipeline.log, the end of that file will have some hints as to when Xcode crashed.

In particular, it seems that Xcode 9 behaves differently than Xcode 8, where it tries to xattr some symlinked files in framework we have, and does not handle the failure.

@ohayon Yes, and Xcode also crashes when selecting “compile bitcode” from Xcode 9’s GUI when exporting and adhoc or enterprise build.

I’m still getting the issue with the GM 😞 Though disabling bitcode has fixed it 👍

Enabling bitcode on xcode too just makes it crash. So I am thinking it’s mostly an issue with Xcode beta, which might get resolved in the next version. Release is due in few days. So may be we can wait it out.

Regards, Akshay Hegde

On Sep 8, 2017, 12:57 AM +0530, Felix Krause notifications@github.com, wrote:

So is the compileBitcode required now? Should we set it to false by default? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Just adding this here in case somebody stumbles onto the same problem as me. I’m using Jenkins on our buildservers to produce automated builds.

I was getting this “Segmentation fault: 11” crash, tried everything on this thread and nothing worked.

I then tried running it from a terminal on our servers and a permission popup to allow access to the cert popped up, after I clicked Always Allow it no longer crashed on automated builds…

Set this to Build settings ENABLE_BITCODE = NO in XCode GM works for me