본문 바로가기

개발/embed

CMakeCache.txt: Error: unrecognized option '--major-image-version'

반응형

 

cmake 로 makefile 만들고 build 할때  

unrecognized option '--major-image-version'

라는 에러가 날때 

 

즉 다음과 같은 명령과 에러 나면,

=========================================================

E:\Src\prjBahk\UART_AutoFlow>cmake -S . -B build -G "MinGW Makefiles"

E:\Src\prjBahk\UART_AutoFlow>cmake --build build -j16


// makefile 만들기 명령
E:\UART_AutoFlow>cmake -S . -B build -G "MinGW Makefiles"

// 컴파일 명령
E:\UART_AutoFlow>cmake --build build -j16

// 에러 메세지
In file included from E:/UART_AutoFlow/_Lib/NUC472_442/Include/NUC472_442.h:29084,
                 from E:\UART_AutoFlow\_LIb\StdDriver\src\retarget.c:13:
At top level:
E:/UART_AutoFlow/_Lib/StdDriver/inc/cap.h:87:17: warning: 'u32EscapeFrame' defined but not used [-Wunused-variable]
   87 | static uint32_t u32EscapeFrame = 0;
      |                 ^~~~~~~~~~~~~~
[100%] Linking C executable UART_AutoFlow.elf.exe
e:/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'   // ====== Error 부분
e:/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
make[2]: *** [CMakeFiles\UART_AutoFlow.elf.dir\build.make:220: UART_AutoFlow.elf.exe] Error 1
make[1]: *** [CMakeFiles\Makefile2:86: CMakeFiles/UART_AutoFlow.elf.dir/all] Error 2
make: *** [Makefile:90: all] Error 2

E:\Src\prjBahk\UART_AutoFlow>

 

 

1. build directory 를 지운다

2. CMakeCache.txt 에 

    set(CMAKE_SYSTEM_NAME Generic) 을

    cmake_minimum_required(VERSION 3.13) 바로 아래에

   추가하여 아래 코드 처럼 한다.    ( 아래 코드 참조 )

3. 다시 빌드 해 본다.

 

cmake_minimum_required(VERSION 3.13)
set(CMAKE_SYSTEM_NAME Generic)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools")
include(arm-none-eabi-gcc)
:
:

 

 

그럼 해결이 되네요.

 

 

https://stackoverflow.com/questions/75155190/visual-studio-code-cmake-causes-error-ld-exe-unrecognized-option-major-image

를 참조 하였읍니다.

 

 

==========================
수고 하셨읍니다.
도움이 되셨으면, 댓글 부탁합니다. 댓글 하나에 힘이 됩니다.

고맙읍니다.

반응형