apache / apache/nuttx

[BUG] duplicate CFLAGS in linking when Cmake and ninja backend building

Open
#14,426 0 comments 0 reactions 0 assignees View on GitHub
Arch: all Area: Build system
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

### Description / Steps to reproduce the issue

Duplicate CFLAGS(e.g. -mcpu=cortex-a7) in linking like the below:

`arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-g++ --specs=nosys.specs -Wl,--entry=__start -nostdlib -Wl,--gc-sections -Wl,--cref -Wl,-Map=nuttx.map CMakeFiles/nuttx.dir/empty.cxx.obj CMakeFiles/final_nuttx.dir/kasan_global_final.c.obj -o final_nuttx -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -fno-common -Wall -Wshadow -Wundef -nostdlib -Os -fno-strict-aliasing -fomit-frame-pointer -fsanitize=kernel-address --param=asan-globals=1 -ffunction-sections -fdata-sections -g -Wno-attributes -Wno-unknown-pragmas -Wstrict-prototypes -Wno-psabi -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -fno-common -Wall -Wshadow -Wundef -nostdlib -Os -fno-strict-aliasing -fomit-frame-pointer -fsanitize=kernel-address --param=asan-globals=1 -ffunction-sections -fdata-sections -g -Wno-attributes -Wno-unknown-pragmas -Wstrict-prototypes -Wno-psabi -fdiagnostics-color=always -T dramboot.ld.tmp -Wl,--start-group arch/libarch.a binfmt/libbinfmt.a drivers/libdrivers.a fs/libfs.a libs/libc/libc.a mm/libmm.a sched/libsched.a boards/libboard.a libs/libxx/liblibcxxmini.a apps/libapps.a apps/builtin/libapps_builtin.a apps/system/nsh/libapps_nsh.a apps/system/nsh/libapps_sh.a apps/testing/getprime/libapps_getprime.a apps/testing/kasantest/libapps_kasantest.a apps/testing/ostest/libapps_ostest.a apps/examples/hello/libapps_hello.a`

**Reproduce steps:**

1. cmake -B build -DBOARD_CONFIG=qemu-armv7a:nsh -GNinja
2. cd build
3. ninja -v

There is no such issue when Cmake and makefile backend building.

### On which OS does this issue occur?

[OS: Linux]

### What is the version of your OS?

Ubuntu 20.04.6 LTS

### NuttX Version

master

### Issue Architecture

[Arch: all]

### Issue Area

[Area: Build System]

### Verification

- [X] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.