Skip to content

Command Line Build Failure #8100

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
weswitt opened this issue Oct 15, 2018 · 4 comments
Closed

Command Line Build Failure #8100

weswitt opened this issue Oct 15, 2018 · 4 comments
Labels
Component: CLI The Arduino IDE's command line interface

Comments

@weswitt
Copy link

weswitt commented Oct 15, 2018

When compiling sketches from the command line it seems that the include file behavior is different. The sketch below compiles in the IDE but fails from the command line with the error: "itest:2:18: error: test.h: No such file or directory". This is a simple sketch to demonstrate the problem. I have itest.ino and test.h. One note is that removing the ESP8266WiFi.h include fixes it. It seems that there is some funky include path stuff happening.

The sketch is as follows:

#include <ESP8266WiFi.h>
#include "test.h"

void setup()
{
}

void loop()
{
}

@per1234 per1234 added the Component: CLI The Arduino IDE's command line interface label Oct 15, 2018
@matthijskooijman
Copy link
Collaborator

What command are you using to compile this sketch exactly? Can you enable verbose compilation in the preferences and then show the verbose output of both the IDE build and the commandline build?

@weswitt
Copy link
Author

weswitt commented Oct 16, 2018

After further investigation I've found that the CLI build works the first time, but subsequent builds fail with the error below.

Command: /home/wesw/dev/arduino-1.8.6/arduino --pref build.path=/home/wesw/dev/src/homeauto/tempsensor/itest/bin --verify /home/wesw/dev/src/homeauto/tempsensor/itest/itest.ino

Output from CLI build:
Picked up JAVA_TOOL_OPTIONS:
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
Build options changed, rebuilding all
itest:2:18: error: test.h: No such file or directory
#include "test.h"
^
compilation terminated.
exit status 1

@matthijskooijman
Copy link
Collaborator

Seems you're running into a problem that I recently also spotted (see arduino/arduino-builder#299 (comment) and arduino/arduino-builder#299). The problem is triggered because your build directory is inside the sketch directory, which is incorrectly handled by the build environment. For now, my recommendation would be to use a build path outside of your sketch directory, and to watch that PR for further discussion and a real fix.

Note that there might be a second bug here: This problem also needs the "Build options changed, rebuilding all" to trigger. From what you're saying, it sounds like you're just running the exact same command twice, so the build options should not actually have been changed. I've seen this before on a Windows machine of a colleague, where we were also passing --pref to change the build path and/or sketchbook path and/or preferences.txt path IIRC, so there might be a problem there. Might also be related to having the build dir inside the sketch dir.

@weswitt
Copy link
Author

weswitt commented Oct 16, 2018

That fixed the issue for me, thanks.

@weswitt weswitt closed this as completed Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CLI The Arduino IDE's command line interface
Projects
None yet
Development

No branches or pull requests

3 participants