Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » cross compiler: eclipse build keep selecting the incorrect cross compiler(cross compiler: eclipse build keep selecting the incorrect cross compiler)
cross compiler: eclipse build keep selecting the incorrect cross compiler [message #1818786] Sat, 28 December 2019 11:46 Go to next message
a g is currently offline a gFriend
Messages: 1
Registered: December 2019
Junior Member
i've setup my eclipse CDT project to use an ARM gcc cross compiler to compile some Arduino (stm32duino) based (c, c++ sketches)
in c++ build cross settings i've updated the prefix and path of the gcc toolchain (arm none eabi cross compiler)
index.php/fa/37038/0/
index.php/fa/37039/0/

however, when i do a build
**** Incremental Build of configuration Debug for project STM32F1STduino-blinky ****
make all 
Building file: ../Arduino_Core_STM32/variants/PILL_F103XX/PeripheralPins.c
gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
Invoking: Cross GCC Compiler
gcc -DVECT_TAB_OFFSET=0x2000 -DSTM32F103xB -DSTM32F1xx

^^^ it keeps invoking the incorrect gcc compiler. it invoke the default gcc compiler installed in the distribution instead of the cross compiler /opt/arduino/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi-gcc

it has actually invoked the correct compiler in this very similar settings and it builds using the correct cross compiler just a while back. but after i populated some additional parameters and options in the build settings (e.g. add additional flags etc). i do a clean and rebuild.
this time instead of building with the cross compiler it invokes the default gcc installed for the linux distribution instead.

in addition, if i review the system generated makefiles in Debug folder, some of the make files has the correct cross compiler command there, subdir.mk
src/%.o: ../src/%.cpp
	@echo 'Building file: $<'
	@echo 'Invoking: Cross G++ Compiler'
	arm-none-eabi-g++ -std=c++0x -DVECT_TAB_OFFSET=0x2000 -DSTM32F103xB 


while in a different sub-directory it becomes subdir.mk
Arduino_Core_STM32/cores/arduino/%.o: ../Arduino_Core_STM32/cores/arduino/%.cpp
	@echo 'Building file: $<'
	@echo 'Invoking: Cross G++ Compiler'
	g++ -std=c++0x -DVECT_TAB_OFFSET=0x2000  -DSTM32F103xB 


hence in this 2nd case the build fails, but all these are sources in the same project just in different directories. any idea how to resolve this? i don't seem to be able to recover to a normal build i.e. just prior to me adding the build flags and selecting build options it works just ok, after those are updated it invokes invalid gcc and generates invalid make files instead

thanks much in advance!
Re: cross compiler: eclipse build keep selecting the incorrect cross compiler [message #1819221 is a reply to message #1818786] Fri, 10 January 2020 07:51 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
I made a small project mixing C++ and C with the C files in another directory.
I also used the Cross GCC compile with the prefix set to arm-none-eabi-
It built as expected (see below).

Maybe the Debug directory makefiles weren't rebuilt after you set the prefix.
Try deleting the Debug directory then rebuild.

03:11:09 **** Build of configuration Debug for project Cross_CPPandC ****
make all 
Building file: ../src/Cross_CPPandC.cpp
Invoking: Cross G++ Compiler
arm-none-eabi-g++ -I"/home/dvavra/workspaces/2019-09/Default/Cross_CPPandC/inc" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Cross_CPPandC.d" -MT"src/Cross_CPPandC.o" -o "src/Cross_CPPandC.o" "../src/Cross_CPPandC.cpp"
Finished building: ../src/Cross_CPPandC.cpp
 
Building file: ../c_src/otherFunc.c
Invoking: Cross GCC Compiler
arm-none-eabi-gcc -I"/home/dvavra/workspaces/2019-09/Default/Cross_CPPandC/inc" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"c_src/otherFunc.d" -MT"c_src/otherFunc.o" -o "c_src/otherFunc.o" "../c_src/otherFunc.c"
Finished building: ../c_src/otherFunc.c
 
Building target: Cross_CPPandC
Invoking: Cross G++ Linker
arm-none-eabi-g++ -L/home/dvavra/.arduinocdt/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/lib --specs=nosys.specs -o "Cross_CPPandC"  ./src/Cross_CPPandC.o  ./c_src/otherFunc.o   
Finished building target: Cross_CPPandC
 

03:11:10 Build Finished. 0 errors, 0 warnings. (took 1s.287ms)

[Updated on: Fri, 10 January 2020 11:08]

Report message to a moderator

Previous Topic:Can't debug startup code Reset_Handler
Next Topic:Given a project, how to change file holding the main c/cpp file?
Goto Forum:
  


Current Time: Thu Mar 28 16:15:57 GMT 2024

Powered by FUDForum. Page generated in 0.02663 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top