Cannot reduce bitcode size iOS

183 views
Skip to first unread message

Hamed Hosseini

unread,
Jul 20, 2021, 2:41:59 PM7/20/21
to discuss-webrtc
Hi 
I need to enable bitcode for my project but when I enabled the bitcode size of binary created goes up to 700 MB for the WebRTC file.
I use lipo -info to check the architecture of the file but only one arm64 exists.
I know in recent webrtc min requirement is ios 12, and 32-bit architecture was removed
but why the file size is huge for one architecture?
I use build_ios_libs.py --bitcode to build the xcframework file.
every time I run bitcode enable on a real device it takes a long time to copy the framework to the device.
I see in this repo he created a small file size binary with bitcode enabled.
How can I create like above link?

Hamed Hosseini

unread,
Jul 28, 2021, 12:49:24 AM7/28/21
to discuss-webrtc

I can't understand why nobody answered this question. it's the basic and fundamental question and must place on the instruction in the document page but no one explained it!. 

Medusa Development

unread,
Jul 28, 2021, 5:50:03 AM7/28/21
to discuss...@googlegroups.com
-- did you compare the bitcode size to the non bitcode size of your builds?
-- did you compile without debug or debug symbols?


--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/6b9e2559-9373-4f74-8891-64ee289e6088n%40googlegroups.com.

Denis Slobodskoy

unread,
Apr 22, 2022, 4:09:49 PM4/22/22
to discuss-webrtc
Did anyone have a solution for a bitcode?
I also tried to use build_ios_libs.py  —bitcode , it was failed due to --llvm flag. Then I removed this from build/config/compiler/BUILD.gn:

    # TODO(hans): Remove this once Clang generates better optimized debug info
    # by default. https://crbug.com/765793
    cflags += [
      "-mllvm",
      "-instcombine-lower-dbg-declare=0",
    ]


It was able to create .xcframework after that, but library size is huge indeed, near 500 MB - and even if I try to use it, it failed on initialisation.
Without bitcode, library size is only 7.1 Mb, and debug version (which use -fembed-bitcode-marker instead) took 33.8 Mb so difference is really enormous.
Any ideas how to tame it?

Regards,
Denis Slobodskoy


среда, 28 июля 2021 г. в 19:50:03 UTC+10, medusade:

Denis Slobodskoy

unread,
Apr 22, 2022, 4:09:59 PM4/22/22
to discuss-webrtc
Hello
I found an setting which caused library to expand dramatically, this line in build_ios_libs.py :

  gn_args.append('use_lld=' + ('false' if use_bitcode else 'true'))

If I remove it or set 'use_lld=true' unconditionally, library size become normal (~7Mb).
I did not use it in practice, but seems target library can be linked successfully in Xcode project.
It there any actual reason for use_lld=false, or it some artefact?

Regardsm
Denis Slobodskoy 

среда, 28 июля 2021 г. в 19:50:03 UTC+10, medusade:
-- did you compare the bitcode size to the non bitcode size of your builds?
Reply all
Reply to author
Forward
0 new messages