Anyone interested in using Conan (and Docker?) with the Propeller?
DavidZemon
Posts: 2,973
Since this forum has shown such active and enthusiastic responses to complex tools in the Parallax ecosystem, I thought I'd talk about two more: Conan and Docker. I recently started a new job and have begun using these two tools - and I like them a lot.
Conan https://www.conan.io/
Finally, a package manager for the C/C++ world that is build system agnostic. It's very new and the C/C++ world is extremely complex (there's a reason nothing like it has become hugely popular despite the languages being so old), so it isn't perfect. But... it's pretty darned cool. In short, a package maintainer writes "recipes" and compiles the package using that recipe for as many "profiles" (a profile might be Linux/x86_64 and another might be Windows/x86) as possible. The resulting binaries are uploaded to a (hopefully public) repository. When another user wants to use the package, Conan downloads the recipe for them and checks their "profile." If the end-user's profile matches a binary in the repo, then the binary is downloaded and used. If not, then the recipe contains all information necessary to download the package source code and re-compile for the user's profile, and Conan will automatically do just that.
Imagine if a new Propeller user could just install Conan and then let Conan download all necessary tools: PropGCC, Simple Libraries, PropWare (see what I did there? "necessary" tools ), PropLoader, etc. From there, they'd just have to write their code and run! How cool!
My experience with Conan is with Linux only and x86_64 and ARM. Conan works well in Windows (so I've read, and expect to be true since it is Python) and, if I can get cross-compiling well for ARM, it should work just fine for the Propeller too.
So, the result is a lot of extra complexity for anyone that understands how all of it works together, but the user should see significantly less complexity because Conan will just take care of it all.
Docker https://www.docker.com/
Another tool that is massively more complex than anyone on these forums has asked for. There are a number of ways this could be leveraged for our community:
1) Alternative to Conan: Ship a Docker image with PropGCC, Simple Libraries, PropLoader (is this even useful in a Docker image??? I have no idea...), PropWare, etc. All a user has to do is pull the Docker image and they're off to the races!
2) Combine with Conan: Ship a Docker image that has Conan pre-installed along with the Propeller profile. Use Conan as described above, but without the worry of installing Conan or maintaining the profile. I don't know that this adds much value... either way you have to install one of the tools (assuming the user doesn't already have one of them) and Docker is certainly more complex (and larger) than Conan.
3) Purely for the sake of creating artifacts for end-users to download. I've already started this: my build server (http://david.zemon.name:8111?guest=1) has switched to Docker for cross-compiling OpenSpin and Spin2cpp for the Raspberry Pi and I plan to make the necessary configuration changes soon so that PropGCC for RPi is also built via Docker. Going down this route has the added benefit of being able provide to any Propeller user well-tested Docker images for compiling PropGCC from source! No more lengthy instructions explaining what to do with texinfo and how to download the ARM cross-compiler; just run "docker run --rm -v `pwd`:/opt/project -w /opt/project dockcross/linux-armv6 make -j9999" and pretty soon you'll have a copy of PropGCC!
I'm willing to put the work in for any of this that folks are interested in - I don't think it will be too hard. Just let me know if any of this sounds intriguing.
Update
Docker image in the works: https://hub.docker.com/r/davidzemon/propworld. Has full suite of Propeller tools but lacks any instructions or helper scripts for using them.
Conan https://www.conan.io/
Finally, a package manager for the C/C++ world that is build system agnostic. It's very new and the C/C++ world is extremely complex (there's a reason nothing like it has become hugely popular despite the languages being so old), so it isn't perfect. But... it's pretty darned cool. In short, a package maintainer writes "recipes" and compiles the package using that recipe for as many "profiles" (a profile might be Linux/x86_64 and another might be Windows/x86) as possible. The resulting binaries are uploaded to a (hopefully public) repository. When another user wants to use the package, Conan downloads the recipe for them and checks their "profile." If the end-user's profile matches a binary in the repo, then the binary is downloaded and used. If not, then the recipe contains all information necessary to download the package source code and re-compile for the user's profile, and Conan will automatically do just that.
Imagine if a new Propeller user could just install Conan and then let Conan download all necessary tools: PropGCC, Simple Libraries, PropWare (see what I did there? "necessary" tools ), PropLoader, etc. From there, they'd just have to write their code and run! How cool!
My experience with Conan is with Linux only and x86_64 and ARM. Conan works well in Windows (so I've read, and expect to be true since it is Python) and, if I can get cross-compiling well for ARM, it should work just fine for the Propeller too.
So, the result is a lot of extra complexity for anyone that understands how all of it works together, but the user should see significantly less complexity because Conan will just take care of it all.
Docker https://www.docker.com/
Another tool that is massively more complex than anyone on these forums has asked for. There are a number of ways this could be leveraged for our community:
1) Alternative to Conan: Ship a Docker image with PropGCC, Simple Libraries, PropLoader (is this even useful in a Docker image??? I have no idea...), PropWare, etc. All a user has to do is pull the Docker image and they're off to the races!
2) Combine with Conan: Ship a Docker image that has Conan pre-installed along with the Propeller profile. Use Conan as described above, but without the worry of installing Conan or maintaining the profile. I don't know that this adds much value... either way you have to install one of the tools (assuming the user doesn't already have one of them) and Docker is certainly more complex (and larger) than Conan.
3) Purely for the sake of creating artifacts for end-users to download. I've already started this: my build server (http://david.zemon.name:8111?guest=1) has switched to Docker for cross-compiling OpenSpin and Spin2cpp for the Raspberry Pi and I plan to make the necessary configuration changes soon so that PropGCC for RPi is also built via Docker. Going down this route has the added benefit of being able provide to any Propeller user well-tested Docker images for compiling PropGCC from source! No more lengthy instructions explaining what to do with texinfo and how to download the ARM cross-compiler; just run "docker run --rm -v `pwd`:/opt/project -w /opt/project dockcross/linux-armv6 make -j9999" and pretty soon you'll have a copy of PropGCC!
I'm willing to put the work in for any of this that folks are interested in - I don't think it will be too hard. Just let me know if any of this sounds intriguing.
Update
Docker image in the works: https://hub.docker.com/r/davidzemon/propworld. Has full suite of Propeller tools but lacks any instructions or helper scripts for using them.
Comments
Mike R...
like you I used TeamCity for automated builds, but mostly for the duplicate runner and stuff like automated testing. Over the years I stopped using it because of changing infrastructure at work and stricter deployment rules.
Most Windows users like downloadable binaries and I guess for schools/education having a certain revision on all computers, easy to install (and reinstall) complete, might be a godsend thing.
But if you could provide a complete image where PropGCC and all the other stuff compiles without days of hair pulling even windows user could get used to do it.
Recently there where some posts about compiling PropGCC and not current versions used on Parallax side, a common Docker Image with not just PropGCC + libraries + PropWare, but all of the P1 and hopefully P2 stuff would be perfect.
Currently a new user has to search for all the goodies, just finding out by reading the forum that spin2gcc exists, or PropellerIDE, or PropWare...
Hard Disk space and download volume is not really a problem so building one Development Docker would be a wonderful idea.
Lets make a list,
GCC - added
cmake - added
PropGCC
SimpleIDE
PropellerIDE
PropLoader
PropWare
spin2cpp
spinsim
Gears?
OpenSpin
PropTool
BST?
whatever BLOCKLY could use local
most of it should be available on GIT somewhere.
That is not too bad to put in one Docker.
So yes I do find this intriguing.
Did not know about conan, will look at it now...
Enjoy!
Mike
But I looked at conan between this posts, and that is a really nice find, thanks David.
The server side is more Linux centric, but the client side seems to work fine with windows, even supporting MSYS, Mingw, and Visual Studio to build with.
Its build around GIT and can supply binaries when a build is not possible (aka PropTool), at my first glance this is very interesting. Even for my work. I need to test this.
It's MIT license.
Thanks again,
Mike
For a couple years now I've been looking for a C/C++ package manager. Having worked with Java (Maven) and JavaScript (NPM) at my first job and already being familiar with Python's pip, I just couldn't believe that no one had a (good) solution for C/C++ yet! But finally, Conan is here to try and rectify that. There have been other attempts in the past that fell through (biicode made an attempt https://github.com/biicode), and others that are thriving but require specific build systems (buckaroo https://buckaroo.readthedocs.io/en/latest/, gradle https://docs.gradle.org/current/userguide/native_software.html)... but it will likely take decades for an opinionated package manager to dominate in the C/C++ ecosystem due to the momentum of Make, CMake, AutoTools, etc. About a year ago I actually created a Maven plugin for my old company that was a wrapper around CMake. It was pretty cool! It used all of Maven's dependency management/resolution to download binary artifacts and then handed the build off to CMake. It relied on your project using CPack to create the artifact for Maven, but then Maven would come back into the picture and push that artifact up to your standard Maven repository such as Nexus or Artifactory. I was very happy with it . But now we (the C/C++ community, not my old company... poor them :P ) have Conan, and I like it much more.
Feel free to PM me any Conan questions. I've been working with it extensively over the last few weeks, trying to get a demo ready, so I'm pretty darned familiar with it at this point.
Q: Python 2.7 or Python 3.0? conan said 32 not 64 bit on windows. Any preference for 2.7 or 3.0?
Mike
ALSO! Check this out:
Now that is cool!
Mike
Well's terrible. Does Docker run in WSL? I've heard that Docker is actually Linux only, and that the Windows installer is actually just a Linux virtual machine with Docker already installed. So perhaps Docker also works from WSL?
I will continue making some updates to decrease the image size and increase the usability, such as writing a wrapper script to invoke it with some appropriate flags.
Have WSL installed one on of the W10 machines, but, but, but I do have no clue at all about Linux. Nada, Zilch.
JCL? no problem, Bash, hmmm....
I just installed that WSL to get GnuCOBOL running, not yet successful.
But GCC works and everything compiles, make. make install, .,.. all fine, it just starts still GnuCOBOL V.1.x instead of V2.x I tried to install.
My Linu Fu is very small...
Mike
Reboot
Then try to run the command I did above.
Looked up Docker and WSL, no go there for W10 Home.
Needs a windows Docker version to connect as client, WSL Ubuntu can not run docker directly
But conan works, I guess.
give me some test for this. say your OpenSpin compiled with Visual Studio Generateor and not cmake.
or something else....
[edit] installing cmake, but cmake does not like VS2017?]
Mike
On to Conan. Now this one is truly command-line only. (Obviously you can edit your files in your own editor, but we won't be packaging SimpleIDE in Conan.)
First step is get PropGCC built as a Conan package so that other packages can depend on it. Annndd already we're running into a problem: PropGCC doesn't compile on super new versions of GCC. Back to Docker! Now I get to build a Docker image, probably Ubuntu 16.04, that has an older version of GCC so that I can compile PropGCC! Woo hoo!