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

[FYI]: -Wnomodule-import-in-extern-c CCFLAGS is required for Xcode 15 #791

Open
r-plus opened this issue Feb 17, 2024 · 6 comments
Open

Comments

@r-plus
Copy link
Contributor

r-plus commented Feb 17, 2024

What are the steps to reproduce this issue?

  1. build tweak with Xcode 15

What happens?

compile error from substrate header.

==> Compiling Tweak.xm (arm64e)…
In file included from Tweak.xm:38:
/opt/theos/vendor/include/substrate.h:45:1: error: import of C++ module 'MachO.nlist' appears within extern "C" language linkage specification [-Wmodule-import-in-extern-c]
#include <mach-o/nlist.h>
^
/opt/theos/vendor/include/substrate.h:43:1: note: extern "C" language linkage specification begins here
extern "C" {
^
1 error generated.

What were you expecting to happen?

no error.

Paste any relevant logs, error output, etc.

We should add `-Wnomodule-import-in-extern-c` to CCFLAGS to fixing this issue.

Ref: https://stackoverflow.com/questions/77203592/xcode-15-import-of-c-module-darwin-c-time-appears-within-extern-c-language

Additional context

No response

What OS are you seeing the problem on?

macOS

What OS version does it have installed?

14.3.1

What toolchain and version are you using?

Xcode 15.1

Which SDK version are you using?

automatic selection

What OS is your client device running?

iOS

What OS version does it have installed?

n/a

Which device model is it?

n/a

Which jailbreak is it using (if relevant)?

n/a

@L1ghtmann
Copy link
Member

L1ghtmann commented Feb 17, 2024

Hey, thanks for reporting this! May be worth just adjusting the header to avoid importing in extern. We have discussed this briefly in the Theos discord but don't believe we ever settled on a final solution.

@leptos-null
Copy link
Member

Discord discussion for reference: https://discord.com/channels/811490080278839327/811494949849661490/1188603122814296155

Adding to Lightmann's comment above:

This is a change in the iOS 17 SDK (unrelated to toolchain). Currently we suggest using the Theos SDKs instead of the Xcode SDK.
This module change is a breaking change, so not sure how to best support in Theos right now.

@zx500xl
Copy link

zx500xl commented Mar 28, 2024

@leptos-null, how to use the Theos SDKs instead of the Xcode SDK? What do I have to write in the Makefile?

@leptos-null
Copy link
Member

@zx500xl

  1. Download the theos SDKs you would like to use from https://github.com/theos/sdks/releases/tag/master-146e41f
  2. Extract the archives and place the .sdks in ${THEOS}/sdks/. For example ${THEOS}/sdks/iPhoneOS16.5.sdk
  3. Set the SDK version component of your target in your Makefile. Generally this looks like TARGET := iphone:clang:16.5:14.0 where 16.5 is the version of the SDK you selected

@Cregin
Copy link

Cregin commented Apr 12, 2024

@zx500xl

  1. Download the theos SDKs you would like to use from https://github.com/theos/sdks/releases/tag/master-146e41f
  2. Extract the archives and place the .sdks in ${THEOS}/sdks/. For example ${THEOS}/sdks/iPhoneOS16.5.sdk
  3. Set the SDK version component of your target in your Makefile. Generally this looks like TARGET := iphone:clang:16.5:14.0 where 16.5 is the version of the SDK you selected

@leptos-null The problem still exists,Xcode 14.3.1

@MikePendo
Copy link

MikePendo commented May 9, 2024

having same issue any progress on it?
seems like -Wno-module-import-in-extern-c resolve the issue

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

No branches or pull requests

6 participants