Skip to content

Q: Servo library is not installed by platform.install? #1611

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
4ntoine opened this issue Jan 1, 2022 · 4 comments
Closed

Q: Servo library is not installed by platform.install? #1611

4ntoine opened this issue Jan 1, 2022 · 4 comments
Labels
conclusion: invalid Issue/PR not valid type: support OT: Request for help using the project

Comments

@4ntoine
Copy link
Contributor

4ntoine commented Jan 1, 2022

Bug Report

Current behavior

Sketch compilation with library used succeeds over cmd, but fails over grpc.

cmd:

> arduino-cli sketch new serv
> cat /tmp/serv/serv.ino 
#include <Servo.h>

Servo myservo;

void setup() {
}

void loop() {
}
> arduino-cli core list
ID          Installed Latest Name              
arduino:avr 1.8.3     1.8.4  Arduino AVR Boards
> arduino-cli compile --fqbn arduino:avr:uno /tmp/serv
Sketch uses 1154 bytes (3%) of program storage space. Maximum is 32256 bytes.
Global variables use 50 bytes (2%) of dynamic memory, leaving 1998 bytes for local variables. Maximum is 2048 bytes.

grpc (dart code):

// platform is previously installed as follows:
var responseStream = client.platformInstall(PlatformInstallRequest(
        instance: cliInstance,
        platformPackage: platform.getPackage(),
        architecture: platform.getArchitecture(),
        version: platform.availableVersion
    ));
...
// create
final createResponse = await client.create(CreateRequest.getDefault());
// update index
await for (var res in client.updateIndex(UpdateIndexRequest(
        instance: createResponse.instance))) {
        // nothing
      }
// update libs
await for (var res in client.updateLibrariesIndex(UpdateLibrariesIndexRequest(
          instance: createResponse.instance))) {
        // nothing
      }
// init
await for (var res in client.init(InitRequest(
          instance: createResponse.instance))) {
        // nothing
      }
// compile
var sources = Map<String, String>();
    this.sketchPresenter!.model.files.forEach((sourceFile) {
      sources[sourceFile.name] = sourceFile.text!;
    });
final compileStream = client.compile(CompileRequest(
        instance: cliInstance,
        sketchPath: someSketchPath,
        fqbn: "arduino:avr:uno",
        verbose: true,
        sourceOverride: sources,
        buildPath: someBuildPath
    )).asBroadcastStream();

Getting:

Alternatives for Servo.h []
ResolveLibrary(Servo.h)
-> candidates: []
/user/ser/ser.ino:1:10: fatal error: Servo.h: No such file or directory
...

Expected behavior

Compilation over gRPC succeeds.

Environment

  • CLI version (output of arduino-cli version): 0.20.2
  • OS and platform: macos

Additional context

@4ntoine
Copy link
Contributor Author

4ntoine commented Jan 1, 2022

PS. cmd and grpc tested on different devices (probably makes sense)

@4ntoine
Copy link
Contributor Author

4ntoine commented Jan 1, 2022

Ah, cmd executing on the same device failed - it seems that "Servo" is not installed by platform install command. Is it expected to be installed additionally?

That's what i have:

ls ../data/packages/arduino/hardware/avr/1.8.4/libraries/
EEPROM          HID             SPI             SoftwareSerial  Wire

@4ntoine 4ntoine changed the title Q: how to compile with library used? Q: Servo library is not installed by platform.install? Jan 1, 2022
@4ntoine
Copy link
Contributor Author

4ntoine commented Jan 1, 2022

Yeah, i had to install it additionally and it works now. The only thing that is not clear what's the default llibs list to be installed? Is it an expected behaviour?

@4ntoine 4ntoine closed this as completed Jan 1, 2022
@per1234
Copy link
Contributor

per1234 commented Jan 1, 2022

what's the default llibs list to be installed?

Hi @4ntoine. You can learn about the "platform bundled libraries" that are installed along with an Arduino platform here:

https://arduino.github.io/arduino-cli/0.20/platform-specification/#platform-bundled-libraries

Although it is a common convention to provide the fundamental SPI and Wire libraries at least, the platform author is free to choose the libraries that are bundled, so there is no fixed list of libraries to be installed with a platform.

Is it an expected behaviour?

Yes. Unlike the Arduino IDE, the installation of Arduino CLI itself doesn't come with any libraries. So, other than the platform bundled libraries of the board you are compiling for, all others must be installed via lib install. There is currently an odd exception to that, which is described here: #1565

@per1234 per1234 added conclusion: invalid Issue/PR not valid type: support OT: Request for help using the project labels Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: invalid Issue/PR not valid type: support OT: Request for help using the project
Projects
None yet
Development

No branches or pull requests

2 participants