-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Modularise makefiles #1724
Modularise makefiles #1724
Conversation
I tried to build the Basic_Blink sample using the following commands:
That did not work for me and ended up with the following error:
git shows that the http-parser subodule is not fetched
@mikee47 Can you check if you encounter the same issue? |
I've re-checked this under Linux and works OK for me. You should get a list of |
Does your SMING_HOME path have a / at the end? I just tried doing that and get the same error. I'll add a check for that in the makefiles. |
I tried using brand new clone of the repository in completely different direction and it worked. For the repo where it worked I did not have trailing slash - So I guess the trailing slash is the one causing the problem. |
Second thing: (Re)-compiling libraries with different options.
Wouldn't it be better to calculate a hashsum based on all directives used to compile a library and add that hashsum to the name of the compiled library file? |
Third thing: Please, run dos2unix.
|
More: The Basic_Ssl sample does not compile when using clean source.
SMING_HOME does not have trailing slash. I am compiling it using the following commands:
|
Re. Basic_Ssl, I haven't added SSL support in for Host yet, I was intending to deal with that after this PR. |
Sming/Makefile-app.mk
Outdated
$(info ) | ||
$(info Fetching submodule '$(dir $@)' ...) | ||
$(Q) mkdir -p $(dir $@) | ||
$(Q) $(GIT) submodule update --init --force --recursive $(dir $@) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work when the application code is outside of the sming framework folder. One simple fix would be to replace the command above with:
$(Q) (cd $(SMING_HOME) && $(GIT) submodule update --init --force --recursive $(dir $@))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have changed the line to something different but it still does not work.
cd /path/to/Sming/Sming/Components/spiffs/spiffs/ && git submodule --quiet update --init --force --recursive .
error: pathspec '.' did not match any file(s) known to git.
Please, use the command line that I have suggested. Also update the travis test to copy one of the samples to a folder which is outside of the Sming worktree. This way we should be able to notice issues with the build mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I want to do here is support Component repositories which don't live in the Sming repo, hence not using cd $(SMING_HOME)
. I'm guessing it's the missing () subshell bit which fails, so does this work for you?
$(Q) (cd $(dir $@) && $(GIT) submodule --quiet update --init --force --recursive .)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I want to do here is support Component repositories which don't live in the Sming repo,
Ok, that makes sense. I would love to have that working. But at the moment you are already using $(SMING_HOME) in that code block and the block is SMING_HOME only.
$(info Fetching submodule '$(patsubst $(SMING_HOME)/%,%,$(dir $@))' ...)
$(Q) mkdir -p $(dir $@)
$(Q) cd $(dir $@) && $(GIT) submodule --quiet update --init --force --recursive .
Which means that line 1 also needs to be updated. So for me it seemed like that code block is SMING framework only. And does not include components which are outside of Sming.
so does this work for you?
No, that did not work either.
I was not able to compile it using the default settings. The "Host" architecture was not involved here. But it might be another small quirk on my system.
|
OK, just a few things to sort then! Thanks for taking a look slaff. |
We should provide also information how to migrate to the new modular system. |
@slaff I've cloned a fresh worktree to |
With the suggested change:
that problem is gone for me. |
@mikee47 I saw that you have added improvements to your |
Yep, just needs a little tidying. |
Overall the new build system looks quite promising and exciting. @mikee47 Thanks for your hard work. |
One issue I've encountered - but unable to pin down - is using high figures for parallel building. CI seems especially senstive to this, e.g. https://travis-ci.org/mikee47/Sming/jobs/547897873. Sticking to figures <= (cores + 1) seems fine though, so -j3 is the max. for CI. Cannot get it to break on Windows or Linux (VM) builds though... Error is invariably 'no such file or directory' error during generation of the dependency files (.c.d, .cpp.d), |
@slaff Thanks. Have you tried parallel building? In my Linux VM I now get Basic_Ssl to build in 26 seconds from a dist-clean. By comparison, Windows takes 1:46, and 36 seconds just to fetch and patch the submodules... yikes.
With the change to hashed library builds we're now telling the Component where to build it's library and what name to use, which should help. If you have a particular library in mind I could use that to work up an example? |
That would be great! You can get the source code of the JerryScript library from here: https://github.com/attachix/ukit-esp8266-firmware/tree/master/lib/jerryscript . And this is how I used to compile up to now: https://github.com/attachix/ukit-esp8266-firmware/blob/master/Makefile#L84 |
Yep, works quite nicely for me. I like this PR a lot. It's definitely an improvement in terms of compilation speed and modularity. People will have to get used to it at first but the advantages overcome any disadvantages. So for now at least for me there is one showstopper and that is the fetching of Sming Components. Either use the solution that I have proposed or make the code work also with components outside the Sming repo. |
One small suggestion for correction: For consistency with the other targets, please, rename the
|
I've renamed the targets as you suggest to something more meaningful, but needs a more thorough review. I'm keeping the list of outstanding issues (top of this PR) updated, some of them are just questions to consider. |
Yes, that sounds like a good idea. But I would prefer it to be part of a separate PR. This way we can focus on Services and remove some compile time directives related to CommandHandler that will not be needed any longer when the application can specify which optional components are required.
Maybe leave it for later. But I am open to suggestions.
Later.
The SSL stuff probably will need some refactoring if we want to allow other SSL libraries to be used (based on support per Architecture). So I would suggest to leave this for the moment and discuss it again when it is time for have SSL for Host architecture.
That should be done in this PR.
At the moment it looks good to me. So leave it as it is.
What do you suggest as a standard. What information should be included? Mandatory fields, optional ones? Is there plan to parse that information from other tools and generate human readable documentation?
That's fine. We can improve it later.
As a separate PR, please.
One was used for the flash upload speed and another one was used for the serial I/O speed. They might have got mixed in between. Have to double check BUT that is again task deserving a separate PR.
LWIP 2 and LWIP 1 have differences so we cannot make the headers compatible. We should make LWIP 1 - the open source version and the binary LWIP 1 compatible. Ideally we should support only one LWIP version. Preferably latest LWIP 2 version. But I am not sure if SmartConfig will work with LWIP 2.
Leave it as it is for this PR. Such a change will need better communication with the Sming users.
Maybe you can add an option to specify which section is requested. For example
can show only the configuration variables.
That can be part of this PR.
That can be part of this PR. |
Provided to complement the `terminal` target, but it would be more user-friendly perhaps if any required terminals/telnets launched automatically when the application is run.
@mikee47 The Windows Host build fails. That needs to be addressed. |
See #1724 (comment) above. If you re-run the appveyor test it'll probably succeed. This only happens very occasionally, Could try dropping to -j2 or back to -j1 if too unreliable. |
Yes, please. We would like to have a reliable build system :) |
@mikee47 Any last words before I merge this PR? |
… to prevent hanging
@slaff Just one minor fix, otherwise good to go. |
Ok, tell me when you are ready. |
Just pushed it. You'll see it's pretty trivial but quite important. |
Further to #1684 (comment) et. al. I'm opening this PR now so we can discuss details away from CMake. The main issues addressed by this PR are:
String
, etc.All of this should have no bearing on which build system is actually used (make / CMake).
Further details can be found in the
building.md
file which has been updated as part of this PR.New build system
out
directoryclib-
prefix for a simpler linker scriptApp
) library. Final linker stage and custom targets are still built by top-level makefile (nowproject.mk
)component.mk
fileARDUINO_LIBRARIES
variable incomponent.mk
. Note that sub-dependencies are handled automatically (via library'scomponent.mk
file andLibraries/components.mk
).Cache configuration variables
make
command line override project settings and will be remembered for next makemake changes
user-lib-clean
target tocomponents-clean
spiff_update
andspiff_clean
targets tospiffs-image-update
andspiffs-image-clean
COM_PORT_ESPTOOL
variable for use with Esp8266 flash targets (defaults toCOM_PORT
)COM_PORT_GDB
variable for use withmake gdb
(defaults toCOM_PORT
)SPIFF_BIN
as config input variable, but retainSPIFF_BIN_OUT
as resulting file pathlist-config
target to show current config variablesconfig-clean
target to wipe cached values and revert to project defaultslist-components
target to show details of Components (use V=1 for details)telnet
target to Host archUse absolute file paths with IMPORT_FSTR
PROJECT_DIR
andSMING_HOME
pre-processor definitions for code useHost UART emulation
Bugs fixed:
host_lwip_service()
unless initialisation succeededsamples and tests
Basic_Blink
andBasic_rboot
samples to detail available optionsARDUINO_LIBRARIES
definition where requiredIntegration testing