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

Compile flutter project with clang. #3689

Closed
shigomany opened this issue Feb 29, 2024 · 5 comments · Fixed by #3690
Closed

Compile flutter project with clang. #3689

shigomany opened this issue Feb 29, 2024 · 5 comments · Fixed by #3690

Comments

@shigomany
Copy link

shigomany commented Feb 29, 2024

Introduction

I would like to integrate ccache into my flutter project, but I ran into a problem when compiling.

There is also a discussion about this

In a recent release, I thought this problem would disappear thanks to this PR #3538

Platform

iOS

Environment

Production, Develop

Installed

CocoaPods

Version

8.20.0

Did it work on previous versions?

No

Steps to Reproduce

  1. Change the Pod file configuration like this:
config.build_settings["CC"] = "clang"
config.build_settings["LD"] = "clang"
config.build_settings["CXX"] = "clang++"
config.build_settings["LDPLUSPLUS"] = "clang++"
  1. In ios folder run:
pod update
  1. In Flutter project run:
flutter build ios --no-codesign

Flutter project example

Expected Result

Build succed

Actual Result

Error log

[   +2 ms] Modules Issue (Xcode): Import of C++ module 'Darwin.POSIX.sys.types' appears within extern "C" language linkage specification
           /Users/shigomany/Documents/workingprojects/sentry_clang_build/ios/Pods/Sentry/Sources/SentryCrash/Recording/Tools/SentryCrashThread.h:31:0

[        ] Modules Issue (Xcode): Import of C++ module 'Darwin.POSIX.sys.types' appears within extern "C" language linkage specification
           /Users/shigomany/Documents/workingprojects/sentry_clang_build/ios/Pods/Sentry/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor.h:30:0

Full log with verbose mode

log.log

Are you willing to submit a PR?

No response

@brustolin
Copy link
Contributor

Hello @shigomany, thanks for reaching out. Can you try the following branch in your cocoapod file to see if it solves the problem: fix/headers-out-of-strict

pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa', :branch => 'fix/headers-out-of-strict'

@shigomany
Copy link
Author

Hello @shigomany, thanks for reaching out. Can you try the following branch in your cocoapod file to see if it solves the problem: fix/headers-out-of-strict

pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa', :branch => 'fix/headers-out-of-strict'

There's almost one mistake left:

Modules Issue (Xcode): Import of C++ module 'Darwin.POSIX.sys.types' appears within extern "C" language linkage specification
           /Users/shigomany/Documents/workingprojects/sentry_clang_build/ios/Pods/Sentry/Sources/SentryCrash/Recording/Tools/SentryCrashThread.h:31:0

New log attached
log.log

@shigomany
Copy link
Author

shigomany commented Feb 29, 2024

@brustolin if changed file SentryCrashMonitor_CPPException.h and my app built)

From:

#ifdef __cplusplus
extern "C" {
#endif

#include "SentryCrashMonitor.h"

To:

#include "SentryCrashMonitor.h"

#ifdef __cplusplus
extern "C" {
#endif

@brustolin
Copy link
Contributor

Thanks for the help @shigomany . I updated the branch with your input.
Please let us know if it works.

@shigomany
Copy link
Author

@brustolin Yes, it compiles successfully, the issue can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants