anestisb / vdexExtractor

Tool to decompile & extract Android Dex bytecode from Vdex files
Apache License 2.0
1k stars 214 forks source link

Compile errors #21

Closed superr closed 6 years ago

superr commented 6 years ago

First, thank you for this wonderful tool. Your contributions are greatly appreciated :)

Starting with commit 5d460e1 I am unable to compile vdexExtractor on 64-bit Ubuntu Linux 16.04. I used the generic ./make.sh command to compile. The error follows:

gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -g -ggdb -c dex.c -o dex.o
dex.c:39:42: error: initializer element is not constant
 static const u2 kFlagPreHeaderCombined = kFlagPreHeaderRegisterSize | kFlagPreHeaderInsSize |
                                          ^
Makefile:53: recipe for target 'dex.o' failed
make: *** [dex.o] Error 1

Thank you for your time :)

sekaiacg commented 6 years ago

hi, I compiled it successfully in archlinux x64 using ./make.sh gcc. commit de6c717e744cb4a0c6af9ff002e3c5646c4d87d1 2018-08-23 11-29-14 Compiled binary: vdexExtractor.zip

superr commented 6 years ago

@sekaiacg - Just tried with ./make.sh gcc and get the same error :( All versions up until 5d460e1 compile without issue. Strange.

ingbrzy commented 6 years ago

@superr vdexExtractor P support is still under heavy development.. and doesnt work for P yet.. [FATAL] Decompiler is under development https://github.com/anestisb/vdexExtractor/blob/de6c717e744cb4a0c6af9ff002e3c5646c4d87d1/src/vdex/vdex_backend_019.c#L418

sekaiacg commented 6 years ago

@superr Below is the log, which looks like there are no errors. GCC version 8.2.0. This is a strange problem make: Entering directory '/home/sekaiacg/opt/miui/vdexExtractor/src' rm -f *.o rm -f */*.o rm -f vdexExtractor make: Leaving directory '/home/sekaiacg/opt/miui/vdexExtractor/src' make: Entering directory '/home/sekaiacg/opt/miui/vdexExtractor/src' gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c out_writer.c -o out_writer.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdexExtractor.c -o vdexExtractor.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c log.c -o log.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c dex_instruction.c -o dex_instruction.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex.c -o vdex.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c dex.c -o dex.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c utils.c -o utils.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_backend_019.c -o vdex/vdex_backend_019.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_019.c -o vdex/vdex_019.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_decompiler_006.c -o vdex/vdex_decompiler_006.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_backend_006.c -o vdex/vdex_backend_006.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_006.c -o vdex/vdex_006.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_decompiler_010.c -o vdex/vdex_decompiler_010.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_backend_010.c -o vdex/vdex_backend_010.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_010.c -o vdex/vdex_010.o gcc -c -std=c11 -D_GNU_SOURCE -Wall -Wextra -Werror -c vdex/vdex_decompiler_019.c -o vdex/vdex_decompiler_019.o gcc out_writer.o vdexExtractor.o log.o dex_instruction.o vdex.o dex.o utils.o vdex/vdex_backend_019.o vdex/vdex_019.o vdex/vdex_decompiler_006.o vdex/vdex_backend_006.o vdex/vdex_006.o vdex/vdex_decompiler_010.o vdex/vdex_backend_010.o vdex/vdex_010.o vdex/vdex_decompiler_019.o -lm -lz -o vdexExtractor cp vdexExtractor ../bin/vdexExtractor make: Leaving directory '/home/sekaiacg/opt/miui/vdexExtractor/src'

anestisb commented 6 years ago

Should be fixed in https://github.com/anestisb/vdexExtractor/commit/5e82a433944ece823f92f243cc3577d0fb9dde5b. Bad habits from C++ world.

The compiler is technically right to complain since initializers are not constant. However, most modern version should absorb the expression and assign the final value to const.

And yes the decompiler part is still under development. However, by using the "--no-unquicken" flag you can test the Vdex 019 parser, the verifiers dependencies walker, the CDex parser (for new Vdex containers) and the updated disassembler. Please raise a new bug if you spot any issues.

Hopefully the fist decompiler primitives will land the next couple of days.