Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install with cocoapods without use_frameworks #131

Closed
amloelxer opened this issue Jun 10, 2020 · 7 comments
Closed

Cannot install with cocoapods without use_frameworks #131

amloelxer opened this issue Jun 10, 2020 · 7 comments
Assignees
Labels
compilation issue SDK doesn't compile or gives warnings.

Comments

@amloelxer
Copy link

The issue

Hey all, first thanks so much working on this, I'm excited to give it a whirl in our app. When trying to install with cocoapods, I get the following error: Using Swift static libraries with custom module maps is currently not supported. Please build DatadogSDK as a framework or remove the custom module map. Unfortunately for my team, we can't move to use_frameworks and need to keep modules. When looking at your custom Datadog module map, I see it is eerily similar to an autogenerated one with the exception of the sudo private module you have set exposing _Datadog_Private

framework module _Datadog_Private {
  export *
  header "ObjcExceptionHandler.h"
}

Any reason this can't just be exposed in DatadogObjc and let the autogenerated module map be used (other than the fact you want to discourage 3d party devs from consuming ObjcExceptionHandler.m)? Or any easy workarounds short of manually integrating into our project? Thank you for your time.

  • Alex

Datadog SDK version:

DatadogSDK (1.2.1)

Last working Datadog SDK version:

First time using

Dependency Manager:

Cocoapods 1.9.1

Other toolset:

N / A

Xcode version:

Version 11.5 (11E608c)

Swift version:

Swift 5

Deployment Target:

iOS 11

macOS version:

Mac OS Catalina v 10.15.2

@amloelxer amloelxer added the compilation issue SDK doesn't compile or gives warnings. label Jun 10, 2020
@buranmert buranmert self-assigned this Jun 10, 2020
@hyling
Copy link

hyling commented Jun 10, 2020

I also can't use the use_frameworks option because my project depends on other pods that are incompatible with this option.

@buranmert
Copy link
Contributor

buranmert commented Jun 11, 2020

hi @amloelxer 👋 thanks for reporting and looking into the issue!

you are right, we use a custom modulemap in order to use ObjC in Swift while hiding it from our users.
unfortunately, we can't remove it at the moment.

you can use Carthage or Swift Package Manager without this problem, but i assume you use only Cocoapods in your projects

you can try the snippet below in your Podfiles:

target 'Your-Target-Name' do
  use_frameworks!
  pod 'DatadogSDK'
  pod 'YourOtherPod'
  ...
  target 'Your-TestTarget-Name' do
    inherit! :search_paths
    pod 'YourTestPod'
    ...
  end
end

# the array below needs to include Datadog frameworks and their dependencies
# today we only have Kronos as dependency, that may change one day
dynamic_frameworks = ['DatadogSDK','DatadogSDKObjc','Kronos']
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if !dynamic_frameworks.include?(pod.name)
      def pod.static_framework?;
        true
      end
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

this code should keep all your other pods static while DatadogSDK being dynamic

✅ i verified the fix by using Alamofire statically and Datadog dynamically in the same project with this code
Screenshot 2020-06-11 at 14 04 08

i hope that solves your problems @amloelxer and @hyling 🤞
please let us know how that plays out

IMPORTANT UPDATE:

dynamic_frameworks array in Podfile needs to contain our frameworks and their dependencies (e.g: Kronos).
if there is a missing dependency, you will have the error below:

[!] The 'Pods-Your-Target-Name' target has transitive dependencies that include statically linked binaries: (Kronos)

@buranmert buranmert added the awaiting response Waiting for response / confirmation from the reporter label Jun 11, 2020
@amloelxer
Copy link
Author

@buranmert thanks so much for the response! I've been swamped with work but will look into this as soon as I have a free moment.

@buranmert
Copy link
Contributor

hi @amloelxer and @hyling, have you had a chance to see if that works for you?

@hyling
Copy link

hyling commented Jun 30, 2020

@buranmert Carthage along side Cocoapods works for me! Thanks for the solution.

@buranmert
Copy link
Contributor

@hyling glad to hear that!
@amloelxer i'm closing the issue for now, but feel free to reopen if needed

@ncreated ncreated removed the awaiting response Waiting for response / confirmation from the reporter label Jul 16, 2020
@buranmert
Copy link
Contributor

ℹ️ this issue is fixed in DatadogSDK v1.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation issue SDK doesn't compile or gives warnings.
Projects
None yet
Development

No branches or pull requests

4 participants