Issue 168685
Summary clang --target=avr cannot find avr-libc
Labels clang, libc
Assignees
Reporter airtower-luna
    I'm trying to compile a small (blinking LED) example with `clang` instead of `avr-gcc` on Debian, with all parts from the respective Debian packages (`avr-libc`, `gcc-avr`, `clang-19`). `clang` fails to find avr-libc when linking:

```
clang -I. -g -Os -Wall -mmcu=attiny85 -DF_CPU=16500000 -DBOOTLOADER_ADDRESS=0x1980 --target=avr --sysroot=/usr/lib/avr -I/usr/lib/avr/include   -c -o main.o main.c
main.c:18:1: warning: unused function 'wdr' [-Wunused-function]
   18 | wdr(void)
      | ^~~
1 warning generated.
clang -I. -g -Os -Wall -mmcu=attiny85 -DF_CPU=16500000 -DBOOTLOADER_ADDRESS=0x1980 --target=avr --sysroot=/usr/lib/avr -I/usr/lib/avr/include -Wl,-Map=main.map -v -o main.elf main.o
Debian clang version 19.1.7 (10.1)
Target: avr
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
clang: warning: no avr-libc installation can be found on the system, cannot link standard libraries [-Wavr-rtlib-linking-quirks]
clang: warning: standard library not linked and so no interrupt vector table or compiler runtime routines will be linked [-Wavr-rtlib-linking-quirks]
 "/usr/bin/avr-ld" -o main.elf --gc-sections --defsym=__DATA_REGION_ORIGIN__=0x800060 -Map=main.map main.o -mavr25
```

Looking at https://github.com/llvm/llvm-project/blob/b31199bab4865deef4e778d7a028c8ec64285654/clang/lib/Driver/ToolChains/AVR.cpp#L455-L474 I suspect part of the issue may be that the Debian package install `avr-libc` in `/usr/lib/avr/`, not within `/usr/lib/gcc/avr/14.2.0/`, but I don't understand the code well enough to be certain yet.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to