OE4T / linux-tegra-4.9

NVIDIA downstream Linux kernel source Jetson platforms in single-repo form, derived from the L4T R32.x series BSP
Other
57 stars 78 forks source link

How to treat warnings not as errors.... #45

Open Marietto2008 opened 2 weeks ago

Marietto2008 commented 2 weeks ago

Hello bro.

I'm trying to recompile the kernel 4.9 for my Jetson nano using your latest patches,but I'm not able to compile the code. Can you give me some help ? thanks.

# git clone https://github.com/OE4T/linux-tegra-4.9.git

# cd linux-tegra-4.9

# git checkout oe4t-patches-l4t-r32.7.4

# cp /proc/config.gz .

# gunzip config.gz

# mv config .config

# CFLAGS=-Wno-error make -j4

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CC      kernel/rcu/sync.o
  CC      mm/nobootmem.o
In file included from ./include/trace/define_trace.h:95:0,
                 from ./include/trace/events/sched.h:1113,
                 from kernel/sched/core.c:96:
./include/trace/events/sched.h: In function ‘trace_raw_output_sched_load_avg_task’:
./include/trace/events/sched.h:666:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 10 has type ‘long unsigned int’ [-Wformat=]
  TP_printk("comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu util_fast_avg=%lu"
            ^
./include/trace/events/sched.h:676:5:
     (unsigned long)__entry->util_avg_walt,
     ~~~~~~~~~~~~~~~~~~~~~~~~~
./include/trace/trace_events.h:327:22: note: in definition of macro ‘DECLARE_EVENT_CLASS’
  trace_seq_printf(s, print);     \
                      ^~~~~
./include/trace/trace_events.h:65:9: note: in expansion of macro ‘PARAMS’
         PARAMS(print));         \
         ^~~~~~
./include/trace/events/sched.h:626:1: note: in expansion of macro ‘TRACE_EVENT’
 TRACE_EVENT(sched_load_avg_task,
 ^~~~~~~~~~~
./include/trace/events/sched.h:666:2: note: in expansion of macro ‘TP_printk’
  TP_printk("comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu util_fast_avg=%lu"
  ^~~~~~~~~
In file included from ./include/trace/trace_events.h:361:0,
                 from ./include/trace/define_trace.h:95,
                 from ./include/trace/events/sched.h:1113,
                 from kernel/sched/core.c:96:
./include/trace/events/sched.h:667:38: note: format string is defined here
    "util_avg_pelt=%lu util_avg_walt=%u load_sum=%llu"
                                     ~^
                                     %lu
In file included from ./include/trace/define_trace.h:95:0,
                 from ./include/trace/events/sched.h:1113,
                 from kernel/sched/core.c:96:
./include/trace/events/sched.h: In function ‘trace_raw_output_sched_load_avg_cpu’:
./include/trace/events/sched.h:715:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 8 has type ‘long unsigned int’ [-Wformat=]
  TP_printk("cpu=%d load_avg=%lu util_avg=%lu util_fast_avg=%lu "
            ^
./include/trace/events/sched.h:719:29:
     __entry->util_avg_pelt, (unsigned long)__entry->util_avg_walt)
                             ~~~~~~~~~~~~~~~~~~~~~~~~~
./include/trace/trace_events.h:327:22: note: in definition of macro ‘DECLARE_EVENT_CLASS’
  trace_seq_printf(s, print);     \
                      ^~~~~
./include/trace/trace_events.h:65:9: note: in expansion of macro ‘PARAMS’
         PARAMS(print));         \
         ^~~~~~
./include/trace/events/sched.h:685:1: note: in expansion of macro ‘TRACE_EVENT’
 TRACE_EVENT(sched_load_avg_cpu,
 ^~~~~~~~~~~
./include/trace/events/sched.h:715:2: note: in expansion of macro ‘TP_printk’
  TP_printk("cpu=%d load_avg=%lu util_avg=%lu util_fast_avg=%lu "
  ^~~~~~~~~
In file included from ./include/trace/trace_events.h:361:0,
                 from ./include/trace/define_trace.h:95,
                 from ./include/trace/events/sched.h:1113,
                 from kernel/sched/core.c:96:
./include/trace/events/sched.h:716:40: note: format string is defined here
      "util_avg_pelt=%lu util_avg_walt=%u",
                                       ~^
                                       %lu
  CC      kernel/rcu/srcu.o
  CC      fs/fs_pin.o
    CC [M]  sound/drivers/mpu401/mpu401_uart.o
  CC      sound/core/sound.o
sound/core/sound.c: In function ‘snd_request_other’:
sound/core/sound.c:89:2: warning: format not a string literal and no format arguments [-Wformat-security]
  request_module(str);
  ^~~~~~~~~~~~~~
  CC      drivers/base/firmware.o
  CC      sound/core/init.o
  LD [M]  sound/drivers/mpu401/snd-mpu401-uart.o
  LD      sound/drivers/opl3/built-in.o
  CC [M]  sound/drivers/opl3/opl3_lib.o
  CC [M]  fs/fscache/proc.o
  CC      drivers/base/init.o
  LD [M]  fs/fscache/fscache.o
  LD      fs/fuse/built-in.o
  CC [M]  fs/fuse/dev.o
  CC      drivers/base/map.o
  CC      sound/core/memory.o
  CC [M]  sound/drivers/opl3/opl3_synth.o
  CC      drivers/base/devres.o
  CC      sound/core/control.o
  CC [M]  sound/drivers/opl3/opl3_seq.o
sound/drivers/opl3/opl3_seq.c: In function ‘snd_opl3_seq_probe’:
sound/drivers/opl3/opl3_seq.c:240:11: warning: format not a string literal and no format arguments [-Wformat-security]
           name);
           ^~~~
  CC      drivers/base/attribute_container.o
  CC [M]  sound/drivers/opl3/opl3_midi.o
  CC [M]  fs/fuse/dir.o
  CC      drivers/base/transport_class.o
  CC [M]  sound/drivers/opl3/opl3_drums.o
  CC      sound/core/misc.o
  LD [M]  sound/drivers/opl3/snd-opl3-lib.o
  LD [M]  sound/drivers/opl3/snd-opl3-synth.o
  LD      sound/drivers/opl4/built-in.o
  LD      sound/drivers/pcsp/built-in.o
  LD      sound/drivers/vx/built-in.o
  CC [M]  sound/drivers/aloop.o
  CC      drivers/base/topology.o
  CC [M]  fs/fuse/file.o
  CC      drivers/base/container.o
  CC      sound/core/device.o
  CC      drivers/base/property.o
  LD      sound/drivers/built-in.o
  LD [M]  sound/drivers/snd-aloop.o
  LD      sound/firewire/built-in.o
  CC      sound/hda/hda_bus_type.o
  CC      sound/core/info.o
  CC      sound/hda/hdac_bus.o
  CC      sound/core/vmaster.o
  CC      drivers/base/cacheinfo.o
  CC [M]  fs/fuse/inode.o
  CC      sound/hda/hdac_device.o
  CC      sound/core/ctljack.o
  CC      drivers/base/devtmpfs.o
  CC      sound/core/jack.o
  CC      sound/hda/hdac_sysfs.o
  CC      drivers/base/dma-contiguous.o
  CC [M]  fs/fuse/control.o
  CC      sound/core/hwdep.o
  CC      sound/hda/hdac_regmap.o
  CC      drivers/base/power/sysfs.o
drivers/base/power/sysfs.c: In function ‘rtpm_status_show’:
drivers/base/power/sysfs.c:184:2: error: format not a string literal and no format arguments [-Werror=format-security]
  return sprintf(buf, p);
  ^~~~~~
  CC [M]  fs/fuse/xattr.o
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:338: drivers/base/power/sysfs.o] Errore 1
make[2]: *** [scripts/Makefile.build:652: drivers/base/power] Errore 2
make[1]: *** [scripts/Makefile.build:652: drivers/base] Errore 2
make: *** [Makefile:1122: drivers] Errore 2
make: *** Attesa per i processi non terminati....
  CC [M]  fs/fuse/acl.o
  CC      sound/hda/hdac_controller.o
  CC      sound/core/timer.o
  CC [M]  fs/fuse/cuse.o
  LD [M]  fs/fuse/fuse.o
    CC [M]  sound/pci/emu10k1/emu10k1x.o
In file included from sound/core/seq/seq_info.h:24:0,
                 from sound/core/seq/seq_clientmgr.c:36:
sound/core/seq/seq_clientmgr.c: In function ‘snd_seq_info_dump_subscribers’:
./include/sound/info.h:123:21: warning: format not a string literal and no format arguments [-Wformat-security]
  seq_printf((struct seq_file *)(buf)->buffer, fmt, ##args)
                     ^
sound/core/seq/seq_clientmgr.c:2411:2: note: in expansion of macro ‘snd_iprintf’
  snd_iprintf(buffer, msg);
  ^~~~~~~~~~~
  LD      fs/jbd2/jbd2.o
  LD      fs/jbd2/built-in.o
    LD [M]  fs/overlayfs/overlay.o
  CC      fs/proc/task_mmu.o
sound/usb/mixer_quirks.c: In function ‘snd_create_std_mono_ctl_offset’:
sound/usb/mixer_quirks.c:103:2: warning: format not a string literal and no format arguments [-Wformat-security]
  snprintf(kctl->id.name, sizeof(kctl->id.name), name);
  ^~~~~~~~
  CC      fs/ntfs/file.o
  CC      sound/usb/mixer_scarlett.o
   LD      fs/pstore/built-in.o
  CC      fs/quota/quota_v2.o
fs/quota/dquot.c: In function ‘find_quota_format’:
fs/quota/dquot.c:202:7: warning: format not a string literal and no format arguments [-Wformat-security]
       request_module(module_names[qm].qm_mod_name))
       ^~~~~~~~~~~~~~
  CC      fs/quota/quota_tree.o
  LD      fs/proc/proc.o
   LD      fs/built-in.o

# make -j4 Image

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC      drivers/base/power/sysfs.o
  CC      net/socket.o
drivers/base/power/sysfs.c: In function ‘rtpm_status_show’:
drivers/base/power/sysfs.c:184:2: error: format not a string literal and no format arguments [-Werror=format-security]
  return sprintf(buf, p);
  ^~~~~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:338: drivers/base/power/sysfs.o] Errore 1
make[2]: *** [scripts/Makefile.build:652: drivers/base/power] Errore 2
make[1]: *** [scripts/Makefile.build:652: drivers/base] Errore 2
make: *** [Makefile:1122: drivers] Errore 2
make: *** Attesa per i processi non terminati....
  CC      net/802/p8022.o
  CC      net/802/psnap.o

root@jetson:/home/aresuser/Desktop/antmicro/linux-tegra-4.9# find . -name Image
nothing
madisongh commented 1 week ago

I think the environment variable you would use is KBUILD_CFLAGS.

Marietto2008 commented 1 week ago

like this ? ---> KBUILD_CFLAGS=-Wno-error make -j4 ?

madisongh commented 1 week ago

I think so, yes. I always cross-compile using a controlled build environment that sets things up correctly for me, so I may be misremembering. With the right version of the toolchain and the right build environment, you shouldn't need to disable errors globally during the kernel build.

Marietto2008 commented 1 week ago

The point is that I'm not an experienced user. I'm an hobbyst. Rarely I'm sure about what are the proper toolchains and build environments. Usually I use google to find a case similar to mine and then I apply the trial and error tecnique.