phhusson / Superuser

Keeping koush's Superuser fresh
GNU General Public License v3.0
426 stars 50 forks source link

cannot compile the su binary #60

Closed braindevices closed 8 years ago

braindevices commented 8 years ago

Cannot build the su binary in ndkr13. It seems like the nested function causing the trouble? Do I need special configuration to compile it?

[x86] Compile        : su <= su.c
In file included from jni/su/su.c:45:
jni/su/binds.h:17:9: warning: 'BINDSH' is used as a header guard here, followed by #define of a
      different macro [-Wheader-guard]
#ifndef BINDSH
        ^~~~~~
jni/su/binds.h:18:9: note: 'BINDS_H' is defined here; did you mean 'BINDSH'?
#define BINDS_H
        ^~~~~~~
        BINDSH                                                                                   
1 warning generated.
[x86] Compile        : su <= daemon.c
In file included from jni/su/daemon.c:50:
jni/su/binds.h:17:9: warning: 'BINDSH' is used as a header guard here, followed by #define of a
      different macro [-Wheader-guard]
#ifndef BINDSH
        ^~~~~~
jni/su/binds.h:18:9: note: 'BINDS_H' is defined here; did you mean 'BINDSH'?
#define BINDS_H
        ^~~~~~~
        BINDSH
jni/su/daemon.c:464:6: warning: comparison of unsigned expression < 0 is always false
      [-Wtautological-compare]
        if(s<0)
           ~^~
jni/su/daemon.c:506:69: error: function definition is not allowed here
        auto void cb(void *arg, int uid, const char *src, const char *dst) {
                                                                           ^
jni/su/daemon.c:545:15: error: use of undeclared identifier 'cb'
        bind_foreach(cb, NULL);
                     ^
jni/su/daemon.c:549:53: error: function definition is not allowed here
        auto void cb(void *arg, int uid, const char *path) {
                                                           ^
jni/su/daemon.c:566:15: error: use of undeclared identifier 'cb'
        init_foreach(cb, NULL);
                     ^
2 warnings and 4 errors generated.
make: *** [obj/local/x86/objs/su/su/daemon.o] Error 1
braindevices commented 8 years ago

Well, turns out the ndkr13 has clang as default. So add NDK_TOOLCHAIN_VERSION=4.9 works.

phhusson commented 8 years ago

Thanks. Perhaps I should drop this GNU-ism, but I like it...