How to create a Universal cef.framework for MacOS

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

How to create a Universal cef.framework for MacOS

Postby lypkiller » Thu Dec 24, 2020 3:53 am

Hi guys,
How to create a universal cef.framework includes x86_64 and arm64 for MacOS? especially for snapshot_blob.bin.
I refer to the "Universal Builds" https://chromium.googlesource.com/chromium/src.git/+/master/docs/mac_arm64.md#universal-builds, and tried to create a universal Chromium Embedded Framework.framework for version:4280. But because there are 2 following files in folder "Resources":
snapshot_blob.bin
v8_context_snapshot.x86_64.bin or v8_context_snapshot.arm64.bin


For v8_context_snapshot.bin, it has its own name for different architecture, so the script could handle it. But for snapshot_blob.bin, it has same name in x86_64 and arm64, but the file contents in different architecture are different, so the tool lipo couldn't know how to deal with it:
# universalizer.py Chromium\ Embedded\ Framework.framework arm64/Chromium\ Embedded\ Framework.framework out.framework
fatal error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't figure out the architecture type of: Chromium Embedded Framework.framework/Resources/snapshot_blob.bin


The size of snapshot_blob.bin:
# ls Chromium\ Embedded\ Framework.framework/Resources/snapshot_blob.bin -rlta
-rw-r--r-- 1 xxx staff 51441 Dec 12 17:35 'Chromium Embedded Framework.framework/Resources/snapshot_blob.bin'
# Release ls arm64/Chromium\ Embedded\ Framework.framework/Resources/snapshot_blob.bin -rlta
-rw-r--r-- 1 xxx staff 51335 Dec 15 10:51 'arm64/Chromium Embedded Framework.framework/Resources/snapshot_blob.bin'


According to REAMDE.txt:
snapshot_blob.bin, v8_context_snapshot.[x86_64|arm64].bin <= V8 initial snapshot, and they are "Required components"!!!


Look like, different architecture has its own snapshot_blob.bin.

I have done following testing:
1. Delete snapshot_blob.bin
test some website, look like cefclient.app works without snapshot_blob.bin on x86_64 and arm64 architecture

2. Use the snapshot_blob.bin of x86_64 on arm64
cefclient.app on arm64 works with the snapshot_blob.bin of x86_64.

Above all, look like snapshot_blob.bin is non-essential. But I'm no sue if it would error out in some other cases.

My question:
1. Can I delete snapshot_blob.bin?
2. Can I replace the the snapshot_blob.bin of arm64 with the file of x86_64?
3. or Can we change the config file not to generate the snapshot_blob.bin?

Regards
lypkiller
Techie
 
Posts: 12
Joined: Mon Jan 20, 2020 4:14 am

Re: How to create a Universal cef.framework for MacOS

Postby magreenblatt » Thu Dec 24, 2020 9:09 pm

How is the Chrome universal app bundle structured? Does it contain the bin file for both architectures?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to create a Universal cef.framework for MacOS

Postby lypkiller » Thu Dec 24, 2020 10:12 pm

magreenblatt wrote:How is the Chrome universal app bundle structured? Does it contain the bin file for both architectures?

magreenblatt,
The Chrome doesn't provide a universal app for MacOS. Just provide 2 different installer for different architecture.

Any idea to rename snapshot_blob.bin? or change the config file not to generate the snapshot_blob.bin?

Thanks for your patience.
lypkiller
Techie
 
Posts: 12
Joined: Mon Jan 20, 2020 4:14 am

Re: How to create a Universal cef.framework for MacOS

Postby magreenblatt » Thu Dec 24, 2020 10:24 pm

I would say leave it out, since it’s not required in your testing, and wait to see how Chromium resolves the conflict in future versions, if it’s not already explicitly handled by the universalizer.py script.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to create a Universal cef.framework for MacOS

Postby lypkiller » Tue Dec 29, 2020 3:06 am

magreenblatt wrote:I would say leave it out, since it’s not required in your testing, and wait to see how Chromium resolves the conflict in future versions, if it’s not already explicitly handled by the universalizer.py script.

magreenblatt,
Thank you. I also have found a solution to build the cef with "v8_use_external_startup_data=false" to avoid generating snaphost_blob.bin
lypkiller
Techie
 
Posts: 12
Joined: Mon Jan 20, 2020 4:14 am

Re: How to create a Universal cef.framework for MacOS

Postby mmarczell » Mon Mar 21, 2022 8:37 am

Hello,

It says here that it is not recommended to leave out the snapshot data as that would increase startup time tenfold: https://stackoverflow.com/questions/380 ... artup-data
Also there is a resources.pak file that is different between the two target platforms.
How should one create a universal CEF framework with these in mind?
mmarczell
Newbie
 
Posts: 6
Joined: Wed Feb 26, 2020 6:06 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 96 guests

cron