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

Android build error #27

Open
AntogamerYT opened this issue Mar 3, 2024 · 3 comments
Open

Android build error #27

AntogamerYT opened this issue Mar 3, 2024 · 3 comments

Comments

@AntogamerYT
Copy link

ld: error: undefined symbol: KittyScanner::findDataFirst(unsigned long, unsigned long, void const*, unsigned long)
>>> referenced by DroidRedirect.cpp:51 (src\DroidRedirect.cpp:51)
>>>               ./obj/local/arm64-v8a/objs/droidredirect/DroidRedirect.o:(FindBuildingFunction(char const*, int))

ld: error: undefined symbol: KittyScanner::findIdaPatternFirst(unsigned long, unsigned long, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)
>>> referenced by DroidRedirect.cpp:58 (src\DroidRedirect.cpp:58)
>>>               ./obj/local/arm64-v8a/objs/droidredirect/DroidRedirect.o:(FindBuildingFunction(char const*, int))

ld: error: undefined symbol: KittyMemory::getElfBaseMap(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)
>>> referenced by KittyScanner.hpp:175 (src/../KittyMemory\KittyScanner.hpp:175)
>>>               ./obj/local/arm64-v8a/objs/droidredirect/DroidRedirect.o:(KittyScanner::ElfScanner::createWithPath(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&))

ld: error: undefined symbol: KittyMemory::getAllMaps()
>>> referenced by KittyScanner.hpp:163 (src/../KittyMemory\KittyScanner.hpp:163)
>>>               ./obj/local/arm64-v8a/objs/droidredirect/DroidRedirect.o:(KittyScanner::ElfScanner::createWithPath(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&))

ld: error: undefined symbol: KittyScanner::ElfScanner::ElfScanner(unsigned long, std::__ndk1::vector<KittyMemory::ProcMap, std::__ndk1::allocator<KittyMemory::ProcMap> > const&)
>>> referenced by KittyScanner.hpp:163 (src/../KittyMemory\KittyScanner.hpp:163)
>>>               ./obj/local/arm64-v8a/objs/droidredirect/DroidRedirect.o:(KittyScanner::ElfScanner::createWithPath(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

i just added the library to Android.mk and included it like in the example project but i get these errors on compilation, this is my android.mk:

LOCAL_PATH := $(call my-dir)

KITTYMEMORY_PATH = ../KittyMemory
KITTYMEMORY_SRC = $(wildcard $(KITTYMEMORY_PATH)/*.cpp)

include $(CLEAR_VARS)
LOCAL_MODULE    := Keystone
LOCAL_SRC_FILES := $(KITTYMEMORY_PATH)/Deps/Keystone/libs-android/$(TARGET_ARCH_ABI)/libkeystone.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := libcpp
LOCAL_SRC_FILES := libc++_shared.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := droidredirect

LOCAL_SRC_FILES := DroidRedirect.cpp And64InlineHook.cpp $(KITTYMEMORY_SRC)

LOCAL_STATIC_LIBRARIES := Keystone

LOCAL_CFLAGS    := -fvisibility=hidden -fno-stack-protector -Wall -Wno-address-of-temporary 
LOCAL_CPPFLAGS := -std=c++20 -fexceptions
LOCAL_SHARED_LIBRARIES := libcpp

LOCAL_LDLIBS    += -llog 

include $(BUILD_SHARED_LIBRARY)

@MJx0
Copy link
Owner

MJx0 commented Apr 19, 2024

seems like LOCAL_SRC_FILES did not pick the source files properly. check the path

@AntogamerYT
Copy link
Author

AntogamerYT commented Apr 22, 2024

seems like LOCAL_SRC_FILES did not pick the source files properly. check the path

i modified KITTYMEMORY_PATH = ../KittyMemory to KITTYMEMORY_PATH = ./src/KittyMemory and it worked, i can confirm this by logging KITTYMEMORY_SRC:
KITTYMEMORY_SRC: ./src/KittyMemory/KittyArm64.cpp ./src/KittyMemory/KittyMemory.cpp ./src/KittyMemory/KittyScanner.cpp ./src/KittyMemory/KittyUtils.cpp ./src/KittyMemory/MemoryBackup.cpp ./src/KittyMemory/MemoryPatch.cpp

That seemed to work, until: make: *** No rule to make target 'src/./src/KittyMemory/KittyArm64.cpp', needed by 'obj/local/arm64-v8a/objs/droidredirect/./src/KittyMemory/KittyArm64.o'. Stop.

This is how my project is structured (ignore the errors [it's just vscode intellisense doing the funny] and the mess lol):
image

@MJx0
Copy link
Owner

MJx0 commented May 5, 2024

its better to use $(LOCAL_PATH), try to log that to see the folder you are currently compiling from.
your android mk file is at same folder with kittymemory so it should be

KITTYMEMORY_PATH = $(LOCAL_PATH)/KittyMemory

now since LOCAL_SRC_FILES is relative to $(LOCAL_PATH) you can use subst to get relative path like this

KITTYMEMORY_SRC =  $(subst $(LOCAL_PATH)/,,$(wildcard $(KITTYMEMORY_PATH)/*.cpp))

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