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

How to Fix Build Release apps in Macos support arm64 and x86_64 #30

Closed
okiabrian123 opened this issue Nov 25, 2022 · 5 comments
Closed

Comments

@okiabrian123
Copy link

okiabrian123 commented Nov 25, 2022

---update new way 27 NOV 2022, more simple than before
merge 2 cef framework and 2 libcef_dll

  1. download cef for arm64 and intel(x86_64)
  2. make 2 folder, arm64 and x86_64
  3. copy/extract "cef arm64" to arm64 folder and "cef intel(x86_64)" to x86_64 folder
  4. run this command on terminal

merge libcef_dll_wrapper

lipo -create "./arm64/libcef_dll_wrapper.a" "./x86_64/libcef_dll_wrapper.a" -output "./libcef_dll_wrapper.a"

CEF Framework

mkdir "./Chromium Embedded Framework.framework"

lipo -create "./arm64/Chromium Embedded Framework.framework/Chromium Embedded Framework" "./x86_64/Chromium Embedded Framework.framework/Chromium Embedded Framework" -output ./"Chromium Embedded Framework.framework/Chromium Embedded Framework"

Libraries CEF Framework

mkdir "./Chromium Embedded Framework.framework/Libraries"

lipo -create "./arm64/Chromium Embedded Framework.framework/Libraries/libEGL.dylib" "./x86_64/Chromium Embedded Framework.framework/Libraries/libEGL.dylib" -output "./Chromium Embedded Framework.framework/Libraries/libEGL.dylib"

lipo -create "./arm64/Chromium Embedded Framework.framework/Libraries/libGLESv2.dylib" "./x86_64/Chromium Embedded Framework.framework/Libraries/libGLESv2.dylib" -output "./Chromium Embedded Framework.framework/Libraries/libGLESv2.dylib"

lipo -create "./arm64/Chromium Embedded Framework.framework/Libraries/libvk_swiftshader.dylib" "./x86_64/Chromium Embedded Framework.framework/Libraries/libvk_swiftshader.dylib" -output "./Chromium Embedded Framework.framework/Libraries/libvk_swiftshader.dylib"

cp "./arm64/Chromium Embedded Framework.framework/Libraries/vk_swiftshader_icd.json" "./Chromium Embedded Framework.framework/Libraries/vk_swiftshader_icd.json"

Resources CEF Framework

cp -R "./arm64/Chromium Embedded Framework.framework/Resources" "./Chromium Embedded Framework.framework/Resources"

cp "./x86_64/Chromium Embedded Framework.framework/Resources/v8_context_snapshot.x86_64.bin" "./Chromium Embedded Framework.framework/Resources/v8_context_snapshot.x86_64.bin"

Codesign "Chromium Embedded Framework.framework"
u need codesign "Chromium Embedded Framework.framework" for making universal macos apps. if u create applications with separated architectures, you don't need this.
if you dont have developer account, u can codesign"Chromium Embedded Framework.framework" without developer account
i got tutorial from this
u need create a self-signed certificate, click link above

sudo codesign -fs "Name_Of_Certificate" "./Chromium Embedded Framework.framework/Chromium Embedded Framework"

old way :
i was found way to build in MacOS,

  1. u need copy webview_cef(dart package) to project_folder/webview_cef_x86_64
    u have 2, webview_cef(for arm64) and webview_cef_x86_64(for x86_64).
  2. add chromium embedded framework arm64 to webview_cef

next step we need configure webview_cef_x86_64 folder.

  1. add chromium embedded framework intel to webview_cef_x86_64
  2. rename /macos/webview_cef.podspec to /macos/webview_cef_x86_64.podspec
  3. rename /macos/third/cef/libcef_dll_wrapper.a to /macos/third/cef/libcef_dll_wrapper_x86_64.a
  4. and then edit in file, we need to replace, webview_cef to webview_cef_x86_64 in file pubsec.yaml and /macos/webview_cef_x86_64.podspec
  5. and edit /macos/webview_cef_x86_64.podspec
    s.vendored_libraries = 'third/cef/x86_64/libcef_dll_wrapper.a'
    to
    s.vendored_libraries = 'third/cef/x86_64/libcef_dll_wrapper_x86_64.a'
    and
    s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
    to
    s.pod_target_xcconfig = { 'VALID_ARCHS' => 'x86_64' }

we need to configure podspec in webview_cef(for arm64) too.
only
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
to
s.pod_target_xcconfig = { 'VALID_ARCHS' => 'arm64' }

next step need configure pubsec.yaml in project(open with android studio/visual studio or other)
add this to dependencies example :

dependencies:
...
  webview_cef: ^0.0.7
  webview_cef_x86_64:
    path: ./webview_cef_x86_64

finish
run in terminal
flutter build macos
if u got a error, u can see

@okiabrian123
Copy link
Author

@hlwhl im found a new way, and i was update it

@hlwhl
Copy link
Owner

hlwhl commented Nov 28, 2022

@hlwhl im found a new way, and i was update it

@okiabrian123 Thanks for your solution! I'll try your solution and update to main branch.

@okiabrian123
Copy link
Author

okiabrian123 commented Nov 28, 2022

@hlwhl you're welcome, I haven't checked the tutorial above if there is an error or not, if there's an error, tell me

@hlwhl
Copy link
Owner

hlwhl commented Nov 29, 2022

@okiabrian123 Have tested the universal binary solution, it works well and I have updated the solution to readme! Thank you for your effort!

@hlwhl hlwhl closed this as completed Nov 29, 2022
@hlwhl hlwhl removed the in triage label Nov 29, 2022
@MobileD3v3l
Copy link

@okiabrian123 I'm trying to add the h264 codec to the universal package (in order to play mp4 videos), but I think I'm a little lost. Any steps to follow? Thanks.

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

3 participants