Author Topic: Not compiling before linking  (Read 4002 times)

Offline urt

  • Single posting newcomer
  • *
  • Posts: 4
Not compiling before linking
« on: December 22, 2023, 11:43:17 am »
Using Code::Blocks on Windows 10, trying AVR project. The code is fine, verified by other IDE, trying to build the project and getting these messages:

Code
avr-gcc.exe -LC:\WinAVR\avr\lib -o bin\Debug\TESDTS.elf obj\Debug\fuse.o obj\Debug\main.o  -mmcu=atmega328p -Wl,-Map=bin\Debug\TESDTS.map,--cref  
avr-gcc.exe: obj\Debug\fuse.o: No such file or directory
avr-gcc.exe: obj\Debug\main.o: No such file or directory

Feels to me that it doesn't compile them (no binary files to link into elf)
the compiler path is fine, any help?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1634
Re: Not compiling before linking
« Reply #1 on: December 22, 2023, 11:59:56 am »
This is the link log, post a full rebuild log so we can see what is failing when compiling.

Offline urt

  • Single posting newcomer
  • *
  • Posts: 4
Re: Not compiling before linking
« Reply #2 on: December 22, 2023, 12:23:21 pm »
Build started on: 22-12-2023 at 13:22.40
Build ended on: 22-12-2023 at 13:22.40
-------------- Build: Debug in TESDTS (compiler: GNU GCC Compiler for AVR)---------------
avr-gcc.exe -LC:\WinAVR\avr\lib -o bin\Debug\TESDTS.elf obj\Debug\fuse.o obj\Debug\main.o -mmcu=atmega328p -Wl,-Map=bin\Debug\TESDTS.map,--cref
avr-gcc.exe: obj\Debug\fuse.o: No such file or directory
avr-gcc.exe: obj\Debug\main.o: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I think it really doesn't compile, this is the full build log in HTML format

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1634
Re: Not compiling before linking
« Reply #3 on: December 22, 2023, 12:33:32 pm »
Did you a full rebuild log? The cleaning stage should be in the log... Please use code tags, as in the original post.

Have you set the compiler executable properly in the compiler properties?.

This page shows how executables should be configured:
Quote
    C compiler: avr-gcc.exe
    c++ compiler: avr-g++.exe
    linker for dynamic : avr-g++.exe
    linker for static: avr-ar.exe

Offline urt

  • Single posting newcomer
  • *
  • Posts: 4
Re: Not compiling before linking
« Reply #4 on: December 22, 2023, 12:54:10 pm »
Just finished following the guide, still not helping
It can't find fuse.o / main.o

I did re-build (CTRL+F11), this is the updated output of the log:
Quote
Build started on: 22-12-2023 at 13:47.53
Build ended on: 22-12-2023 at 13:47.53
-------------- Build: Debug in TESDTS (compiler: GNU GCC Compiler for AVR)---------------
avr-gcc.exe -LC:\WinAVR\avr\lib -o bin\Debug\TESDTS.elf obj\Debug\fuse.o obj\Debug\main.o -mmcu=atmega328p -Wl,-Map=bin\Debug\TESDTS.map,--cref
c:/avr-gcc-12.1.0-x64-windows/bin/../lib/gcc/avr/12.1.0/../../../../avr/bin/ld.exe: cannot find obj\Debug\fuse.o: Invalid argument
c:/avr-gcc-12.1.0-x64-windows/bin/../lib/gcc/avr/12.1.0/../../../../avr/bin/ld.exe: cannot find obj\Debug\main.o: Invalid argument
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1634
Re: Not compiling before linking
« Reply #5 on: December 22, 2023, 02:53:14 pm »
Can you attach the CBP file?

Offline urt

  • Single posting newcomer
  • *
  • Posts: 4
Re: Not compiling before linking
« Reply #6 on: December 22, 2023, 05:23:36 pm »
The extension is not allowed, this is the file's contents:
Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="TESDTS" />
<Option pch_mode="2" />
<Option compiler="avr-gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/TESDTS.elf" prefix_auto="1" extension_auto="0" />
<Option working_dir="" />
<Option object_output="obj/Debug/" />
<Option type="5" />
<Option compiler="avr-gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/TESDTS.elf" prefix_auto="1" extension_auto="0" />
<Option working_dir="" />
<Option object_output="obj/Release/" />
<Option type="5" />
<Option compiler="avr-gcc" />
<Compiler>
<Add option="-Os" />
</Compiler>
</Target>
<Environment>
<Variable name="MCU" value="atmega328p" />
</Environment>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-mmcu=atmega328p" />
<Add option="-DF_CPU=16000000UL" />
</Compiler>
<Linker>
<Add option="-mmcu=atmega328p" />
<Add option="-Wl,-Map=$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).map,--cref" />
</Linker>
<ExtraCommands>
<Add after="avr-size --mcu=atmega328p --format=avr $(TARGET_OUTPUT_FILE)" />
<Add after='cmd /c &quot;avr-objdump -h -S $(TARGET_OUTPUT_FILE) &gt; $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lss&quot;' />
<Add after="avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).hex" />
<Add after="avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).eep" />
<Add after="avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lock" />
<Add after="avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).sig" />
<Add after="avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse" />
<Add after="srec_cat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse -Intel -crop 0x00 0x01 -offset  0x00 -O $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lfs -Intel" />
<Add after="srec_cat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse -Intel -crop 0x01 0x02 -offset -0x01 -O $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).hfs -Intel" />
<Add after="srec_cat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse -Intel -crop 0x02 0x03 -offset -0x02 -O $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).efs -Intel" />
</ExtraCommands>
<Unit filename="fuse.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="main.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

I think that the compiler is not working because there are no *.o files at the directory at all
« Last Edit: December 22, 2023, 05:29:35 pm by urt »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1634
Re: Not compiling before linking
« Reply #7 on: December 22, 2023, 06:34:15 pm »
This looks right to me, although I use Atmel Studio 7 for AVR developing instead of C::B.

Can you attach a screen capture of the Settings->Compiler->GCC compiler for AVR->Toolchain executables tab?