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

[Bug]: Failed to compile when tweak file name with .xi on latest theos version! #625

Open
4ch12dy opened this issue Nov 2, 2021 · 2 comments

Comments

@4ch12dy
Copy link

4ch12dy commented Nov 2, 2021

What are the steps to reproduce this issue?

  1. Make new project
  2. make
  3. see the error...

What happens?

> Making all for tweak test…
/Applications/Xcode11.4.app/Contents/Developer/usr/bin/make -f Makefile --no-keep-going COLOR=1 \
		internal-library-compile \
		_THEOS_CURRENT_TYPE=tweak THEOS_CURRENT_INSTANCE=test _THEOS_CURRENT_OPERATION=compile \
		THEOS_BUILD_DIR="." _THEOS_MAKE_PARALLEL=yes
/Applications/Xcode11.4.app/Contents/Developer/usr/bin/make -f Makefile --no-print-directory --no-keep-going internal-tweak-compile _THEOS_CURRENT_TYPE="tweak" THEOS_CURRENT_INSTANCE="test" _THEOS_CURRENT_OPERATION="compile" THEOS_BUILD_DIR="." THEOS_CURRENT_ARCH="arm64"
set -o pipefail; (mkdir -p /Users/xia0/xia0/iOSRE/Tweaks/test/.theos/obj/debug/arm64/)
(printf "\e[0;3%im==> \e[1;39m%s…\e[m\n" 2 "Compiling Tweak.xmi (arm64)"); set -o pipefail; (/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -x objective-c++ -c -fcolor-diagnostics -DTARGET_IPHONE=1 -O0 -Wall -ggdb -Werror  -isysroot "/Applications/Xcode11.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk" -target arm64-apple-ios7.0   -fobjc-arc -DDEBUG -O0  -DTHEOS_INSTANCE_NAME="\"test\""   -arch arm64       -stdlib=libc++        /Users/xia0/xia0/iOSRE/Tweaks/test/.theos/obj/debug/arm64/Tweak.xmi.mii -o /Users/xia0/xia0/iOSRE/Tweaks/test/.theos/obj/debug/arm64/Tweak.xmi.777f8e61.o)
==> Compiling Tweak.xmi (arm64)…
Tweak.xmi:38:80: error: expected ')'
static __attribute__((constructor)) void _logosLocalCtor_d26827a2(int __unused argc, char __unused **argv, char __unused **envp) {
                                                                               ^
Tweak.xmi:38:66: note: to match this '('
static __attribute__((constructor)) void _logosLocalCtor_d26827a2(int __unused argc, char __unused **argv, char __unused **envp) {
                                                                 ^
1 error generated.
make[3]: *** [/Users/xia0/xia0/iOSRE/Tweaks/test/.theos/obj/debug/arm64/Tweak.xmi.777f8e61.o] Error 1
make[2]: *** [/Users/xia0/xia0/iOSRE/Tweaks/test/.theos/obj/debug/arm64/test.dylib] Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [test.all.tweak.variables] Error 2

What were you expecting to happen?

Compile well.

Paste any relevant logs, error output, etc.

# the simple test code

%ctor {
   printf("hello theos");
}

# and Tweak.xi.pre
extern void CFLog(int32_t level, CFStringRef format, ...);
# 20 "/opt/theos/vendor/include/HBLog.h" 2
# 28 "/opt/theos/Prefix.pch" 2
# 2 "<built-in>" 2
# 1 "Tweak.xi" 2
# 38 "Tweak.xi"
%ctor {
 printf("hello theos");
}

# Tweak.xi.mi
extern void CFLog(int32_t level, CFStringRef format, ...);
# 20 "/opt/theos/vendor/include/HBLog.h" 2
# 28 "/opt/theos/Prefix.pch" 2
# 2 "<built-in>" 2
# 1 "Tweak.xi" 2
# 38 "Tweak.xi"
static __attribute__((constructor)) void _logosLocalCtor_8c549b80(int __unused argc, char __unused **argv, char __unused **envp) {
 printf("hello theos");
}

Additional context

This problem occurs after updating theos to the latest version!

if remove __unused in Tweak.xi.mi, compile well.

What OS are you seeing the problem on?

macOS

What OS version does it have installed?

11.1

What toolchain and version are you using?

Xcode11.4

Which SDK version are you using?

iOS13

What OS is your client device running?

iOS

What OS version does it have installed?

iOS14

Which device model is it?

iPhoneXS

Which jailbreak is it using (if relevant)?

Unc0ver

@4ch12dy
Copy link
Author

4ch12dy commented Nov 2, 2021

Finally I added these CFLAGS "-Wno-unused-variable -D__unused="" -Wno-ambiguous-macro" fix the problem.
But I think it is just a stopgap, I don't know why system not handle "__unused" well between theos and clang.

@L1ghtmann
Copy link
Member

L1ghtmann commented Apr 15, 2023

Is this still an issue with the latest theos? I can't seem to replicate with a simple logging .xi/.x project.

Edit: I was able to replicate the error: expected ')' errors by declaring an extern "C" function in a non-c++ file (i.e., .x/.xi)

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

2 participants