Flipper: Boost library support for arm64 and i386 for iOS Simulator(Unable to build and run iOS Sample project for M1 iOS Sim)

Created on 4 May 2021  路  22Comments  路  Source: facebook/flipper

馃悰 Bug Report

I'm unable to build and run the iOS/Sample project.

To Reproduce

  1. clone the repo
  2. cd flipper/iOS/Sample
  3. pod install
  4. open Sample.xcworkspace
  5. On XCode: Run the Sample target

Environment

  • MacOSX: 11.3 (20E232) Apple M1
  • XCode: 12.5 (12E262)
  • iOS Simulator iPhone 11 Pro Max, iOS 14.5
  • cocoapods: 1.10.1
  • Flipper 0.87.0 (50.0.0) - I've tried both the standalone Mac installer as well as the Brew one
  • boost 1.75.0_3 installed via Brew, if relevant

Screenshot 2021-05-04 at 17 45 41

I have the feeling the issue is coming from Flipper-Boost-iOSX but I'm not familiar with the way linking works. Let me know if I can give you more info.

help wanted iOS

Most helpful comment

I'm also getting this issue on my macbook pro corei7 (not M1), I tried Flipper version 0.87.0, 0.88.0, 0.89.0, 0.90.0 and 0.90.2 but still this issue is showing up. I'm using

  • OSX 11.3.1
  • Xcode 12.5
  • RN 0.64.0

thanks,

Edit:
I think the issue show's up when Flipper-Boost-iOSX added/updated. Can anyone suggest a solution with this issue?

Edit 2:
I've found a solution which needs other flipper tools to downgrade.
use_flipper!({ 'Flipper' => '0.87.0', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1' })
This will remove the Flipper-Boost-iOSX which solve the issue when reverting back to 0.87.0 found it on this link https://github.com/facebook/flipper/issues/2248#issuecomment-830060572

All 22 comments

Looking at our setup, we don't seem to be doing anything special as part of our CI builds: https://github.com/facebook/flipper/blob/c2fbff76150ba61bb7dc2db45aea21c4ca2ddac8/.github/workflows/iOS-Sample.yml#L30

@priteshrnandgaonkar Do you have any idea what could be going wrong here?

Thank you for having a look @passy . I noticed GH actions uses XCode 12.4 by default. I've tried building the project on that but no luck.

I've also tried manually adding boost_context.xcframework to _Link Binary With Libraries_ .

Screenshot 2021-05-05 at 16 46 18

The original error is gone but I'm now getting another error:

Undefined symbols for architecture arm64:
  "_jump_fcontext", referenced from:
      folly::fibers::FiberImpl::deactivate() in libFlipper-Folly.a(Fiber.o)
  "_make_fcontext", referenced from:
      folly::fibers::FiberImpl::FiberImpl(folly::Function<void ()>, unsigned char*, unsigned long) in libFlipper-Folly.a(Fiber.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Screenshot 2021-05-05 at 16 50 18

I believe the issue comes from the fact I'm on Apple M1 chip while GH virtual environments use x86 architecture.

Confirming the above. When I open XCode with Rosetta enabled, I'm able to build and run the project.

I am on Big Sur and checked with XCode 12.5 and it worked.

The issue might be that boost prebuilt artifacts doesn't exist for arm64 arch for Simulator, which might be the case for M1 machines. I am trying to build boost for those architectures.

I will recommend to use previous version 0.87.0 till then atleast on M1 machines.

I tried to look for the boost ios libraries. And found two candidates, which are Apple-Boost-BuildScript and boost-iosx.

Currently we are using a forked version of boost-iosx, which doesn't have arm64 and i386 support for simulators. I tried changing the script and tried to build it for arm64 and i386 for sims, but I was facing issues creating a fat library.

I tried Apple-Boost-BuildScript with the patch, as it enables the support of arm64 and i386 for sims. But it doesn't build boost_context for iOS, which is actually used by us.

We would appreciate the community support in this.

The same issue

I've hidden the comments above as the +1 comments don't add any value and a thumbs on the OP provides the same signal. As indicated some help would be appreciated. (N.b.: for the correct general Flipper configuration to use with latest XCode / RN, see: https://github.com/facebook/react-native/issues/31480)

To summarize with regards to iOS setup:

0.87: will support both M1 and non-M1 Mac machines. Please use that for the time being as it works in all the cases for both Mac machine types.

0.88: This version updates all our internal deps like folly, boost and rsocket and it just supports non M1 and non intel mac machines for simulators. It won't work on M1 Mac and intel based machine simulators(if rosetta is not used)). This version will work when built on actual physical device for both M1 and non M1 machines.

We are looking into making our setup more robust and so that these issues won't happen. Please bear with us till then.

@mweststrate I'm with you regarding +1 comments. I just wanted to point out this issue doesn't seem to have much to do with facebook/react-native#31480. The issue here is regarding building flipper (without RN), regardless of the XCode version, on M1 Macs.

@priteshrnandgaonkar thank you very much for taking the time to investigate. I'll give version 0.87 a try. I haven't noticed 0.88 would work with real devices, will try that also.

For what it's worth... I'm getting the exact same errors on 2 separate Intel-based machines as well so I wouldn't necessarily say that it's _solely_ on M1-based Macs.

Of my two test machines, one is running on a dual-core i5, Xcode 12.4, and macOS 11.2.3... the other is running on a quad-core i7, Xcode 12.4, and macOS 11.3.1.

@drewbombard, as mentioned here. i386 arch is missing for boost, thats why it won't work for intel machines too. Please fall back to 0.87

I'm also getting this issue on my macbook pro corei7 (not M1), I tried Flipper version 0.87.0, 0.88.0, 0.89.0, 0.90.0 and 0.90.2 but still this issue is showing up. I'm using

  • OSX 11.3.1
  • Xcode 12.5
  • RN 0.64.0

thanks,

Edit:
I think the issue show's up when Flipper-Boost-iOSX added/updated. Can anyone suggest a solution with this issue?

Edit 2:
I've found a solution which needs other flipper tools to downgrade.
use_flipper!({ 'Flipper' => '0.87.0', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1' })
This will remove the Flipper-Boost-iOSX which solve the issue when reverting back to 0.87.0 found it on this link https://github.com/facebook/flipper/issues/2248#issuecomment-830060572

Same me :(

I have same issue coming in intel mac. Can anybody help me out
Xcode:12.0.1
React native ver : 0.62.0

  • Flipper (0.87.0):

    • Flipper-Folly (~> 2.5)

    • Flipper-RSocket (~> 1.3)

    • Flipper-Boost-iOSX (1.76.0.1.13)

    • Flipper-DoubleConversion (3.1.7)

    • Flipper-Fmt (7.1.7)

    • Flipper-Folly (2.6.7):

    • Flipper-Boost-iOSX

    • Flipper-DoubleConversion

    • Flipper-Fmt (= 7.1.7)

    • Flipper-Glog

    • libevent (~> 2.1.12)

    • OpenSSL-Universal (= 1.1.180)

Undefined symbols for architecture x86_64:
"_jump_fcontext", referenced from:
folly::fibers::FiberImpl::deactivate() in libFlipper-Folly.a(Fiber.o)
"_make_fcontext", referenced from:
folly::fibers::FiberImpl::FiberImpl(folly::Function ld: symbol(s) not found for architecture x86_64

@shahchirag2110 I am confused why Flipper-Folly 2.6.7 is used. if Flipper-Folly is (~> 2.5). Can you pin 2.5.3 and try again ?

@shahchirag2110 I am confused why Flipper-Folly 2.6.7 is used. if Flipper-Folly is (~> 2.5). Can you pin 2.5.3 and try again ?

@priteshrnandgaonkar you save my day. thank you so much

Using Flipper-Boost-iOSX 1.76.0.1.11 will solve the issue. With this version we now support all architectures. Let us know if there are any issue.

Getting a similar issue, but updating past 0.87.0 to 0.91.2 or any version in between produces this error:
Not sure if the first line has anything to do with it but I've checked on GoogleAppMeasurement as well

ld: warning: Could not find or use auto-linked framework 'GoogleAppMeasurement'
Undefined symbols for architecture x86_64:
  "_jump_fcontext", referenced from:
      folly::fibers::FiberImpl::deactivate() in libFlipper-Folly.a(Fiber.o)
  "_make_fcontext", referenced from:
      folly::fibers::FiberImpl::FiberImpl(folly::Function<void ()>, unsigned char*, unsigned long) in libFlipper-Folly.a(Fiber.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have an Intel machine, After updating to Flipper 0.96.1, a new package called Flipper-Boost-iOSX was added, and that causes this error:

Undefined symbols for architecture arm64:
  "___cxa_increment_exception_refcount", referenced from:
      folly::cxxabi_cxa_exception_sans_reserve() in libFlipper-Folly.a(Exception.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
    Ld /Users/kasra/Library/Developer/Xcode/DerivedData/InflationCalc-fmwbpshgatctktepfxhturrnjevn/Build/Products/Debug-iphoneos/InflationCalc.app/InflationCalc normal
(1 failure)
System:
    OS: macOS 11.4
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 35.37 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.18.1 - ~/.nvm/versions/node/v14.15.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_275 - /usr/bin/javac

Flipper  0.96.1
Flipper-Folly 2.6.9
Flipper-RSocket 1.4.3
FlipperKit  0.96.1
OpenSSL-Universal 1.1.1100
Flipper-Boost-iOSX 1.76.0.1.11

Only the solution that @eggybot mentioned works.
I saw above that this issue was closed because Flipper-Boost-iOSX 1.76.0.1.11 was claimed to solve this issue. I am using the same version and still has this issue. Any update on this?

Also got that issue.

Please don't comment on closed issues, they are generally not seen by the relevant people. Please check your setup first against our example setup, https://github.com/facebook/flipper/tree/master/react-native/ReactNativeFlipperExample, then file a new issue by following the template and providing a reproduction. Merely posting an exception is generally not actionable by us or anybody else.

Was this page helpful?
0 / 5 - 0 ratings