Skip to content

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

Closed
@okiabrian123

Description

@okiabrian123

---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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions