VS Code with nRF KConfig unable to build working config for native_posix

It appears that KConfig is uable to find any compilers for native_posix with VS Code on windows 10 after installing all recommended packages and prerequisites during SDK install.

On Linux or via example docker images this is solved by supplying gcc in /usr/bin/gcc.

If one has Visual Studio community 2022 installed, this generator (running cmake-gui manually from console on windows 10) does provide a working gcc.

  • Hello,

    Which toolchain version and nRF command line tools are you trying with?

    Could you provide more details on the error message you are getting.

    Kind Regards,

    Abhijith

  • I have tried using nRF Connect SDK 2.1.0 (and are now testing with 2.1.1).

    I think the reason is simply there is no native compilers supplied by MS with VS Code.

  • Hello,

    Thank you.

    Please attach the error message with the response.

    Kind Regards,

    Abhijith

  • When trying to create build config for our unit tests in VS Code we received:
    "command failed with return code: The system cannot find the file specified"

    After finding which cmake script failed I found it was trying to run a command with CMAKE_DTS_PREPROCESSOR variable, which when I printed it out read "CMAKE_C_COMPILER-NOTFOUND".

    Installing mingw and gcc made it instead print: "Found assembler: C:/msys64/mingw64/bin/gcc.exe"
    I suspect my next issue is simply that it now builds a 64bit binary.

    C:\Users\KreAture\AppData\Local\Temp\ccbZxlL5.s: Assembler messages:
    C:\Users\KreAture\AppData\Local\Temp\ccbZxlL5.s:17: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    C:\Users\KreAture\AppData\Local\Temp\ccbZxlL5.s:17: Error: junk at end of line, first unrecognized character is `_'
    C:\Users\KreAture\AppData\Local\Temp\ccbZxlL5.s:23: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    C:\Users\KreAture\AppData\Local\Temp\ccbZxlL5.s:23: Error: junk at end of line, first unrecognized character is `_'
    C:\Users\KreAture\AppData\Local\Temp\ccbZxlL5.s:29: Warning: .type pseudo-op used outside of .def/.endef: ignored.

  • I managed to copy out the .s files generated before they were autodeleted by something in the toolchain.

    The errors listed this time:

    ccJNPtGA.s: Assembler messages:
    ccJNPtGA.s:19: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:19: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:25: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:25: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:31: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:31: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:37: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:37: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:43: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:43: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:49: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:49: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:55: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:55: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:61: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:61: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:67: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:67: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:73: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:73: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:79: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:79: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:85: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:85: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:91: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:91: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:97: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:97: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:103: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:103: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:109: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:109: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:115: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:115: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:121: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:121: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:127: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:127: Error: junk at end of line, first unrecognized character is `K'
    ccJNPtGA.s:133: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:133: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:139: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:139: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:145: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:145: Error: junk at end of line, first unrecognized character is `_'
    ccJNPtGA.s:151: Warning: .type pseudo-op used outside of .def/.endef: ignored.
    ccJNPtGA.s:151: Error: junk at end of line, first unrecognized character is `_'
    ninja: build stopped: subcommand failed.


    This file starts:
    	.file	"offsets.c"
    	.text
    Ltext0:
    	.cfi_sections	.debug_frame
    	.file 1 "C:/ncs/v2.1.1/zephyr/arch/posix/core/offsets/offsets.c"
    	.section	.text$_OffsetAbsSyms,"x"
    	.globl	__OffsetAbsSyms
    	.def	__OffsetAbsSyms;	.scl	2;	.type	32;	.endef
    __OffsetAbsSyms:
    LFB382:
    	.file 2 "C:/ncs/v2.1.1/zephyr/kernel/include/kernel_offsets.h"
    	.loc 2 26 1 view -0
    	.cfi_startproc
    	.loc 2 28 1 view LVU1
    /APP
     # 28 "C:/ncs/v2.1.1/zephyr/kernel/include/kernel_offsets.h" 1
    	.globl	___cpu_t_current_OFFSET
    	.equ	___cpu_t_current_OFFSET,8
    	.type	___cpu_t_current_OFFSET,@object
     # 0 "" 2
    	.loc 2 29 1 view LVU2
     # 29 "C:/ncs/v2.1.1/zephyr/kernel/include/kernel_offsets.h" 1
    	.globl	___cpu_t_nested_OFFSET
    	.equ	___cpu_t_nested_OFFSET,0
    	.type	___cpu_t_nested_OFFSET,@object
     # 0 "" 2
    	.loc 2 30 1 view LVU3
     # 30 "C:/ncs/v2.1.1/zephyr/kernel/include/kernel_offsets.h" 1
    	.globl	___cpu_t_irq_stack_OFFSET
    	.equ	___cpu_t_irq_stack_OFFSET,4
    	.type	___cpu_t_irq_stack_OFFSET,@object
     # 0 "" 2
    	.loc 2 31 1 view LVU4
     # 31 "C:/ncs/v2.1.1/zephyr/kernel/include/kernel_offsets.h" 1
    

    There are 2 other files generated that look normal like this:

    	.file	"CMakeCCompilerId.c"
    	.text
    	.globl	_info_compiler
    	.section .rdata,"dr"
    LC0:
    	.ascii "INFO:compiler[GNU]\0"
    	.data
    	.align 4
    _info_compiler:
    	.long	LC0
    	.globl	_info_version
    	.section .rdata,"dr"
    	.align 32
    _info_version:
    	.ascii "INFO:compiler_version[00000012.00000002.00000000]\0"
    	.globl	_info_platform
    LC1:
    	.ascii "INFO:platform[MinGW]\0"
    	.data
    	.align 4
    _info_platform:
    	.long	LC1
    	.globl	_info_arch
    	.section .rdata,"dr"
    LC2:
    	.ascii "INFO:arch[]\0"
    	.data
    	.align 4
    _info_arch:
    	.long	LC2
    	.globl	_info_language_dialect_default
    	.section .rdata,"dr"
    LC3:
    	.ascii "INFO:dialect_default[11]\0"
    	.data
    	.align 4
    _info_language_dialect_default:
    	.long	LC3
    	.def	___main;	.scl	2;	.type	32;	.endef

    These other file both look like compiler ID tests for c and cpp.

Related