Re: Using ndk as cross-compiler

52 views
Skip to first unread message

Dan Albert

unread,
Jan 20, 2017, 6:44:45 PM1/20/17
to android-ndk
I think for compilation you need `-fpie` rather than `-pie` (still want `-pie` for the linking command though).

On Wed, Dec 21, 2016 at 4:56 AM, Arya M Sankar <aryamsa...@gmail.com> wrote:
​Hi list,
     I am new to using ndk and need some suggestion
I used ndk to compile a simple c program which prints "hello world", an executable for target aosp_x86_64 was generated successfully.

Steps followed
~/tOOlChaIN/bin/clang haiworld.c -pie
Pushed to adb shell
executed using ./haiworld
printed hai world on the emulator

When followed the same steps to compile LibFuzzer on Ubuntu x86_64 arch, with aosp_x86_64 as target.
 Ended up with the error 
​"​
error: only position independent executables (PIE) are supported.
​"

​Steps followed

~/tOOlChaIN/bin/clang -pie -c -g -O2 -std=c++11 Fuzzer/*.cpp -IFuzzer

~/tOOlChaIN/bin/clang -pie -c -g -std=c++11 test_driver.cc

~/tOOlChaIN/bin/clang++ -pie -g Fuzzer*.o test_driver.o -I /Marsh/out/target/product/generic/system/lib/libstagefright.so -o fuzzing


​Could some one tell me what am I doing w​
​rong..​

--
Thanks & Regards

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/c3b90581-1be4-40f0-91a2-ae1c911cbdbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages