gcc.exe: error: unrecognized command-line option '-mthumb'

Open
#593 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c, cmake
Domain
build-system

Research direction

Start at CMakeLists.txt:7 and inspect how the compiler and toolchain are selected during project configuration. Re-run the configure step while checking the compiler shown in the output; done means CMake uses a compiler that accepts the ARM flags and the simple test program configures successfully.

Written by the indexing model from the issue text.

Description

I tried compiling the i2c\lcd_1602_i2c example and got the below error, any idea on how I can get around this?

C:\Users-\Documents\pico\pico-examples\build\i2c\lcd_1602_i2c>mingw32-make
PICO_SDK_PATH is C:/Users/-/Downloads/pico-sdk-master (1)/pico-sdk
Target board (PICO_BOARD) is 'pico'.
Using board configuration from C:/Users/-/Downloads/pico-sdk-master (1)/pico-sdk/src/boards/include/boards/pico.h
Pico Platform (PICO_PLATFORM) is 'rp2040'.
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/VSARM/mingw/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/VSARM/mingw/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler

"C:/VSARM/mingw/mingw64/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: 'C:/Users/-/Documents/pico/pico-examples/build/CMakeFiles/CMakeScratch/TryCompile-cjdk0h'

Run Build Command(s): "C:/Program Files/CMake/bin/cmake.exe" -E env VERBOSE=1 C:/VSARM/mingw/mingw64/bin/mingw32-make.exe -f Makefile cmTC_34270/fast
mingw32-make[1]: Entering directory 'C:/Users/-/Documents/pico/pico-examples/build/CMakeFiles/CMakeScratch/TryCompile-cjdk0h'
C:/VSARM/mingw/mingw64/bin/mingw32-make.exe  -f CMakeFiles\cmTC_34270.dir\build.make CMakeFiles/cmTC_34270.dir/build
mingw32-make[2]: Entering directory 'C:/Users/-/Documents/pico/pico-examples/build/CMakeFiles/CMakeScratch/TryCompile-cjdk0h'
Building C object CMakeFiles/cmTC_34270.dir/testCCompiler.c.obj
C:\VSARM\mingw\mingw64\bin\gcc.exe   -mcpu=cortex-m0plus -mthumb  -o CMakeFiles\cmTC_34270.dir\testCCompiler.c.obj -c C:\Users\-\Documents\pico\pico-examples\build\CMakeFiles\CMakeScratch\TryCompile-cjdk0h\testCCompiler.c
gcc.exe: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
gcc.exe: error: unrecognized command-line option '-mthumb'
mingw32-make[2]: *** [CMakeFiles\cmTC_34270.dir\build.make:80: CMakeFiles/cmTC_34270.dir/testCCompiler.c.obj] Error 1
mingw32-make[2]: Leaving directory 'C:/Users/-/Documents/pico/pico-examples/build/CMakeFiles/CMakeScratch/TryCompile-cjdk0h'
mingw32-make[1]: *** [Makefile:132: cmTC_34270/fast] Error 2
mingw32-make[1]: Leaving directory 'C:/Users/-/Documents/pico/pico-examples/build/CMakeFiles/CMakeScratch/TryCompile-cjdk0h'

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)

-- Configuring incomplete, errors occurred!
mingw32-make: *** [Makefile:1520: cmake_check_build_system] Error 1

Dominant language
C
Stars
3.9k
Forks
1k
Avg merge
1d 16h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/pico-examples

All issues in raspberrypi/pico-examples

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.