Building/PlatformIO and Dependencies

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
oisisi
Normal user
Posts: 85
Joined: 06 Jul 2016, 13:47

Building/PlatformIO and Dependencies

#1 Post by oisisi » 26 Oct 2021, 16:45

I am trying to build a custom image but seem to be struggling with dependencies and missing files. I tried adding the necessary libraries via PIO's menu option and via the command line but that seems to clone the same repository so that it is either still missing (when going through the GUI of PIO in VS Code) or it is cloned into each sub-directory under libdeps.

What is the right way to add, e.g. IRremoteESP8266 and Neopixel?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Building/PlatformIO and Dependencies

#2 Post by Ath » 26 Oct 2021, 17:20

I have started an update for documentation on 'How to do development for ESPEasy (using PlatformIO)' in this PR [urlhttps://github.com/letscontrolit/ESPEasy/pull/3784]#3784[/url]

There you will not find anything about adding libraries to PIO, because it either is included with ESPEasy or will be fetched automatically when building. It assumes you are working in a cloned fork of the Github repo though, so maybe that's what you are missing. A description is in that PR (though in Sphinx format, I haven't added a pdf to the comments)
/Ton (PayPal.me)

oisisi
Normal user
Posts: 85
Joined: 06 Jul 2016, 13:47

Re: Building/PlatformIO and Dependencies

#3 Post by oisisi » 26 Oct 2021, 17:28

Thanks for the quick response. I work with a direct local git clone and my custom build fails with this error: "(...)ESPEasy/src/_P016_IR.ino:25:30: fatal error: IRremoteESP8266.h: No such file or directory". Would it work if I forked first and cloned my fork?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Building/PlatformIO and Dependencies

#4 Post by TD-er » 26 Oct 2021, 18:01

Double check you have a command line Git installed on your system.
When building, it needs to fetch a number of dependencies during build.
See also the steps I mentioned here: https://www.youtube.com/watch?v=ArqwMcYSMsU&t=3s

It should be perfectly fine to run from a local copy of the (complete) repository.

oisisi
Normal user
Posts: 85
Joined: 06 Jul 2016, 13:47

Re: Building/PlatformIO and Dependencies

#5 Post by oisisi » 26 Oct 2021, 18:12

TD-er wrote: 26 Oct 2021, 18:01 Double check you have a command line Git installed on your system.
A command line git is there and working. Also, I built a custom image successfully in the past (with a different clone). Do I still need to add the build flags mentioned in Custom.h: "3) define USE_CUSTOM_H as a build flags. ie : export PLATFORMIO_BUILD_FLAGS="'-DUSE_CUSTOM_H'""? I assume this is not necessary when I chose to compile by selecting from PlatformIO's environment tasks.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Building/PlatformIO and Dependencies

#6 Post by TD-er » 26 Oct 2021, 18:32

Any PlatformIO env with "custom" in the name already has this define set.
But for some envs the lib_deps and lib_ignore differ.
For ESP32 and ESP8266 those may be very clear, but most have the IR libs disabled and there is one specific for IR which has it enabled.
Make sure you are building the custom IR env when using the IR plugins.

oisisi
Normal user
Posts: 85
Joined: 06 Jul 2016, 13:47

Re: Building/PlatformIO and Dependencies

#7 Post by oisisi » 26 Oct 2021, 18:48

TD-er wrote: 26 Oct 2021, 18:32 Make sure you are building the custom IR env when using the IR plugins.
Ah. That helped. Thanks!

Now it's complaining about missing Adafruit_NeoPixel which I would like to have and where I commented the respective plugin in Custom.h. :(

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Building/PlatformIO and Dependencies

#8 Post by TD-er » 26 Oct 2021, 21:08

Do you have the entire repository just as it is on GitHub?
Just check the lib_ignore parts and the lib_deps parts in the respective .ini file where the custom_IR environment is defined.

oisisi
Normal user
Posts: 85
Joined: 06 Jul 2016, 13:47

Re: Building/PlatformIO and Dependencies

#9 Post by oisisi » 26 Oct 2021, 21:22

TD-er wrote: 26 Oct 2021, 21:08 Do you have the entire repository just as it is on GitHub?
Just check the lib_ignore parts and the lib_deps parts in the respective .ini file where the custom_IR environment is defined.
Good point. Apparently, the Neopixel library (and others) should be ignored:

Code: Select all

[env:custom_IR_ESP8266_4M1M]
extends                   = esp8266_4M1M
platform                  = ${regular_platform.platform}
platform_packages         = ${regular_platform.platform_packages}
build_flags               = ${regular_platform.build_flags} 
                            ${esp8266_4M1M.build_flags} 
                            -DPLUGIN_BUILD_CUSTOM
                            -DPLUGIN_BUILD_IR
lib_ignore                = ESP32_ping, ESP32WebServer, ServoESP32, ESP32HTTPUpdateServer, Adafruit GFX Library, LOLIN_EPD, Adafruit ILI9341, Adafruit BusIO, Adafruit NeoPixel, Adafruit Motor Shield V2 Library
extra_scripts             = ${esp8266_custom_common.extra_scripts}
I guess I'll just remove the libraries that I need for my custom build.

oisisi
Normal user
Posts: 85
Joined: 06 Jul 2016, 13:47

Re: Building/PlatformIO and Dependencies

#10 Post by oisisi » 26 Oct 2021, 21:40

oisisi wrote: 26 Oct 2021, 21:22 I guess I'll just remove the libraries that I need for my custom build.
That did it. To summarize: since I needed the IR flavor I needed to pick the custom with IR environment. Since I wanted the Neopixel library I had to remove it from the list of excluded libraries in the environment configuration.

Thanks @TD-er and @Ath for your support.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 33 guests