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

error in macos Android Studio and temporary fix #27

Open
okiabrian123 opened this issue Nov 17, 2022 · 8 comments
Open

error in macos Android Studio and temporary fix #27

okiabrian123 opened this issue Nov 17, 2022 · 8 comments

Comments

@okiabrian123
Copy link

okiabrian123 commented Nov 17, 2022

after read #11, i will update this, update 30 nov 2022,
error :

clang: error: no such file or directory: 'Embedded'
clang: error: no such file or directory: 'Framework'

u must clear "other linker flags" in Runner.xcodeproj

  1. open project folder, open macos folder
  2. open Runner.xcodeproj, click Runner, open "Build Settings"
  3. scroll and looking for "Lingking"
  4. clearing "Other Linker Flags"

Screenshot 2022-11-30 at 02 36 36

@okiabrian123 okiabrian123 changed the title error in macos Android Studio and temperory fix error in macos Android Studio and temporary fix Nov 17, 2022
@hlwhl
Copy link
Owner

hlwhl commented Nov 29, 2022

I have tested with s.vendored_frameworks = '"third/cef/Chromium Embedded Framework.framework"'. It is the reason caused the error2 you mentioned above.

Leave s.vendored_frameworks = 'third/cef/Chromium Embedded Framework.framework' as it is, delete 'Podfile.lock' and execute flutter clean in example folder, it works as intended. The framework file will be copy to app bundle automatically.

@okiabrian123
Copy link
Author

okiabrian123 commented Nov 29, 2022

i got this error
"clang: error: no such file or directory: 'Embedded'
clang: error: no such file or directory: 'Framework'
Command Ld failed with a nonzero exit code"

but when i run the new example there is no error.
I don't know what's different in my example and my project.

@okiabrian123
Copy link
Author

okiabrian123 commented Nov 29, 2022

after read this
clearing "other linker flag" and then its working. thank you
i will edit my text on above, maybe someone need this on english
Screenshot 2022-11-30 at 02 36 36

@hlwhl hlwhl pinned this issue Nov 30, 2022
@adrianjagielak
Copy link

Clearing Other Linker Flags is causing problems with some plugins, for example with firebase_analytics:

Launching lib/app/main.dart on macOS in debug mode...
Running pod install...
Building macOS application...
ld: warning: ignoring duplicate library '-lc++'
ld: warning: duplicate -rpath '/usr/lib/swift' ignored
ld: warning: duplicate -rpath '@executable_path/../Frameworks' ignored
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: Undefined symbols:
  _FIRConsentStatusDenied, referenced from:
      -[FLTFirebaseAnalyticsPlugin setConsent:withMethodCallResult:] in firebase_analytics[4](FLTFirebaseAnalyticsPlugin.o)
      -[FLTFirebaseAnalyticsPlugin setConsent:withMethodCallResult:] in firebase_analytics[4](FLTFirebaseAnalyticsPlugin.o)
  _FIRConsentStatusGranted, referenced from:
      -[FLTFirebaseAnalyticsPlugin setConsent:withMethodCallResult:] in firebase_analytics[4](FLTFirebaseAnalyticsPlugin.o)
      -[FLTFirebaseAnalyticsPlugin setConsent:withMethodCallResult:] in firebase_analytics[4](FLTFirebaseAnalyticsPlugin.o)
  _FIRConsentTypeAdStorage, referenced from:
      -[FLTFirebaseAnalyticsPlugin setConsent:withMethodCallResult:] in firebase_analytics[4](FLTFirebaseAnalyticsPlugin.o)
  _FIRConsentTypeAnalyticsStorage, referenced from:
      -[FLTFirebaseAnalyticsPlugin setConsent:withMethodCallResult:] in firebase_analytics[4](FLTFirebaseAnalyticsPlugin.o)
  _OBJC_CLASS_$_FIRAnalytics, referenced from:
       in firebase_analytics[4](FLTFirebaseAnalyticsPlugin.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **

Exception: Build process failed

@adrianjagielak
Copy link

I've fixed it locally without clearing Other Linker Flags using this quick and dirty Dart script:

import 'dart:io';

// Fix for package:webview_cef, see https://github.com/hlwhl/webview_cef/issues/27
void main() {
  const List paths = [
    'macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig',
    'macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig',
    'macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig',
  ];

  for (final path in paths) {
    File(path).writeAsStringSync(
      File(path)
          .readAsStringSync()
          .replaceAll('-ObjC Embedded Framework ', '')
          .replaceAll('-framework "Chromium"', '-framework "Chromium Embedded Framework"'),
    );
  }
}

Assuming you will put this in tool/webview_cef_linker_fix.dart just run dart tool/webview_cef_linker_fix.dart in terminal when the build fails (probably only needed after each flutter pub get).

@bahricanyesil
Copy link

bahricanyesil commented Dec 11, 2023

I've fixed it locally without clearing Other Linker Flags using this quick and dirty Dart script:

import 'dart:io';

// Fix for package:webview_cef, see https://github.com/hlwhl/webview_cef/issues/27
void main() {
  const List paths = [
    'macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig',
    'macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig',
    'macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig',
  ];

  for (final path in paths) {
    File(path).writeAsStringSync(
      File(path)
          .readAsStringSync()
          .replaceAll('-ObjC Embedded Framework ', '')
          .replaceAll('-framework "Chromium"', '-framework "Chromium Embedded Framework"'),
    );
  }
}

Assuming you will put this in tool/webview_cef_linker_fix.dart just run dart tool/webview_cef_linker_fix.dart in terminal when the build fails (probably only needed after each flutter pub get).

Did not work for me, do you have any solutions or possible reasons? I checked manually and did not see any of the replaced values in those files. @adrianjagielak

@adrianjagielak
Copy link

adrianjagielak commented Dec 11, 2023

Did not work for me, do you have any solutions or possible reasons? I checked manually and did not see any of the replaced values in those files. @adrianjagielak

What is your current content of macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig?

@bahricanyesil
Copy link

Did not work for me, do you have any solutions or possible reasons? I checked manually and did not see any of the replaced values in those files. @adrianjagielak

What is your current content of macos/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig?

I'm sorry for the late late response but I just wanted to write this to clear up any doubts that may arise in the minds of those who will read it. I do not know what was the problem at that time but currently, I do not have any problem. Replacing the following (just as you did in your dart script) works without any problem for me also:

  1. .replaceAll('-ObjC Embedded Framework ', '')
  2. .replaceAll('-framework "Chromium"', '-framework "Chromium Embedded Framework"')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants