gaffe23 / linux-inject

Tool for injecting a shared object into a Linux process
Other
1.11k stars 249 forks source link

Can't build using "make arm" #1

Closed DukedDroid closed 9 years ago

DukedDroid commented 9 years ago

Hi,

I tried to build it using the Makefile provided and didn't get much luck. Lots of warnings: clang -std=gnu99 -ggdb -DARM -ldl -o inject utils.c ptrace.c inject-arm.c In file included from ptrace.c:9: ./ptrace.h:9:42: warning: declaration of 'struct user_regs' will not be visible outside of this function [-Wvisibility] void ptrace_getregs(pid_t target, struct REG_TYPE* regs); ^ ./ptrace.h:2:19: note: expanded from macro 'REG_TYPE'

define REG_TYPE user_regs

                     ^

./ptrace.h:11:42: warning: declaration of 'struct user_regs' will not be visible outside of this function [-Wvisibility] void ptrace_setregs(pid_t target, struct REG_TYPE* regs); ^ ./ptrace.h:2:19: note: expanded from macro 'REG_TYPE'

define REG_TYPE user_regs

But in terms of errors I got 4: ptrace.c:74:6: error: conflicting types for 'ptrace_getregs' void ptrace_getregs(pid_t target, struct REG_TYPE* regs)

ptrace.c:127:6: error: conflicting types for 'ptrace_setregs' void ptrace_setregs(pid_t target, struct REG_TYPE* regs) ptrace.c:271:6: error: conflicting types for 'restoreStateAndDetach' void restoreStateAndDetach(pid_t target, unsigned long addr, void* backup, int datasize, struct REG_TYPE oldregs) ^ ./ptrace.h:16:6: note: previous declaration is here void restoreStateAndDetach(pid_t target, unsigned long addr, void* backup, int datasize, struct REG_TYPE oldregs); ^ ptrace.c:271:106: error: variable has incomplete type 'struct user_regs' void restoreStateAndDetach(pid_t target, unsigned long addr, void* backup, int datasize, struct REG_TYPE oldregs) ^ ptrace.c:271:97: note: forward declaration of 'struct user_regs' 6 warnings and 4 errors generated. In file included from inject-arm.c:9: This was on an ubuntu box.

I also tried on MAC using the includes from the android sdk same thing no luck.

gaffe23 commented 9 years ago

I'm able to repro this same sequence of errors and warnings by running make arm on a 64-bit Ubuntu box, so it sounds like you may not be running it with an ARM toolchain. make arm is only meant to run on an actual ARM device, or with a cross-compiler.