Having trouble building an app with fastlane

ios
fastlane
xcode
#1

Hi all,
I’m new to CircleCI for mobile apps even if I use the plateform for backend CI/CD all the time.
I’m having trouble building an iOS app on CircleCi with fastlane. The build works nicely locally but seems to be broken on CircleCI. The code mixes Objective-C/Objective-C++/C++ and swift as well.
I’m using Xcode 10.1 for this build.

These are the kind of errors I’m having during build. Any help is welcome :slight_smile:

❌  /usr/include/libxml2/module.modulemap:1:8: redefinition of module 'libxml2'
[05:32:39]: ▸ module libxml2 [system] [extern_c] {
[05:32:39]: ▸        ^
[05:32:39]: ▸ ❌  /Applications/Xcode-10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:10: could not build module 'Dispatch'
[05:32:39]: ▸ #include <dispatch/dispatch.h>
[05:32:39]: ▸        ^
[05:32:39]: ▸ ❌  /Applications/Xcode-10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: could not build module 'CoreFoundation'
[05:32:39]: ▸ #include <CoreFoundation/CoreFoundation.h>
[05:32:39]: ▸  ~~~~~~~~^
1 Like
#2

It may help readers if they can see your configuration YAML file, and an indication of what command you are using that causes this error.

redefinition of module 'libxml2'

Have you checked to see whether other people have had the same issue? This search makes me think there are plenty of potential solutions out there worth trying.

#3

Hi Halfer, thx for the reply.
Concerning the redefinition of libxml2 I’ve mostly tried a lot of things to solve the issue but none of them is working for me. The weired part is that building it locally even with fastlane is perfectly working but not in the cloud on CircleCI. Must be a configuration problem somewhere, but I don’t know where to look yet.
The command making the build fail is actually the build command launched through gym in fastlane.
here are the YAML and Fastfile file I use :

# .circleci/config.yml

version: 2
jobs:
  build:
    branches:
      only:
        - feature-fastlane
    macos:
      xcode: "10.1.0"
    working_directory: /Users/distiller/project
    environment:
      FL_OUTPUT_DIR: output
      FASTLANE_LANE: beta
    shell: /bin/bash --login -o pipefail
    steps:
      - checkout
      - restore_cache:
          key: 1-gems-{{ checksum "Gemfile.lock" }}
      - run: bundle check || bundle install --path vendor/bundle
      - save_cache:
          key: 1-gems-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle
      - run:
          name: fastlane
          command: bundle exec fastlane $FASTLANE_LANE
      - store_artifacts:
          path: output
      - store_test_results:
          path: output/scan

Fastfile :

default_platform(:ios)

platform :ios do
  desc "Push a new beta build to TestFlight"

  before_all do
    setup_circle_ci
  end

  lane :beta do
    clear_derived_data
    sync_code_signing(type: "appstore")
    gym(scheme: "ProjectName", xcargs: "-UseNewBuildSystem=NO", clean: true)
    upload_to_testflight
  end
end

As you can see I also tried adding the -UseNewBuildSystem=NO argument to the build to make Xcode use the legacy build system, but it didn’t’ help.

#4

The way I tackle build problems in general is to use the SSH option in the build screen, and then treat the problem as if it were local. Without SSH it is subject to way too much guesswork.

In other words, forget that it works locally. That is good in itself, but it’s a different environment.

2 Likes
#5

Ok I managed to reproduce it using SSH and it turns out that the mac os versions is 10.13.6 on remote environnement while on my machine it is 10.14
I tried the same Xcode version but with a macos 10.13.6 here at the office and I have the same issue. I have to find out why the app isn’t building on 10.13.6 with Xcode 10.1 meanwhile is there any way to configure the macos version I need for the circleCI build ?

1 Like
#6

Oh I just realized that the Xcode 10.1 image is not available yet with macOS 10.14 installed.

#7

Did you work out a solution in the end @imanzarrabian? I’m having the same issue - the build randomly throws error 65 when touching the app.dsym while we’ve built and uploaded to testflight locally from fresh installs.

Same Xcode versions on both local and CI - only difference we can find is that CI has macos 10.13.6 while we’re on 10.14.

#8

Hi. I was facing this error 65, the problem is that this is used as a general error code as you can see here https://support.circleci.com/hc/en-us/articles/360012553194-fastlane-gym-failed-with-ARCHIVE-FAILED-error-message-exit-status-65-

Hope it will be helpful!

1 Like