Page MenuHomePhabricator

rk3399: Cannot compile with clang
Open, Needs TriagePublic


Target rk3399 cannot be compiled with clang. The following uses clang 15.0.7, but the build is equally broken with clang 14.0.

(Do you have a continuous testing/integration framework? If so, could it build all supported targets with both gcc and clang?)

$ cat Dockerfile
FROM alpine:3.17.2
RUN apk add clang dtc git lld llvm make
WORKDIR /build
RUN git clone .
RUN clang --version && make CC=/usr/bin/clang PLAT=rk3399 all

$ podman build -t bugreport .  # can also use docker instead of podman, with same arguments
STEP 1/5: FROM alpine:3.17.2
STEP 2/5: RUN apk add clang dtc git lld llvm make
--> Using cache 9386d44a36410aa76daf761e3e75ce638b8782f54cf897eef1675ed6d4f1f649
--> Pushing cache []:d80bd5a6f9048c013a209283311585fbbab722b18323105ab86b9fb8660623d1
--> 9386d44a364
STEP 3/5: WORKDIR /build
--> Using cache 277730fd1c506b28b45283eda0a11cfa735ab17e74da32aeee2751653736be48
--> Pushing cache []:0aa8c313cb0f5b8ac9a5ae744d97946d08fa43077248c1cc6e124727b36467f0
--> 277730fd1c5
STEP 4/5: RUN git clone .
--> Using cache 100c3f6a17702d65e423970cfb14378c13f81b90f91ef3948f69f2aeb29da59e
--> Pushing cache []:d3ff8c1a704aa940ec90f707b159f0e1191f4babc03b3bcf7da2fc523f05e642
--> 100c3f6a177
STEP 5/5: RUN clang --version && make CC=/usr/bin/clang PLAT=rk3399 all
Alpine clang version 15.0.7
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: /usr/bin
  CC      lib/libfdt/fdt.c
  CC      lib/libfdt/fdt_addresses.c
  CC      lib/libfdt/fdt_empty_tree.c
  CC      lib/libfdt/fdt_ro.c
  CC      lib/libfdt/fdt_rw.c
  CC      lib/libfdt/fdt_strerror.c
  CC      lib/libfdt/fdt_sw.c
  CC      lib/libfdt/fdt_wip.c
  AR      /build/build/rk3399/release/lib/libfdt.a
Building rk3399
  CC      lib/libc/abort.c
  CC      lib/libc/assert.c
  CC      lib/libc/exit.c
  CC      lib/libc/memchr.c
  CC      lib/libc/memcmp.c
  CC      lib/libc/memcpy.c
  CC      lib/libc/memmove.c
  CC      lib/libc/memrchr.c
  CC      lib/libc/memset.c
  CC      lib/libc/printf.c
  CC      lib/libc/putchar.c
  CC      lib/libc/puts.c
  CC      lib/libc/snprintf.c
  CC      lib/libc/strchr.c
  CC      lib/libc/strcmp.c
  CC      lib/libc/strlcat.c
  CC      lib/libc/strlcpy.c
  CC      lib/libc/strlen.c
  CC      lib/libc/strncmp.c
  CC      lib/libc/strnlen.c
  CC      lib/libc/strrchr.c
  CC      lib/libc/strtok.c
  CC      lib/libc/strtoul.c
  CC      lib/libc/strtoll.c
  CC      lib/libc/strtoull.c
  CC      lib/libc/strtol.c
  AS      lib/libc/aarch64/setjmp.S
  AR      /build/build/rk3399/release/lib/libc.a
  CC      bl31/bl31_context_mgmt.c
  CC      bl31/bl31_main.c
  CC      bl31/bl31_traps.c
  CC      bl31/interrupt_mgmt.c
  CC      common/runtime_svc.c
  CC      drivers/arm/cci/cci.c
  CC      drivers/arm/gic/v3/arm_gicv3_common.c
  CC      drivers/arm/gic/v3/gic-x00.c
  CC      drivers/arm/gic/v3/gicdv3_helpers.c
  CC      drivers/arm/gic/v3/gicrv3_helpers.c
  CC      drivers/arm/gic/v3/gicv3_helpers.c
  CC      drivers/arm/gic/v3/gicv3_main.c
  CC      drivers/delay_timer/delay_timer.c
  CC      drivers/delay_timer/generic_delay_timer.c
  CC      drivers/gpio/gpio.c
  CC      lib/cpus/errata_report.c
  CC      lib/el3_runtime/aarch64/context_mgmt.c
  CC      lib/el3_runtime/cpu_data_array.c
  CC      lib/extensions/spe/spe.c
  CC      lib/locks/bakery/bakery_lock_coherent.c
  CC      lib/psci/psci_common.c
  CC      lib/psci/psci_main.c
  CC      lib/psci/psci_mem_protect.c
  CC      lib/psci/psci_off.c
  CC      lib/psci/psci_on.c
  CC      lib/psci/psci_setup.c
  CC      lib/psci/psci_suspend.c
  CC      lib/psci/psci_system_off.c
  CC      plat/common/plat_gicv3.c
  CC      plat/rockchip/common/aarch64/platform_common.c
  CC      plat/rockchip/common/bl31_plat_setup.c
  CC      plat/rockchip/common/params_setup.c
  CC      plat/rockchip/common/plat_pm.c
  CC      plat/rockchip/common/plat_topology.c
  CC      plat/rockchip/common/rockchip_gicv3.c
  CC      plat/rockchip/common/rockchip_sip_svc.c
  CC      plat/rockchip/rk3399/drivers/dram/dfs.c
  CC      plat/rockchip/rk3399/drivers/dram/dram.c
  CC      plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c
plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c:781:11: error: explicitly assigning value of variable of type 'uint32_t' (aka 'unsigned int') to itself [-Werror,-Wself-assign]
                twr_tmp = twr_tmp;
                ~~~~~~~ ^ ~~~~~~~
1 error generated.
make: *** [Makefile:1390: /build/build/rk3399/release/bl31/dram_spec_timing.o] Error 1
Error: building at STEP "RUN clang --version && make CC=/usr/bin/clang PLAT=rk3399 all": while running runtime: exit status 2

Event Timeline

brawer created this task.Mar 7 2023, 11:37 AM

With their addictive gameplay, vibrant visuals, and immersive storylines, Papa's Games are the ultimate choice for gamers seeking a delightful and engaging experience. Get ready to embark on an unforgettable gaming adventure with Papa's Games!

This error is caused by an unnecessary self-assignment of a variable. You can simply remove the line "twr_tmp = twr_tmp;" from the code and try building again. io games