Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Flipper integration with cocoapod use_frameworks! cannot compile #2414

Open
andikapratama opened this issue Jun 7, 2021 · 16 comments
Open
Labels

Comments

@andikapratama
Copy link

🐛 Bug Report

My ios swift project uses several dynamics frameworks so use_frameworks! is mandatory. Unfortunately the official steps here doesn't seem to be working.

I tried to debug this but this happens even in an empty project, where the only pods are Flipper itself.

Any help or suggestion to fix this issue?
Thanks in advance.

To Reproduce

Here's a sample project: https://github.com/andikapratama/flipper_use_framework_example
run pod install
open the workspace project and build.
compile will fail

Environment

MacOS Big Sur 11.1
XCode 12.5
Cocoapod 1.10.1

@baveku
Copy link
Contributor

baveku commented Jul 15, 2021

0.98.0 still this error

@andresi
Copy link

andresi commented Jul 22, 2021

It probably helps if you include the actual error you are getting. It also helps people searching for the error:

/Users/andres/Documents/Projects/flippertest/Pods/Flipper-Fmt/include/fmt/locale.h:11:10: fatal error: 'locale' file not found
#include <locale>
         ^~~~~~~~
1 error generated.

@baveku
Copy link
Contributor

baveku commented Aug 23, 2021

maybe help: #2548 (comment)

@deepakiosdev
Copy link

deepakiosdev commented Aug 31, 2021

I am also getting compile time errors if use "use_frameworks! ". I want to use Flipper in a project that have mix of swift and objective c.
I followed all the steps mentioned in https://fbflipper.com/docs/getting-started/ios-native/

Xcode - 13.0 beta 4
Mac OS - Big Sur 11.5

Error 1-
/Users/dipakpandey/Desktop/FlipperDemo/Pods/Target Support Files/Pods-FlipperDemo/Pods-FlipperDemo-dummy.m:1:9: while building module 'Foundation' imported from /Users/dipakpandey/Desktop/FlipperDemo/Pods/Target Support Files/Pods-FlipperDemo/Pods-FlipperDemo-dummy.m:1:

Error 2-
/Users/dipakpandey/Desktop/FlipperDemo/Pods/Target Support Files/Pods-FlipperDemo/Pods-FlipperDemo-dummy.m:1:9: while building module 'Foundation' imported from /Users/dipakpandey/Desktop/FlipperDemo/Pods/Target Support Files/Pods-FlipperDemo/Pods-FlipperDemo-dummy.m:1:

Screenshot 2021-08-31 at 10 51 24 AM

@luvwylla09
Copy link

Please help us solve this problem. Our develop team thinks it's very important and useful. 😭😭😭

@mweststrate
Copy link
Contributor

cc @lblasa any idea why use_frameworks! causes issues? Adding it to iOS/Sample/Podfile indeed results in

[!] The 'Pods-Sample' target has transitive dependencies that include statically linked binaries: (Flipper-Boost-iOSX and Flipper-RSocket)

@luvwylla09
Copy link

I downgraded Flipper to 0.87.0 and installed Flipper-Folly by specifying local pod spec file then this problem was solved.

This is flipper part of my Podfile:

    pod 'FlipperKit',  :configuration => 'pro-debug'
    pod 'FlipperKit/SKIOSNetworkPlugin',  :configuration => 'pro-debug'
    pod 'Flipper-Folly', :podspec => '${yourProject}/Component/LocalPods/Specs/Flipper-Folly.podspec.json',  :configuration => 'pro-debug'
    pod 'CocoaLibEvent', :configuration => 'pro-debug'
    pod 'boost-for-react-native', :configuration => 'pro-debug'
    pod 'OpenSSL-Universal', :configuration => 'pro-debug'

 
    $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
      'CocoaAsyncSocket', 'ComponentKit','Flipper-Fmt', 'Flipper-DoubleConversion',
      'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
      'CocoaLibEvent', 'OpenSSL-Universal', 'Flipper-Boost-iOSX']
      
      pre_install do |installer|
        Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
              def pod.build_type;
                Pod::BuildType.static_library
              end
            end
          end
      end

The local pod spec json file is :

{
  "name": "Flipper-Folly",
  "version": "2.5.3",
  "license": {
    "type": "Apache License, Version 2.0"
  },
  "homepage": "https://github.com/facebook/folly",
  "summary": "An open-source C++ library developed and used at Facebook.",
  "authors": "Facebook",
  "source": {
    "git": "https://github.com/priteshrnandgaonkar/folly.git",
    "tag": "v2020.04.06.01"
  },
  "module_name": "folly",
  "dependencies": {
    "boost-for-react-native": [

    ],
    "Flipper-Glog": [

    ],
    "Flipper-DoubleConversion": [

    ],
    "OpenSSL-Universal": [
      "1.0.2.20"
    ],
    "libevent": [
      "~> 2.1.12"
    ]
  },
  "compiler_flags": "-DFOLLY_HAVE_PTHREAD=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_LIBGFLAGS=0 -DFOLLY_HAVE_LIBJEMALLOC=0 -DFOLLY_HAVE_PREADV=0 -DFOLLY_HAVE_PWRITEV=0 -DFOLLY_HAVE_TFO=0 -DFOLLY_USE_SYMBOLIZER=0\n    -frtti\n    -fexceptions\n    -std=c++14\n    -Wno-error\n    -Wno-unused-local-typedefs\n    -Wno-unused-variable\n    -Wno-sign-compare\n    -Wno-comment\n    -Wno-return-type\n    -Wno-global-constructors",
  "source_files": [
    "folly/*.h",
    "folly/concurrency/*.h",
    "folly/container/*.h",
    "folly/container/detail/*.h",
    "folly/detail/*.h",
    "folly/executors/**/*.h",
    "folly/experimental/*.h",
    "folly/functional/*.h",
    "folly/futures/*.h",
    "folly/futures/detail/*.h",
    "folly/gen/*.h",
    "folly/hash/*.h",
    "folly/hash/detail/*.h",
    "folly/init/*.h",
    "folly/io/*.h",
    "folly/io/async/*.h",
    "folly/io/async/ssl/*.h",
    "folly/lang/*.h",
    "folly/memory/*.h",
    "folly/memory/detail/*.h",
    "folly/net/*.h",
    "folly/net/detail/*.h",
    "folly/portability/*.h",
    "folly/ssl/*.h",
    "folly/ssl/detail/*.h",
    "folly/synchronization/*.h",
    "folly/synchronization/detail/*.h",
    "folly/system/*.h",
    "folly/tracing/*.h",
    "folly/chrono/*.h",
    "folly/*.cpp",
    "folly/concurrency/*.cpp",
    "folly/container/detail/*.cpp",
    "folly/detail/*.cpp",
    "folly/executors/*.cpp",
    "folly/experimental/hazptr/*.cpp",
    "folly/futures/*.cpp",
    "folly/futures/detail/*.cpp",
    "folly/hash/*.cpp",
    "folly/io/*.cpp",
    "folly/io/async/*.cpp",
    "folly/io/async/ssl/*.cpp",
    "folly/lang/*.cpp",
    "folly/memory/*.cpp",
    "folly/memory/detail/*.cpp",
    "folly/net/*.cpp",
    "folly/portability/*.cpp",
    "folly/ssl/*.cpp",
    "folly/ssl/detail/*.cpp",
    "folly/String.cpp",
    "folly/synchronization/*.cpp",
    "folly/system/*.cpp"
  ],
  "exclude_files": [
    "folly/synchronization/Rcu.cpp",
    "folly/synchronization/Rcu.h"
  ],
  "header_mappings_dir": "folly",
  "header_dir": "folly",
  "libraries": "stdc++",
  "public_header_files": "folly/**/*.h",
  "pod_target_xcconfig": {
    "USE_HEADERMAP": "NO",
    "CLANG_CXX_LANGUAGE_STANDARD": "c++11",
    "HEADER_SEARCH_PATHS": "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Flipper-DoubleConversion\" \"$(PODS_ROOT)/libevent/include\""
  },
  "platforms": {
    "ios": "10.0"
  }
}



In addition, do not use "use_modular_headers!" if you write "use_frameworks!" in Podfile.

@comm1x
Copy link

comm1x commented Dec 27, 2021

Same here, can't use Flipper in my project cause of use_frameworks!. I'm wonder why it is not work with this default statement.

@thliu21
Copy link

thliu21 commented Jan 11, 2022

Hello folks. I encountered this issue and I tried a few things. There is one thing that I tried and it fixed the problem. I am no expert on cocoapods or flipper, but I got it build by just adding Flipper-Fmt to the $static_framework.

    $static_framework = [ ..., 'Flipper-Fmt']

It is yet to know how this works out and I am in a my-code-works-but-I-dunno-why situation. If you are a cocoapods expert please help me digging a bit.

@baveku
Copy link
Contributor

baveku commented Jan 11, 2022

Hello folks. I encountered this issue and I tried a few things. There is one thing that I tried and it fixed the problem. I am no expert on cocoapods or flipper, but I got it build by just adding Flipper-Fmt to the $static_framework.

    $static_framework = [ ..., 'Flipper-Fmt']

It is yet to know how this works out and I am in a my-code-works-but-I-dunno-why situation. If you are a cocoapods expert please help me digging a bit.

Oh, I tried with Flipper latest version 127 and It's worked, Maybe Flipper-folly has fixed it, 🥳 🥳 🥳 🥳 🥳

@matinzd
Copy link

matinzd commented Jul 25, 2022

Hello folks. I encountered this issue and I tried a few things. There is one thing that I tried and it fixed the problem. I am no expert on cocoapods or flipper, but I got it build by just adding Flipper-Fmt to the $static_framework.

    $static_framework = [ ..., 'Flipper-Fmt']

It is yet to know how this works out and I am in a my-code-works-but-I-dunno-why situation. If you are a cocoapods expert please help me digging a bit.

Oh, I tried with Flipper latest version 127 and It's worked, Maybe Flipper-folly has fixed it, 🥳 🥳 🥳 🥳 🥳

It seems that Flipper-Boost-iOSX has not been fixed yet.

[!] The 'Pods-xxx' target has transitive dependencies that include statically linked binaries: (Flipper-Boost-iOSX)

@x7Michi10x
Copy link

invertase/react-native-firebase#6425 (comment)

This did it for me!

@jacobmolby
Copy link

jacobmolby commented Jun 22, 2023

invertase/react-native-firebase#6425 (comment)

This did it for me!

@x7Michi10x Can I ask you how your Podfile looks and what versions you're using? I cannot get it to work when trying to follow the solution comment.

@x7Michi10x
Copy link

x7Michi10x commented Jun 22, 2023

invertase/react-native-firebase#6425 (comment)
This did it for me!

@x7Michi10x Can I ask you how your Podfile looks and what versions you're using? I cannot get it to work when trying to follow the solution comment.

react-native: 0.70.9
@react-native-firebase: 18.0.0
flipper: 0.163.0

Podfile:
https://textdoc.co/Tyf354MCBhHd7gEZ

@martintreurnicht
Copy link

I can't believe this issue is still open. React Native team knows it's an issue but just says to disable flipper, says that Flipper team needs to fix it. With hermes you pretty much need Flipper now. Why isn't this a higher priority?

@liamjones
Copy link
Contributor

@martintreurnicht FYI, I know it doesn't fix the immediate issue, the intention is for Flipper integration not to be on by default in future and Hermes debugging to occur via Chrome DevTools (while the code still runs inside Hermes). More info here: https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0641-decoupling-flipper-from-react-native-core.md

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests