BelledonneCommunications / linphone-iphone

Linphone is a free VoIP and video softphone based on the SIP protocol. Mirror of linphone-iphone (git://git.linphone.org/linphone-iphone.git)
http://linphone.org
GNU General Public License v3.0
587 stars 349 forks source link

Not able to compile the iOS Build #921

Closed disolaterX closed 2 days ago

disolaterX commented 7 months ago

Podfile:

source "https://gitlab.linphone.org/BC/public/podspec.git" pod 'linphone-sdk' , '~>5.3.4'

But I am getting

❌ (ios/Pods/RCT-Folly/folly/portability/Time.h:22:10)

20 | #include 21 |

22 | #include <folly/portability/Config.h> | ^ 'folly/portability/Config.h' file not found 23 | 24 | // OSX is a pain. The XCode 8 SDK always declares clock_gettime 25 | // even if the target OS version doesn't support it, so you get

❌ (ios/Pods/linphone-sdk/linphone-sdk/apple-darwin/share/linphonesw/LinphoneWrapper.swift:21:8)

19 | */ 20 | import Foundation

21 | import linphone | ^ could not build Objective-C module 'linphone' 22 | #if canImport(SwiftUI) 23 | import SwiftUI 24 | #endif

mingeee commented 7 months ago

@disolaterX I am getting the same issue. Did you end up finding a solution? 😭 Do you mind sharing the solution if you have one?

disolaterX commented 7 months ago

@disolaterX I am getting the same issue. Did you end up finding a solution? 😭

Do you mind sharing the solution if you have one?

no luck till now

arlovip commented 7 months ago

The same issue.

arlovip commented 7 months ago

As a workaround:

Change

#include <folly/portability/Config.h>

into

#import "Config.h"

Comment out or remove the following line

#ifndef FOLLY_NO_CONFIG
//#include <folly/folly-config.h> // **Comment out** or **remove** this line.
#endif

Then clean Xcode and build again. It should work well.

disolaterX commented 7 months ago

image

What you did for this ?

arlovip commented 7 months ago

image

What you did for this ?

Firstly, make sure that you have already added PushKit framework to Link Binary with Libraries in Build Phases. Then, you have to import CallKit framework before importing linphone and import your project swift bridging header file. It looks like in AppDelegate.m

#import <CallKit/CallKit.h>
#import "YOUR-PROJECT-NAME-Swift.h"
#import <PushKit/PushKit.h> 
#import <linphone/linphonecore.h>
mingeee commented 6 months ago

As a workaround:

    1. ios/Pods/RCT-Folly/folly/portability/Time.h

Change

#include <folly/portability/Config.h>

into

#import "Config.h"
    1. Pods/RCT-Folly/folly/portability/Config.h

Comment out or remove the following line

#ifndef FOLLY_NO_CONFIG
//#include <folly/folly-config.h> // **Comment out** or **remove** this line.
#endif

Then clean Xcode and build again. It should work well.

You are the man! Thanks!

vukan-m commented 2 months ago

I have worked out what seems to be the problem for me, but still didn't find a solution since im not that experienced with iOS development.

The problem seems to be that #include "time.h" doesn't include the system time header, but instead RCT-Folly/probability/Time.h (in my case).

If you can somehow override this or tell it specifically which header file to import, that would solve the issue.

Update: I found a solution for my case, since i use many local pods, in one of them which is installed before linphone-sdk i created a new time.h header file and added this code in it: `#ifndef NATIVE_TIME

define NATIVE_TIME

include

endif`

This overrides the RCT-Folly Time.h file and linphone-sdk uses this instead. But then i ran into another problem, my AppDelegate fails to compile with errors: Screenshot 2024-09-05 at 08 11 40

Another Update: FOUND A SOLUTION. Changing build settings of linphone-sdk pod "Use Header Maps" to No solves this problem. You can add this to your Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'linphone-sdk'
      target.build_configurations.each do |config|
        config.build_settings["USE_HEADERMAP"] = "No"
      end
    end
  end
end