Kernel Compiling Error

Search This thread

srsdani

Senior Member
Jan 28, 2011
134
150
Bucharest
Code:
  CC      net/netfilter/xt_qtaguid.o
  CC      net/netfilter/xt_quota.o
  CC      net/netfilter/xt_quota2.o
  CC      net/netfilter/xt_socket.o
In file included from include/linux/kernel.h:23:0,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:7,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from net/netfilter/xt_socket.c:13:
net/netfilter/xt_socket.c: In function 'xt_socket_get4_sk':
include/linux/dynamic_debug.h:75:21: warning: 'protocol' may be used uninitialized in this function [-Wmaybe-uninitialized]
error, forbidden warning: dynamic_debug.h:75
make[2]: *** [net/netfilter/xt_socket.o] Error 1
make[1]: *** [net/netfilter] Error 2
make: *** [net] Error 2
srsdani@ubuntu:~/kernel$

Original file here.
I'm using ndk gcc 4.8. This error is present also on gcc 4.7. The only way to get rid of this error is to use toolchain 4.6. I need to compile it using a newer toolchain, that's why I request your help.
 
G

GuestD0336

Guest
Kernel Compilation

Code:
  CC      net/netfilter/xt_qtaguid.o
  CC      net/netfilter/xt_quota.o
  CC      net/netfilter/xt_quota2.o
  CC      net/netfilter/xt_socket.o
In file included from include/linux/kernel.h:23:0,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:7,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from net/netfilter/xt_socket.c:13:
net/netfilter/xt_socket.c: In function 'xt_socket_get4_sk':
include/linux/dynamic_debug.h:75:21: warning: 'protocol' may be used uninitialized in this function [-Wmaybe-uninitialized]
error, forbidden warning: dynamic_debug.h:75
make[2]: *** [net/netfilter/xt_socket.o] Error 1
make[1]: *** [net/netfilter] Error 2
make: *** [net] Error 2
srsdani@ubuntu:~/kernel$

Original file here.
I'm using ndk gcc 4.8. This error is present also on gcc 4.7. The only way to get rid of this error is to use toolchain 4.6. I need to compile it using a newer toolchain, that's why I request your help.

I guess you are looking on another file.

Code:
error, forbidden warning: dynamic_debug.h:75

I guess there is a problem in dynamic_debug.h in line 75. I guess you need to initialise something.
 
G

GuestD0336

Guest
Try this method!


I am not much used to kernel related development but I analysed your dynamic_debug.h and found the problem (maybe a problem):

Normally, a do-while loop syntax is this:
Code:
do
{
 Statement1;
 Statement2;
 ...
}while(condition);
But I don't see a semicolon in the end of those loops in your code. This maybe a syntax error.

Also analyse these codes:
Code:
#if defined(CONFIG_DYNAMIC_DEBUG)
extern int ddebug_remove_module(const char *mod_name);
extern __printf(2, 3)
int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);

struct device;

extern __printf(3, 4)
int __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
                      const char *fmt, ...);

struct net_device;

extern __printf(3, 4)
int __dynamic_netdev_dbg(struct _ddebug *descriptor,
                         const struct net_device *dev,
                         const char *fmt, ...);
Every intialisation has 4 protocols but the first initialisation contain only 3.
Try the above things and tell me back if it works or not.
 

srsdani

Senior Member
Jan 28, 2011
134
150
Bucharest
So, the problem was in Makefile and .config. I compared and added some flags from Mako (from franco) and it worked. I still have some warning/s, some breakpoints but at least now it's working. Anyway, this thread may be useful for all of us. Thanks a lot for help.
Now, another problem.
Code:
  CC      fs/proc/loadavg.o
  CC      fs/proc/meminfo.o
fs/proc/meminfo.c: In function ‘meminfo_proc_show’:
fs/proc/meminfo.c:175:1: internal compiler error: in optimize_sc, at modulo-sched.c:1069
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.launchpad.net/gcc-linaro> for instructions.
make[2]: *** [fs/proc/meminfo.o] Error 1
make[1]: *** [fs/proc] Error 2
make: *** [fs] Error 2
srsdani@ubuntu:~/kernel2$
With linaro 4.8.3 => OK;
linaro 4.8.3 + A15 optimize=> fail, error above. meminfo.c it's exactly like the one from nexus 4.
FIX: compiler bug;
 
Last edited:
  • Like
Reactions: CM_developer

Joeisgood99

Senior Member
Jan 4, 2015
303
192
Melbourne
Code:
  CC      net/netfilter/xt_qtaguid.o
  CC      net/netfilter/xt_quota.o
  CC      net/netfilter/xt_quota2.o
  CC      net/netfilter/xt_socket.o
In file included from include/linux/kernel.h:23:0,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:7,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from net/netfilter/xt_socket.c:13:
net/netfilter/xt_socket.c: In function 'xt_socket_get4_sk':
include/linux/dynamic_debug.h:75:21: warning: 'protocol' may be used uninitialized in this function [-Wmaybe-uninitialized]
error, forbidden warning: dynamic_debug.h:75
make[2]: *** [net/netfilter/xt_socket.o] Error 1
make[1]: *** [net/netfilter] Error 2
make: *** [net] Error 2
srsdani@ubuntu:~/kernel$

Original file here.
I'm using ndk gcc 4.8. This error is present also on gcc 4.7. The only way to get rid of this error is to use toolchain 4.6. I need to compile it using a newer toolchain, that's why I request your help.

Hey sarsdani Apologies that I'm quoting you 12 month later. I am getting an identical error in the same file/address as you had when you posted this question. Im compiling stock HTC m7 Android L kernel with Google tool chain 4.8 - android 5.1 r1
You mentioned later on that you changed the Makefile and .config to fix the [-Wmaybe-uninitialized] error. Can you please detail what those changes were or point me to an example ( if you can remember ;) ) I could just change Wmaybe in Makefile to Wno but turning the flag off altogether seems dangerous.
 

srsdani

Senior Member
Jan 28, 2011
134
150
Bucharest
@Joeisgood99 there are two ways to solve this.
1. using a "hack". So, you need to add in makefile (in root folder from kernel source) at KBUILD_CFLAGS: -Wno-maybe-uninitialized \
2. Open that file with the error and asign a value to protocol.

The first option is not dangerous. Why? Because only the toolchain say this. In gcc 4.6, the reason why you don't get this error is because it assign a value automatically to that "protocol", usualy random value but not always. In gcc 4.7/4.8/4.9(or 4.10) this is threated as warning/error.
 
Last edited:
  • Like
Reactions: Joeisgood99

CM_developer

Senior Member
Oct 21, 2017
118
37
/home/austin/cm11/kernel/lge/w3c/net/ipv4/ipconfig.c:264: undefined reference to `msecs_to_jiffies'
/home/austin/cm11/kernel/lge/w3c/Makefile:877: recipe for target '.tmp_vmlinux1' failed
make[2]: *** [.tmp_vmlinux1] Error 1
Makefile:130: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/home/austin/cm11/kernel/lge/w3c'
build/core/tasks/kernel.mk:188: recipe for target 'TARGET_KERNEL_BINARIES' failed
make: *** [TARGET_KERNEL_BINARIES] Error 2

Any ideas what this could be? I'm a bit stumped i've never seen an error like this before
 

CM_developer

Senior Member
Oct 21, 2017
118
37
It's okay i retired the project as of now since trying to modify the kernel source code isn't do anything but causing more errors. I do appreciate any help when everyone has a chance
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    So, the problem was in Makefile and .config. I compared and added some flags from Mako (from franco) and it worked. I still have some warning/s, some breakpoints but at least now it's working. Anyway, this thread may be useful for all of us. Thanks a lot for help.
    Now, another problem.
    Code:
      CC      fs/proc/loadavg.o
      CC      fs/proc/meminfo.o
    fs/proc/meminfo.c: In function ‘meminfo_proc_show’:
    fs/proc/meminfo.c:175:1: internal compiler error: in optimize_sc, at modulo-sched.c:1069
     }
     ^
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <https://bugs.launchpad.net/gcc-linaro> for instructions.
    make[2]: *** [fs/proc/meminfo.o] Error 1
    make[1]: *** [fs/proc] Error 2
    make: *** [fs] Error 2
    srsdani@ubuntu:~/kernel2$
    With linaro 4.8.3 => OK;
    linaro 4.8.3 + A15 optimize=> fail, error above. meminfo.c it's exactly like the one from nexus 4.
    FIX: compiler bug;
    1
    @Joeisgood99 there are two ways to solve this.
    1. using a "hack". So, you need to add in makefile (in root folder from kernel source) at KBUILD_CFLAGS: -Wno-maybe-uninitialized \
    2. Open that file with the error and asign a value to protocol.

    The first option is not dangerous. Why? Because only the toolchain say this. In gcc 4.6, the reason why you don't get this error is because it assign a value automatically to that "protocol", usualy random value but not always. In gcc 4.7/4.8/4.9(or 4.10) this is threated as warning/error.