Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not build with bitcode enabled #369

Closed
ChrisLmis opened this issue Mar 30, 2021 · 3 comments
Closed

Can not build with bitcode enabled #369

ChrisLmis opened this issue Mar 30, 2021 · 3 comments
Labels
ios This issue is specific to the iOS/iPadOS Platform.

Comments

@ChrisLmis
Copy link

I need to compile the app with bitcode enabled. When bitcode is enabled, I get the following build error:

ld: -U and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together

This is a result of the setup requirements for this plugin where you have to add these linker flags:

-Wl,-U,_FlutterUnityPluginOnMessage

I understand that this is required to allow Unity to talk to Flutter. Is there any way around this problem?

@juicycleff juicycleff added the ios This issue is specific to the iOS/iPadOS Platform. label Mar 31, 2021
@juicycleff
Copy link
Owner

@ChrisLmis I'm looking for another alternative to fixing this. It's top of my todo list

@tuanha2000vn
Copy link

tuanha2000vn commented Apr 1, 2021

A temporary fix is to add these line to the end of podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config| 
      config.build_settings['ENABLE_BITCODE'] = 'NO' 
    end 
  end
end

If you still have issue, try this full Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '10.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__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config| 
      config.build_settings['ENABLE_BITCODE'] = 'NO' 
    end 
  end
end

I've spend 6 hour today to get the project compiled, it's not fun...

@juicycleff
Copy link
Owner

This was fixed in v4.1.0, please use a matching unitypackage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ios This issue is specific to the iOS/iPadOS Platform.
Projects
None yet
Development

No branches or pull requests

3 participants