skip to Main Content

First, I’m building a Flutter app for Android and iOS. While building and running on Android is working fine the iOS build is failing since I added SQLite support.

flutter run --debug
Changing current working directory to: /Users/jj/git/kellermeister/kellermeister
Launching lib/main.dart on iPhone 12 in debug mode...
Running Xcode build...
Xcode build done.                                            5,3s
Failed to build iOS app
Lexical or Preprocessor Issue (Xcode): 'sqlite3.h' file not found
/Users/jj/git/kellermeister/kellermeister/ios/Pods/SQLite.swift/Sources/SQLiteObjc/fts3_tokenizer.h:26:8


Could not build the application for the simulator.
Error launching application on iPhone 12.
/Users/jj/git/kellermeister/kellermeister/ios>

While I can see that sqlite3.h cannot be resolved I can say that a sqlite3.h could be found in:

./Pods/sqlite3/sqlite-src-3430100/sqlite3.h

My knowledge about Xcode and it’s build configuration is quite limited. Also, I expected that flutter would do the magic for me here πŸ˜‰

I tried already the hints which I found on the net:

rm Podfile.lock
pod install --repo-update
flutter clean
flutter run --debug

Here is my Podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

Finally the output from flutter doctor -v:

flutter doctor -v
[βœ“] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-x64, locale de-DE)
    β€’ Flutter version 3.13.6 on channel stable at /usr/local/Caskroom/flutter/3.10.6/flutter
    β€’ Upstream repository https://github.com/flutter/flutter.git
    β€’ Framework revision ead455963c (vor 4 Wochen), 2023-09-26 18:28:17 -0700
    β€’ Engine revision a794cf2681
    β€’ Dart version 3.1.3
    β€’ DevTools version 2.25.0

[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    β€’ Android SDK at /Users/jj/android-sdk-macosx
    β€’ Platform android-34, build-tools 33.0.1
    β€’ ANDROID_HOME = /Users/jj/android-sdk-macosx
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Build 15A507
    β€’ CocoaPods version 1.13.0

[βœ“] Chrome - develop for the web
    β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[βœ“] Android Studio (version 2022.3)
    β€’ Android Studio at /Applications/Android Studio.app/Contents
    β€’ Flutter plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
    β€’ Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[βœ“] IntelliJ IDEA Ultimate Edition (version 2021.3.1)
    β€’ IntelliJ at /Applications/IntelliJ IDEA.app
    β€’ Flutter plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart

[βœ“] IntelliJ IDEA Community Edition (version 2023.2.2)
    β€’ IntelliJ at /Applications/IntelliJ IDEA CE.app
    β€’ Flutter plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin version 232.9559.10

[βœ“] VS Code (version 1.83.1)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.23.0

[βœ“] Connected device (3 available)
    β€’ iPhone 12 (mobile) β€’ FDD35D44-C239-411C-BC36-2637F12451CE β€’ ios            β€’ com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    β€’ macOS (desktop)    β€’ macos                                β€’ darwin-x64     β€’ macOS 14.0 23A344 darwin-x64
    β€’ Chrome (web)       β€’ chrome                               β€’ web-javascript β€’ Google Chrome 118.0.5993.88

[βœ“] Network resources
    β€’ All expected network resources are available.

β€’ No issues found!

Any help is highly appreciated as I’m really stuck currently.

3

Answers


  1. Chosen as BEST ANSWER

    The solution was to remove explicit dependencies sqlite3_flutter_libs and (dev) sqflite_common_ffi. This resolved the issue of unresolved sqlite3.h.

    I also had to set ENABLE_USER_SCRIPT_SANDBOXING=NO so that the build process could write required files.


  2. I am assuming you are using the following package

    https://pub.dev/packages/sqlite3

    which provides dart bindings via ffi

    If you are running this on Mac M1 please make sure to reinstall ffi accordingly and retry pod install

    gem uninstall ffi && gem install ffi — –enable-libffi-alloc

    rm Podfile.lock
    flutter clean
    flutter pub get
    pod install –repo-update
    flutter run –debug

    Login or Signup to reply.
  3. maybe this will help you:
    take a look if you have any relative Paths underΒ 
    Target ==> Built Settings ==> Framework search

    If yes change them to absolute paths.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search