Skip to content

Cannot resolve library for nested files #484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
khswong opened this issue Nov 14, 2019 · 1 comment
Closed

Cannot resolve library for nested files #484

khswong opened this issue Nov 14, 2019 · 1 comment
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@khswong
Copy link

khswong commented Nov 14, 2019

Bug Report

Current behavior

I am trying to reproduce the build behavior of the Arduino IDE in arduino-cli s.t I can use them in a Makefile and virtualenv.

Currently, the command I run for the Arduino IDE is:

arduino=/Applications/Arduino.app/Contents/MacOS/Arduino
board=<custom board package>
$(arduino) --verify --board $(board) $(dir)/a.ino -v --pref build.path=$(dir)/build

I replaced it in my makefile as such:

arduino=arduino-cli
board=<custom board package>
$(arduino) compile --fqbn $(board) $(dir)/a.ino -v --build-path=$(dir)/build ```

When I run make,

Alternatives for src/common/CommonHeader.h []
ResolveLibrary(src/common/CommonHeader.h)
  -> candidates: []
/Users/kwong/Documents/GitHub/repository/a/a.ino:16:38: fatal error: src/common/CommonHeader.h: No such file or directory
 #include "src/common/CommonHeader.h"
                                      ^

The directory structure is like such:

repository:
| _ a/
|  | _ a.ino
|  | _ build/
|  | _ src/ 
|      | _ common/ (symbolic link to ./common)
|          | _ CommonHeader.h
| _ b/
|   | _ b.ino
|   | _ build/
|   | _ src/
|       | _ common/ (symbolic link to ./common)
|           | _ CommonHeader.h
| _ common/
    | _ CommonHeader.h

Expected behavior

Is the expected behavior to mirror the official Arduino IDE?
The builder should find local headers and not attempt to resolve them as libraries.

Environment

  • CLI version (output of arduino-cli version): Version: 0.6.0 Commit: 3a08b07
  • OS and platform: macOS Mojave 10.14.6, custom board package (based off Adafruit SAMD)

Additional context

My libraries are all managed by git submodules rather than the package manager, however, arduino-cli parses them fine.

#include <SPI.h>

#include <RF24.h>            
#include <Adafruit_GFX.h>   
#include <Adafruit_ST7735.h> 
#include <SPIMemory.h>       
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP3XX.h>

#include "src/common/CommonHeader.h"

What's likely happening is that the library resolver just takes whatever includes list the gccpreproc generates in legacy/builder, no matter if it exists in subdirectories or not. I'm wondering if that's fixed in the new builder and if there is a way to invoke that.

@per1234
Copy link
Contributor

per1234 commented Mar 31, 2022

Closing as fixed by #421 (thanks @d-a-v!)
I can reproduce the issue when using Arduino CLI 0.6.0, but not when using 0.7.0.

test sketch:

arduino_arduino-cli#484.zip

@per1234 per1234 closed this as completed Mar 31, 2022
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 31, 2022
@per1234 per1234 self-assigned this Mar 31, 2022
@per1234 per1234 added the conclusion: resolved Issue was resolved label Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants