Skip to content

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

Open
@jinliangli

Description

@jinliangli

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

  • I have verified before submitting the report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions