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

Build issues #23

Closed
mdirik opened this issue Nov 25, 2015 · 3 comments
Closed

Build issues #23

mdirik opened this issue Nov 25, 2015 · 3 comments

Comments

@mdirik
Copy link

mdirik commented Nov 25, 2015

I'm not sure if my build environment is not correctly set up or they are legitimately issues, but there is 2 related issues I encountered while trying to build Superuser.

README file lists API 19 and NDK 9b as requirements, but su binary doesn't compile correctly while using them.

$ ls $ANDROID_HOME/platforms/android-19
data/  skins/  templates/  android.jar  build.prop  framework.aidl  sdk.properties  source.properties  uiautomator.jar

$ ls `which ndk-build`
/opt/android/ndk-r9b/ndk-build

$ cat /opt/android/ndk-r9b/RELEASE.TXT
r9b

$ ndk-build 
[x86] Compile        : selinux <= fgetfilecon.c
jni/libselinux/src/fgetfilecon.c:6:23: fatal error: sys/xattr.h: No such file or directory
compilation terminated.
make: *** [obj/local/x86/objs/selinux/src/fgetfilecon.o] Error 1

It looks like sys/attr.h was added later in SDK 21.

$ find /opt/android/ndk -name xattr.h | grep 'sys/'
/opt/android/ndk/android-ndk-r10e/platforms/android-21/arch-x86/usr/include/sys/xattr.h
/opt/android/ndk/android-ndk-r10e/platforms/android-21/arch-x86_64/usr/include/sys/xattr.h
/opt/android/ndk/android-ndk-r10e/platforms/android-21/arch-mips64/usr/include/sys/xattr.h
/opt/android/ndk/android-ndk-r10e/platforms/android-21/arch-mips/usr/include/sys/xattr.h
/opt/android/ndk/android-ndk-r10e/platforms/android-21/arch-arm/usr/include/sys/xattr.h
/opt/android/ndk/android-ndk-r10e/platforms/android-21/arch-arm64/usr/include/sys/xattr.h

If I switch to NDK 10, it compiles correctly but the resulting binary won't work in Android 4.4

$ export PATH=/opt/android/ndk/android-ndk-r10e:$PATH
$ which ndk-build 
/opt/android/ndk/android-ndk-r10e/ndk-build
$ cat /opt/android/ndk/android-ndk-r10e/RELEASE.TXT 
r10e
$ ndk-build clean
...
$ ndk-build
... compiles ...

but no libs/*/placeholder exits as the README says?

$ ls libs/*/
libs/armeabi/:
su*

libs/mips/:
su*

libs/x86/:
su*

And the resulting binary doesn't work

$ adb push libs/x86/su /system/xbin/su
3255 KB/s (602704 bytes in 0.180s)
$ adb shell
# ls -lZ /system/xbin/su*                                   
-rwxrwxrwx root     root              u:object_r:system_file:s0 su
-rwsr-sr-x root     root              u:object_r:su_exec:s0 su.original

# su
CANNOT LINK EXECUTABLE: cannot locate symbol "signal" referenced by "su"...

I know selinux contexts don't match but linking problem is seperate and it is a known issue

I transcripted this on a x86 4.4 emulator but the error was same a 4.4 armv7 phone last night.
I also tried changing include lines to linux/attr.h as they were on older SDK versions, but they seem to be different headers than sys/attr.h so there were compile errors. I didn't dig it further.

@phhusson
Copy link
Owner

You confirm it's ok for you?

@mdirik
Copy link
Author

mdirik commented Nov 27, 2015

Sorry I forgot about this. Linking issue seems to be resolved (even though I couldn't get it working due to not being able to install properly). README still points to the NDK r9b, though. It doesn't work and it should point to NDK r10 instead.

Thanks!

@Inphi
Copy link

Inphi commented Dec 14, 2015

yeah. the readme really ought to be updated. Spent some time tackling the same issue until i bothered to check this issue.

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

3 participants