riscv / meta-riscv

OpenEmbedded/Yocto layer for RISC-V Architecture
https://riscv.org/
Other
365 stars 140 forks source link

Error while compiling perf #457

Closed Poopi closed 8 months ago

Poopi commented 9 months ago

Description Compilation exits with error when compiling perf recipe.

Steps to reproduce the issue:

  1. Setup environment
  2. Run bitbake

Compilation error: | cpumap.c: In function 'perf_cpu_map__merge': | cpumap.c:366:20: error: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] | 366 | tmp_cpus = malloc(tmp_len * sizeof(struct perf_cpu)); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | In file included from cpumap.c:3: | /home/poopi/Projects/riscv-yocto/build-weston-sdk/tmp/work/visionfive2-poky-linux/perf/1.0/recipe-sysroot/usr/include/stdlib.h:672:14: note: in a call to allocation function 'malloc' declared here | 672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ | | ^~~~~~ | cc1: all warnings being treated as errors | make[4]: *** [/home/poopi/Projects/riscv-yocto/build-weston-sdk/tmp/work/visionfive2-poky-linux/perf/1.0/perf-1.0/tools/build/Makefile.build:96: /home/poopi/Projects/riscv-yocto/build-weston-sdk/tmp/work/visionfive2-poky-linux/perf/1.0/perf-1.0/cpumap.o] Error 1 Since int_temp is declared as integer compiler is complaining about potential negative value. Simple casting to (unsigned int) solves the issue.

Host:x86_64-linux Target: visionfive2 Image:core-image-weston-sdk

Issue similar to commit d52d7f524bea8f67580218ce5bfbc69036d6a9f5 in poky

AlexBu commented 7 months ago

Hi, I still got the same compiling error on visionfive2 board, this patch should be applied to jh7110 override as well.