hbang / libcephei

Useful functions for tweak developers
https://hbang.github.io/libcephei
Other
207 stars 34 forks source link

THEOS makefile can not link to Cephei framework #48

Open karmamaster opened 3 years ago

karmamaster commented 3 years ago

Hello, Currently I am linking one tweak and one tool with Makefile like this:

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = Rebirth
TOOL_NAME = RebirthTool

CC=~/Desktop/obfuscator/build/bin/clang
CXX=~/Desktop/obfuscator/build/bin/clang++
LD=~/Desktop/obfuscator/build/bin/clang++
Rebirth_FILES = mytweakfiles
Rebirth_FRAMEWORKS = Foundation CoreFoundation MobileCoreServices UIKit CoreTelephony CoreLocation QuartzCore CoreGraphics Security
Rebirth_EXTRA_FRAMEWORKS += Cephei CepheiUI
Rebirth_LIBRARIES = substrate
Rebirth_CFLAGS = -Wno-error -Wno-module-import-in-extern-c

RebirthTool_FILES = myfiles
RebirthTool_FRAMEWORKS  = Foundation CoreFoundation MobileCoreServices UIKit CoreTelephony CoreLocation QuartzCore CoreGraphics Security
RebirthTool_EXTRA_FRAMEWORKS += Cephei CepheiUI
RebirthTool_LIBRARIES = substrate rocketbootstrap

include $(THEOS_MAKE_PATH)/tweak.mk
include $(THEOS_MAKE_PATH)/tool.mk

export GO_EASY_ON_ME = 0

after-install::
    install.exec "killall -9 SpringBoard;"

The tweak just built fine with both armv7 and arm64. But for the tool Theos can not build it due to this error:

==> Linking tool RebirthTool (armv7)…
Undefined symbols for architecture armv7:
  "HBOutputForShellCommand(NSString*)", referenced from:
      -[processDataClass CopyFromPathToPath:] in main.mm.e878f5b2.o
      -[processDataClass protectDataOfBundle:ExceptTheseFiles:] in main.mm.e878f5b2.o
      -[processDataClass unProtectDataOfBundle:] in main.mm.e878f5b2.o
      -[processDataClass UnzipFolder:withPath:] in main.mm.e878f5b2.o
      -[processDataClass MoveZipFile:toFolder:] in main.mm.e878f5b2.o
      -[processDataClass CopyMoveZipFile:toFolder:] in main.mm.e878f5b2.o
      -[processDataClass CopyFile:toFolder:] in main.mm.e878f5b2.o
      ...
ld: symbol(s) not found for architecture armv7

I don't know why but it is linking fine with the tweak, I have double check the framework and it still there.

Please check this issue.

kirb commented 3 years ago

Can you check if the header you’re using (likely $THEOS/vendor/lib/Cephei.framework/Headers/HBOutputForShellCommand.h) has __BEGIN_DECLS and __END_DECLS? Should match this: https://github.com/hbang/libcephei/blob/33eed31d64778b9c6ba8b2d34514f29286ec71a7/HBOutputForShellCommand.h

As an alternative, if you’re not using any C++ features, you could just rename the file to main.m.

karmamaster commented 3 years ago

I solved this by copy the HBOutputForShellCommand.h to my project and import it directly from my processDataClass.mm file. And about the HBOutputForShellCommand.h, I was checked it and it has __BEGIN_DECLS and __END_DECLS in the file. Furthermore, I see the last line is NS_ASSUME_NONNULL_END, it's just exactly as in: https://github.com/hbang/libcephei/blob/33eed31d64778b9c6ba8b2d34514f29286ec71a7/HBOutputForShellCommand.h

Macleykun commented 3 years ago

Believe this issue can be closed aswell.