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

clang++: error: linker command failed with exit code 1 #5

Open
sushi2k opened this issue Feb 9, 2019 · 4 comments
Open

clang++: error: linker command failed with exit code 1 #5

sushi2k opened this issue Feb 9, 2019 · 4 comments

Comments

@sushi2k
Copy link

sushi2k commented Feb 9, 2019

I am getting the following error after checking out the repo, opening it in Android Studio and when trying to build the app:

Android/Source Code /Anti_Frida/app/src/main/cpp/native-lib.cpp:80: error: undefined reference to 'my_openat'
Android/Source Code /Anti_Frida/app/src/main/cpp/native-lib.cpp:165: error: undefined reference to 'my_read'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
@sushi2k
Copy link
Author

sushi2k commented Feb 9, 2019

After trying to rebuild I got the following error

image

I did a manual gradlew in the android project directory and printed the stracktrace:

$ ./gradlew build --stacktrace
... 
]== "CMake Server" ==]

CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.

So I installed Ninja via brew:

$ brew install ninja

Now I can build and install the app, but Frida is not detected (even though the app is now running on a rooted device with frida server running.

@enovella
Copy link
Contributor

enovella commented Apr 2, 2019

[17:05 edu@unix debug] >  adb logcat -s FridaDetectionTest
04-02 17:59:12.085  9036  9058 V FridaDetectionTest: FRIDA DETECTED [1] - frida server running on port 27042!

It seems that the assembly syscalls need a bit of massage. Got this working by using libc wrappers instead of assembly syscalls.

@sushi2k
Copy link
Author

sushi2k commented Apr 2, 2019

Thanks! Can you share your fix as PR?

@enovella
Copy link
Contributor

enovella commented Apr 2, 2019

Basically this replacement s/myopenat/open/g and s/my_open/open/g. Getting rid of the assembly syscalls

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