Skip to content

Libraries installed under directories.user are not discovered #3253

Description

@tiagoavila

Describe the problem

Arduino CLI 1.5.1 does not seem to discover libraries installed in the configured user libraries folder.

The library is correctly installed and detected by arduino-cli lib list, but during compilation the library resolver does not find it.

This behavior happens on both Windows and Ubuntu 24.04.

Environment

  • OS: Ubuntu 24.04 (also reproduced on Windows)
  • Arduino CLI version:
arduino-cli  Version: 1.5.1
Commit: 01f3d4f2b
Date: 2026-06-05T10:22:17Z
  • Installation method:
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
  • Board:
arduino:avr:uno
  • Arduino AVR core:
arduino:avr 1.8.8

Arduino CLI configuration

arduino-cli config dump:

board_manager:
  additional_urls: []

directories:
  data: /home/tiago/.arduino15
  downloads: /home/tiago/.arduino15/staging
  user: /home/tiago/Arduino

Installed libraries

arduino-cli lib list:

Name  Installed  Available  Location Description
Servo 1.3.0      -          user     -

The library exists at:

/home/tiago/Arduino/libraries/Servo

with the expected structure:

Servo/
├── library.properties
└── src/
    └── Servo.h

Sketch

MyFirstSketch.ino:

#include <Servo.h>

Servo myServo;

void setup() {
  myServo.attach(9);
}

void loop() {
}

Compile command

arduino-cli compile

or:

arduino-cli compile --fqbn arduino:avr:uno

Error output

Compilation fails with:

fatal error: Servo.h: No such file or directory
#include <Servo.h>
         ^~~~~~~~~

compilation terminated.

Verbose compilation shows:

ResolveLibrary(Servo.h)
  -> candidates: []

No candidates are found for the library.

Additional information

The same issue was reproduced on Windows.

Workaround

Moving the library folder from the user library location:

~/Arduino/libraries/Servo

to the AVR platform libraries folder:

~/.arduino15/packages/arduino/hardware/avr/1.8.8/libraries

makes compilation succeed.

Command used:

cp -rv ~/Arduino/libraries/Servo \
~/.arduino15/packages/arduino/hardware/avr/1.8.8/libraries

After moving the library, arduino-cli compile finds Servo.h and the sketch builds successfully.

Expected behavior

Libraries installed with:

arduino-cli lib install Servo

should be automatically discovered from the configured user libraries directory:

directories:
  user: /home/tiago/Arduino

without requiring the library to be copied into the platform-specific libraries folder.

Additional logs

arduino-cli compile -v output:

FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: /home/tiago/.arduino15/packages/arduino/hardware/avr/1.8.8
Using core 'arduino' from platform in folder: /home/tiago/.arduino15/packages/arduino/hardware/avr/1.8.8

Detecting libraries used...
/home/tiago/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/tiago/.arduino15/packages/arduino/hardware/avr/1.8.8/cores/arduino -I/home/tiago/.arduino15/packages/arduino/hardware/avr/1.8.8/variants/standard /home/tiago/.cache/arduino/sketches/0B532B3C68DF5C9F947628F4FA330A9D/sketch/MyFirstSketch.ino.cpp.merged -o /dev/null -MMD -MF /home/tiago/.cache/arduino/sketches/0B532B3C68DF5C9F947628F4FA330A9D/sketch/MyFirstSketch.ino.cpp.merged.libsdetect.d
Alternatives for Servo.h: []
ResolveLibrary(Servo.h)
  -> candidates: []

Used platform Version Path
arduino:avr      1.8.8      /home/tiago/.arduino15/packages/arduino/hardware/avr/1.8.8
Error during build: exit status 1

To reproduce

  1. Install Arduino CLI 1.5.1:
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
  1. Initialize Arduino CLI:
arduino-cli config init
  1. Configure the Arduino user directory in arduino-cli.yaml:
directories:
  user: /home/$user/Arduino
  1. Install the Servo library:
arduino-cli lib install Servo
  1. Verify that the library is installed in the user libraries folder:
arduino-cli lib list

Expected output:

Name  Installed  Location
Servo 1.3.0      user

The library is located at:

/home/$user/Arduino/libraries/Servo
  1. Create a new Arduino sketch:
arduino-cli sketch new MyFirstSketch
cd MyFirstSketch
  1. Add the following code to MyFirstSketch.ino:
#include <Servo.h>

Servo myServo;

void setup() {
  myServo.attach(9);
}

void loop() {
}
  1. Install the Arduino AVR platform:
arduino-cli core install arduino:avr
  1. Compile the sketch:
arduino-cli compile --fqbn arduino:avr:uno
  1. Compilation fails with:
fatal error: Servo.h: No such file or directory
#include <Servo.h>
         ^~~~~~~~~

compilation terminated.

Verbose compilation output shows:

ResolveLibrary(Servo.h)
  -> candidates: []

indicating that the library resolver does not find the installed user library.

Expected behavior

Libraries installed using:

arduino-cli lib install <library-name>

should be automatically discovered by Arduino CLI during compilation from the configured user libraries directory.

Given the following configuration:

directories:
  user: /home/tiago/Arduino

and an installed library located at:

/home/tiago/Arduino/libraries/Servo

running:

arduino-cli compile --fqbn arduino:avr:uno

should resolve the dependency and compile the sketch successfully.

The verbose output should show the library being detected, for example:

Alternatives for Servo.h: [Servo@1.3.0]
ResolveLibrary(Servo.h)
  -> Servo@1.3.0

The user should not need to manually copy libraries into platform-specific directories such as:

~/.arduino15/packages/arduino/hardware/avr/1.8.8/libraries

because libraries installed in the configured user library folder should be available to all compatible boards and platforms.

Arduino CLI version

arduino-cli Version: 1.5.1 Commit: 01f3d4f Date: 2026-06-05T10:22:17Z

Operating system

Linux

Operating system version

24.04

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions