Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#54529 closed defect (fixed)

avr-libc @1.8.1 and avr-gcc @7.1.0 compiles but does not link because crt* file names do not match contents of spec files

Reported by: wcontello-fti Owned by: g5pw (Aljaž Srebrnič)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: g5pw (Aljaž Srebrnič)
Port: avr-libc avr-gcc

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I am still working through this problem. I have a project for an ATmeg64m1 that was compiling using a make file with avr-gcc 4.9.1. After the update to 7.1.0 it fails because it cannot find the request crt file.

I know it is locating the spec file because the messages in the log show the path for the library is "avr5":

.
.
.
Target: avr
Configured with: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_cross_avr-gcc/avr-gcc/work/gcc-7.1.0/configure --prefix=/opt/local --target=avr --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/avr-gcc --with-system-zlib --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking --enable-multilib --enable-lto --enable-languages=c,c++
Thread model: single
gcc version 7.1.0 (GCC) 
COMPILER_PATH=/opt/local/libexec/gcc/avr/7.1.0/:/opt/local/libexec/gcc/avr/7.1.0/:/opt/local/libexec/gcc/avr/:/opt/local/lib/gcc/avr/7.1.0/:/opt/local/lib/gcc/avr/:/opt/local/lib/gcc/avr/7.1.0/../../../../avr/bin/
LIBRARY_PATH=/opt/local/lib/gcc/avr/7.1.0/avr5/:/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib/avr5/:/opt/local/lib/gcc/avr/7.1.0/:/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-std=gnu99' '-v' '-Wall' '-fdefer-pop' '-Os' '-D' 'EMBEDDED' '-D' 'atmega64m1' '-D' 'F_CPU=16000000UL'  '-ffreestanding' '-fverbose-asm' '-save-temps' '-o' 'main.elf' '-specs=device-specs/specs-atmega64m1' '-mmcu=avr5'
 /opt/local/libexec/gcc/avr/7.1.0/collect2 -plugin /opt/local/libexec/gcc/avr/7.1.0/liblto_plugin.so -plugin-opt=/opt/local/libexec/gcc/avr/7.1.0/lto-wrapper -plugin-opt=-fresolution=AlphaFilter.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-latmega64m1 -mavr5 -Tdata 0x800100 -o main.elf crtatmega64m1.o -L/opt/local/lib/gcc/avr/7.1.0/avr5 -L/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib/avr5 -L/opt/local/lib/gcc/avr/7.1.0 -L/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib --relax main.o util.o Timer0.o can.o SerialProc.o AlphaFilter.o --start-group -lgcc -lm -lc -latmega64m1 --end-group
/opt/local/lib/gcc/avr/7.1.0/../../../../avr/bin/ld: cannot find crtatmega64m1.o: No such file or directory
/opt/local/lib/gcc/avr/7.1.0/../../../../avr/bin/ld: cannot find -latmega64m1
collect2: error: ld returned 1 exit status
make: *** [main.elf] Error 1

The line:

/opt/local/lib/gcc/avr/7.1.0/../../../../avr/bin/ld: cannot find crtatmega64m1.o: No such file or directory

Indicates the linker cannot find the particular start file for my device.

Then I look in the spec file "specs-atmega64m1", I see

.
.
.
*avrlibc_startfile:
	crtatmega16m1.o%s.
.
.

But the files are named:

Proton:avr5 wayne$ ls -al *m1.o
-rw-r--r--  1 wayne  wheel  10688 Jul 24 10:34 atmega32m1.o
-rw-r--r--  1 root   wheel  10688 Jul 24 10:34 crtm16m1.o
-rw-r--r--  1 root   wheel  10688 Jul 24 10:34 crtm32m1.o
-rw-r--r--  1 root   wheel  10688 Jul 24 10:34 crtm64m1.o
Proton:avr5 wayne$ pwd
/opt/local/avr/lib/avr5

if I rename the file "crt64m1.o" to "crtatmega64m1.o" then I get a little further but there is still a problem:

.
.
.
Target: avr
Configured with: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_cross_avr-gcc/avr-gcc/work/gcc-7.1.0/configure --prefix=/opt/local --target=avr --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/avr-gcc --with-system-zlib --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking --enable-multilib --enable-lto --enable-languages=c,c++
Thread model: single
gcc version 7.1.0 (GCC) 
COMPILER_PATH=/opt/local/libexec/gcc/avr/7.1.0/:/opt/local/libexec/gcc/avr/7.1.0/:/opt/local/libexec/gcc/avr/:/opt/local/lib/gcc/avr/7.1.0/:/opt/local/lib/gcc/avr/:/opt/local/lib/gcc/avr/7.1.0/../../../../avr/bin/
LIBRARY_PATH=/opt/local/lib/gcc/avr/7.1.0/avr5/:/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib/avr5/:/opt/local/lib/gcc/avr/7.1.0/:/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-std=gnu99' '-v' '-Wall' '-fdefer-pop' '-Os' '-D' 'EMBEDDED' '-D' 'atmega64m1' '-D' 'F_CPU=16000000UL'  '-ffreestanding' '-fverbose-asm' '-save-temps' '-o' 'main.elf' '-specs=device-specs/specs-atmega64m1' '-mmcu=avr5'
 /opt/local/libexec/gcc/avr/7.1.0/collect2 -plugin /opt/local/libexec/gcc/avr/7.1.0/liblto_plugin.so -plugin-opt=/opt/local/libexec/gcc/avr/7.1.0/lto-wrapper -plugin-opt=-fresolution=AlphaFilter.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-latmega64m1 -mavr5 -Tdata 0x800100 -o main.elf /opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib/avr5/crtatmega64m1.o -L/opt/local/lib/gcc/avr/7.1.0/avr5 -L/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib/avr5 -L/opt/local/lib/gcc/avr/7.1.0 -L/opt/local/lib/gcc/avr/7.1.0/../../../../avr/lib --relax main.o util.o Timer0.o can.o SerialProc.o AlphaFilter.o --start-group -lgcc -lm -lc -latmega64m1 --end-group
/opt/local/lib/gcc/avr/7.1.0/../../../../avr/bin/ld: cannot find -latmega64m1
collect2: error: ld returned 1 exit status
make: *** [main.elf] Error 1
Command /usr/bin/make failed with exit code 2

This is because the same spec file indicates:

.
.
.
*avrlibc_devicelib:
	%{!nodevicelib:-latmega64m1}
.
.
.

when I search on my machine for any file with this name I cannot find the file.

Proton:avr5 wayne$ sudo find /opt -name "*64m1*"
/opt/local/avr/include/avr/iom64m1.h
/opt/local/avr/lib/avr5/crtatmega64m1.o
/opt/local/avr/lib/avr5/crtm64m1.o
/opt/local/lib/gcc/avr/7.1.0/device-specs/specs-atmega64m1

note: The file "/opt/local/avr/lib/avr5/crtatmega64m1.o" is a copy of "/opt/local/avr/lib/avr5/crtm64m1.o" which I renamed.

So right now I am stuck because I do not know where to find this file or what it should be changed to (if appropriate).

Change History (6)

comment:1 Changed 7 years ago by wcontello-fti

OK. I downloaded and tried avr-libc 2.0.0 and found that, after completing, configure and make, that the build includes files like: "libatmega64m1.a" "crtatmega64m1.o"

so... it must mean that avr-gcc 7.1.0 needs avr-libc 2.0.0 and later (?)

I will try to move or install the files tomorrow to check this.

comment:2 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: g5pw added
Description: modified (diff)
Keywords: avr-libc avr-gcc atmega16m1 atmega32m1 atmega64m1 removed
Port: @1.8.1_0 removed
Summary: ave-libc and avr-gcc 7.1.0 compiles but does not link because crt* file names do not match contents of spec filesave-libc @1.8.1 and avr-gcc @7.1.0 compiles but does not link because crt* file names do not match contents of spec files

comment:3 Changed 7 years ago by wcontello-fti

I copied missing files from the avr_libc 2.0.0 folder to the destroot for the avr_libc 1.8.1 (installed by macports) and now I can compile my project. so... for some reason, then avr_libc 1.8.0 does not name file correctly and it does not install all necessary files.

Last edited 7 years ago by wcontello-fti (previous) (diff)

comment:4 Changed 7 years ago by wcontello-fti

The description should change from "ave-libc @1.8.1 and" to "avr-libc @1.8.1 and"

comment:5 Changed 7 years ago by g5pw (Aljaž Srebrnič)

Owner: set to g5pw
Resolution: fixed
Status: newclosed

In 052d3d64e66d0f87e0bb6b14de313fe2b89abe33/macports-ports:

cross/avr-libc: update to 2.0.0

Fixes: #54529

comment:6 Changed 7 years ago by raimue (Rainer Müller)

Port: avr-gcc added
Summary: ave-libc @1.8.1 and avr-gcc @7.1.0 compiles but does not link because crt* file names do not match contents of spec filesavr-libc @1.8.1 and avr-gcc @7.1.0 compiles but does not link because crt* file names do not match contents of spec files
Note: See TracTickets for help on using tickets.