phhusson / Superuser

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

Compiling error #65

Open hqt opened 7 years ago

hqt commented 7 years ago

When I compile, I meet this error:

[x86] Compile        : su <= su.c
[x86] Compile        : su <= daemon.c
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);
                     ^
4 errors generated.
make: *** [obj/local/x86/objs/su/su/daemon.o] Error 1

Do you have idea about this.

craigacgomez commented 7 years ago

Please read through the README carefully as well as other issues here before creating new issues. The solution to you problem is mentioned in the project README....

"Make sure the SDK Platform for API 19 is installed, through the Android SDK Manager. Install NDK Revision 9b from here or use the latest and set NDK_TOOLCHAIN_VERSION=4.9."

Thrilleratplay commented 7 years ago

@cj360 opened #64 not to long ago with the problem. I think this has to do with CLang compiling issues.

@hqt Try cherry-picking this commit and see if that fixes the error.

chaoskagami commented 7 years ago

I'll go ahead and confirm when attempting to build this with Omni, it is indeed the use of clang that's triggering the error. I can only assume clang adheres more strictly to standards - nested functions are undefined behavior. I suggest ditching them.

KOLANICH commented 7 years ago

It can be fixed. In fact I have fixed that with some modifications (c++11 lambdas, more explicit type conversions and some additional curly braces for new context to make compiler happy about goto), but the code is still shit (lot of similar boilerplate code, mallocs, and huge codebase noone will read) and needs a serious refactoring. Maybe it even should be corroded.