facebook / hermes

A JavaScript engine optimized for running React Native.

Home Page:https://hermesengine.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iphoneos framework very large size issue (build-apple-framework.sh)

wonhee-jeong opened this issue · comments

Problem

When building the iphoneos framework in the build-apple-framework.sh script, bitcode is enabled and the binary size is very large (more than 500MB).
Bitcode is disabled in scripts in the react native repository.

Solution

In build-apple-framework.sh, set -DHERMES_ENABLE_BITCODE:BOOLEAN=false

cmake -S . -B "build_$1" -G "$BUILD_SYSTEM" \
    -DHERMES_APPLE_TARGET_PLATFORM:STRING="$1" \
    -DCMAKE_OSX_ARCHITECTURES:STRING="$2" \
    -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$3" \
    -DHERMES_ENABLE_DEBUGGER:BOOLEAN="$enable_debugger" \
    -DHERMES_ENABLE_INTL:BOOLEAN=true \
    -DHERMES_ENABLE_LIBFUZZER:BOOLEAN=false \
    -DHERMES_ENABLE_FUZZILLI:BOOLEAN=false \
    -DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false \
    -DHERMES_ENABLE_BITCODE:BOOLEAN=false \
    -DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=true \
    -DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true \
    -DHERMES_ENABLE_TOOLS:BOOLEAN="$build_cli_tools" \
    -DIMPORT_HERMESC:PATH="$PWD/build_host_hermesc/ImportHermesc.cmake" \
    -DCMAKE_INSTALL_PREFIX:PATH=../destroot \
    -DCMAKE_BUILD_TYPE="$BUILD_TYPE"

The iOS build scrips in the Hermes directory are outdated and unmaintained. We should just delete them.

Thank you for the kind explanation.
That was just an example script.

What is the correct/recommended way to build ios framework if those scripts under utils are no longer relevant?

Thanks a lot!
P.S. What'd be the option for those who want to build and use Hermes as a standalone artifact?

@ZkGator Hermes uses CMake and can be built for any supported OS and likely for some unsupported ones. That hasn't changed. Check our CI scripts for examples. The only thing we are no longer doing is providing a packaged configuration script for iOS framework and a podspec, but those are available from React Native in the link above.

Thanks!