Modernizing Apothecary #7562
Replies: 23 comments 41 replies
-
But I have a question: Why is both TravisCI and Github Actions used? Which is used for what? Based on the files I am seeing, Github Actions is used to build and upload the results, as well as show the badges. Then what is Travis used for? |
Beta Was this translation helpful? Give feedback.
-
Thanks @HerrNamenlos123 Your plan sounds good. I'd maybe even suggest we create a new repo This wouldn't be a clone of Might make issues/PRs etc better organized? If that makes sense happy for some name suggestions :) |
Beta Was this translation helpful? Give feedback.
-
Is there already a limit on what the supported compilers are? Regarding platforms I will try to get the following combinations to work:
32-bit support is dropped. All of these supported architecture combinations are supposed to be transferred into a visual table, that is then also valid for openFrameworks itself, so this is strictly what OF will support in the future. Did I miss something it should support? Or can more of these be dropped since they're out of date and nobody uses them? (I think especially MSYS, and tvOS are pain points) |
Beta Was this translation helpful? Give feedback.
-
Adding a link to the packages repo for anyone interested: |
Beta Was this translation helpful? Give feedback.
-
Oh wow this is exciting! @HerrNamenlos123 nice one!! Yes absolutely we need to move the scripts to CMake! As for the CMake Scripts: We are already one step ahead to assist this for other targets and platforms as already re-wrote a lot of apothecary dependencies compile targets to use CMake in the Android PR here: openframeworks/apothecary#231 For Windows the complexities are which target compiler version
Might be good idea both and let the user decide and for future just go 2022 For iOS and macOS, these libraries will need to be compiled into the new required format
Toolchain can be found here for mac/iOS/tvOS etc Apothecary updates have legit been a nightmare, if we can sort out a clear and concise system (via CMake) I'm all for it |
Beta Was this translation helpful? Give feedback.
-
Another idea: What do you think of providing CMake scripts optionally (the same ones that are used inside the docker container) which allow you to build all your dependencies and your application in one go? This could be implemented by packaging all cmake scripts in a package too, and OF then pulls this package and executes the scripts. There would be a lot of system packages to install (conveniently noted by the CMake errors anyways), but this would be the only way to really create bullet-proof applications. What do you think? |
Beta Was this translation helpful? Give feedback.
-
I am currently struggling to get MSVC binaries to work (Clang-CL finally works using CMake so I can build CMake libraries into an MSVC binary in a Linux container, the issue is that few of the dependencies we need even have CMake support, and I am currently stuck with OpenSSL. At this point I am re-thinking my re-thinking, thinking if we should even pre-build these libraries in the first place. I already tried to get rid of OpenSSL completely, but libcurl seems to need it. However, libcurl can be compiled statically such that it itself includes OpenSSL. Problem is it also has an arcaic build system. I mean we do need the binaries from somewhere, and one idea that came to my mind: Other package managers already provide all of these binaries, so it would only be smart to consider to re-use them. What would you think of the idea (provided that it is legally allowed) of more or less stealing the binaries from something like vcpkg or Conan? These could be used as a package manager to download the precompiled libraries like if we wanted to use them, but instead of using them we simply copy the files and upload to our repository. This would still keep OF independent of vcpkg or Conan from the user point of view. What do you think of the idea of doing so, and would you do it for all packages or just the MSVC versions, while all non-MSVC versions are compiled normally in our pipeline? |
Beta Was this translation helpful? Give feedback.
-
Been looking at trying to get iOS simulator and iOS Device builds as separate libs ( see: openframeworks/apothecary#208 ) working for Freetype and what should just be a few small tweaks has turned into a massive headache. I am starting to feel apothecary really needs to be radically changed. Anyway, I am all up for finding better solutions including a cmake only approach :) |
Beta Was this translation helpful? Give feedback.
-
So first, apple now requires a completely new format for libs which will
fix the issues caused by fat lib conflicts.
Re apothecary: Yeah it’s more there are just so many vast charges in time
since the last overhaul with dependencies changing so much over the years.
The android PR makes many of these changes with Cmake first move.
The issues arise with then complexities due to then, latest versions of
said dependencies required to make all platforms then work at the same
time, at the latest dependency versions that are one CMake compatible. This
includes VS
I’ve included the cmake tool chain build file for iOS and macOS in that
branch which is the key for the cross compiler in the same way used for
android (that is packaged with android tools).
Most dependency versions have been patched however to support cmake now
I do think it’s better to cut and dry into a new format
I think it’s best to base any iOS cmake changes to the be based on that
android pr as most of the cmake compatible work is done
…On Wed, 19 Jul 2023 at 7:18 am, Theodore Watson ***@***.***> wrote:
Been looking at trying to get iOS simulator and iOS Device builds as
separate libs ( see: openframeworks/apothecary#208
<openframeworks/apothecary#208> ) working for
Freetype and what should just be a few small tweaks has turned into a
massive headache.
I am starting to feel apothecary really needs to be radically changed.
It is such a mess and doesn't feel sustainable.
Anyway, I am all up for finding better solutions including a cmake only
approach :)
—
Reply to this email directly, view it on GitHub
<#7562 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGK2HEHD6HXHIQR5B6ZGCLXQ34SXANCNFSM6AAAAAAZPCZQWU>
.
You are receiving this because you commented.Message ID:
<openframeworks/openFrameworks/repo-discussions/7562/comments/6482617@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Currently I am looking into Conan and it truly is amazing, it has changed significantly since i last used it. They are going more and more into the direction that the project is completely unaware it is using Conan at all. That means, there are no more Conan functions used in CMake, there are only Previously Conan generated e.g. Where I am going with this: There have been significant upgrades to many systems, which is amazing, but it also means that OF's approaches need to change radically because they are currently upside-down in many aspects. We still have the project generator however. This means it could be advertised as the main way of using OF, while it would generate example source files, a CMake file, a Conan file, then invoke Conan, then CMake, and then open the IDE. This workflow would ideally be the exact same a professional developer would use, just automated. But now to my points, while ignoring the need for reversing the CMake/Conan/Dependency workflow, I am asking myself if it is even advisable to keep the project generator in the same repository as the OF library itself. What do I mean with that: In an ideal project setup you would choose a project location, have Now, when the project generator generates a project somewhere the user chooses, and then sets the project up so that it clones its own instance of OF, and does not simply copy source files (to keep it easy to update later), it does not make sense that the project generator is even residing between the OF source files. Also, as soon as a project is generated the project itself does not need project generator, that is unnecessary overhead. Also, as the project generator will later only invoke CMake and not do anything specific, it actually has no relation to OF at all. It will simply download stuff and run tools, thus it should be considered as just an external tool for OF, not an essential part of OF. From my current perspective it might be the wisest decision to put project generator into its own repository, and keeping the OF repository clean with JUST its own source files and nothing else. No Conan, no apothecary, no project generator, just OF. When downloading, the user will have two decisions, they can either download the git repository (or a source archive) and do whatever it takes to build it. Or they can download the project generator (which is from another repository but nicely provided), which then downloads the git repo or source files FOR the user, and also runs Conan and CMake: The exact same procedure someone would use to setup a project using the plain git repository. It is just automated. What are your thoughts, do you also see reasons to extract the project generator into its own repository? And what do you think of the Conan 2.0 approach to intercept |
Beta Was this translation helpful? Give feedback.
-
In case it's helpful for context, we've always designed OF to be self contained -- that you are encouraged to use relative paths in your projects (you don't have to, but it defaults to /apps) and that you can move the OF folder from computer to computer and your projects still work. This has been super helpful for making sure things break less, and while certain older version of OF become incompatible with modern IDEs and OSs, it's honestly been helpful to have projects live sort of relatively to the version of OF they are using. I will often have multiple versions of OF on my hard drive. That's not to say it has to work like that in the future, but it's been one of the designs of OF -- to avoid having to install system level libraries, to avoid separating OF projects from the library, etc. |
Beta Was this translation helpful? Give feedback.
-
(also, it may be good to keep this conversation specific to modernizing apothecary, vs discussing redesigning how OF works generally -- perhaps branching this conversation might make sense?) |
Beta Was this translation helpful? Give feedback.
-
Here's another wild idea - what if we switched to Homebrew ( for mac ) and vcpkg ( for windows ) for all our dependencies? I think all the main libs we use are available on both platforms ( assimp, glfw, opencv, etc ) And we could then essentially use a cleaned up apothecary with cmake for the remaining things we need to compile ( like emscripten / android etc ). It would mean a slightly longer initial setup, but it would take away a huge % of our current headaches and we're already doing something similar with Linux. |
Beta Was this translation helpful? Give feedback.
-
well well well... as a "comfortable" OF macOS+linux user, I don't see a problem with that (and for GitHub users, the download_libs step is already required on Mac too, and if you're tracking GitHub you 99.9% already have homebrew), but there will be friction for a "new user", or in a Mac (and I presume windows) workshop/lab context. requiring homebrew is not preposterous, but it's another level of technical awareness (need to use the command line, for instance). . there is something very valuable in step1: tell everyone in the room to download some OF release; and step2: pick an example in your desktop environment, hit play in Xcode, and it runs. getting traction in OF (C++) takes time, and at one point an active "decision" to invest energy must be made; until that moment happens in the user's head, everything must be kept as streamlined as possible. so I guess it comes back to "redesigning how OF works generally"... but in the interim, there is perhaps an evaluation of what is required from each library, and can those requirements be met more simply? this is where my question about libcurl leads to in #7656 with (a) if we can use the OS-provided lib, might as well (which I guess is more or less what happens in linux through the "OS-sanctioned" package manager); and if not: (b) if we can use a headers-only lib that gets compiled at project-time, might as well... |
Beta Was this translation helpful? Give feedback.
-
(also homebrew supports the "latest 3 OS versions" (the meaning of which sort of changed in the past few years). in any case I guess that's OK with general OF use in the sense that the "current version" of OF and C++ is probably going to work down about 3 versions too, but for LTS it will create a hole in dependencies once those 3 versions elapse as the support to get the libraries won't exist anymore). |
Beta Was this translation helpful? Give feedback.
-
First of all, I agree that solutions like homebrew and the linux package manager saves a lot of headache, what I am not so fond of is using vcpkg on Windows. I do not particularly like it and hardly know any people or systems using it, and making it a requirement for OF would mean everyone that wants to use OF must first install vcpkg, which is not really desirable. You can correct me on this, but from my perspective, vcpkg has been dying the past decade. But now that I am reading all of this, I am going even further back: How important is that an average OF user even has the source code of OF? I mean just as a theoretical thought, what if OF is built using system libs, but in GH Actions it is compiled into static libs for many architectures (like apothecary now), meaning an average OF user that is not a developer only downloads a prebuilt binary package that only has OF static libraries and those of its dependencies. It would move dependency issues from a non-knowing user to the CI pipeline. OF Developers can still build it locally by serving the dependencies. It would mean we have the freedom of packaging our dependencies how we want and how comfortable it is for the CI/CD pipeline, not how comfortable it is for an average user. Another thing, I did some reddit posts in the past to get some different perspectives. If the dependencies are only needed in CI, then I do not have an issue with vcpkg, I only have an issue with requiring vcpkg from an average user. Another idea was to "steal" packages from Conan or vcpkg and re-upload them in the apothecary, but that is also a very bad idea as it puts a barrier between the library maintainer and the OF user. This is from a security point of view, think of OpenSSL security patches. Realistically, OF dependencies will not be updated even every few years. But it would also be a bad idea in general. Downloading using one package manager and re-uploading as a zip file is a very weird take that goes directly against the idea of having the package manager in the first place. I think we should really be using a package manager like it is meant to be, and not abuse it and put an unnecessary piece of poorly maintained software inbetween. So as a recap, what about the idea of using system package managers (apt, homebrew and vcpkg), while also providing pre-built OF libraries that include JUST the static libraries of OF + dependencies, and their headers? |
Beta Was this translation helpful? Give feedback.
-
Recently I had some spare time and I took another look at CMake and Conan. I really think Conan is the way to go. This does not mean everyone needs to use Conan. I figured what we could do is create a Conan package called Additionally, I am still a fan of also providing a package with OF already prebuilt, which would then be another simple Conan package, where export the artifacts to a non-Conan package. Some libraries that are not part of Conan, are already built from source as part of OF. I removed ofAppGlutWindow because it is subject to be removed AFAIK. But what about FMOD? It also isn't part of Conan and it's not trivial to build. AFAIK it is also subject to be removed, so what's the state? I don't think I can simply comment it out... |
Beta Was this translation helpful? Give feedback.
-
as far as I understand, GLUT is about to be axed, and FMOD has been mostly de-required (there are #ifdefs to take it out), but it's hanging there perhaps for backward-compatibility. I don't think "current" projects should make use of it. so you can brute-force-remove it to validate the approach, and the "proper" final resolution of it's removal can be studied in parallel (perhaps an addon?) for the use of Conan I am in favour as long as the process for "end users" stays as simple as "install an IDE, download OF in a non-admin account, and compile some examples (without additional/external dependencies or 3rd party package managers)". I'm not sure from your proposal if you suggest an intermediary mode where the git-based installs (developers or bleeding edge users) would more or less supersede apothecary with "live" Conan dependencies in the dev workflow? or would that still rely on CI to assemble the required libraries? (I would not mind getting live libs, as I've had a couple of situations stemming from synchronisation between the OF tree and the libs (you tend to forget to download_libs now and then when working with the git source)). |
Beta Was this translation helpful? Give feedback.
-
Just to add in here that the new bleeding Cmake apothecary scripts allow the developer to easily build all dependencies themselves if needed... with a simple run of a bash script with not many system dependencies needed, however install system script included now. I think most developers just don't understand how to use, setup or install apothecary scripts in the past so making that easier is goal. Meaning in the past they would maybe try and run it, it would fail, they become confused and go down another rabbit hole. Lets fix that. If you want to compile a library say OpenCV with a different command than packaged... it should be easy so new system allow for that, not just whole packaged full source binaries you may find in some package managers which will increase app size etc. Downloading latest libraries makes this process a lot quicker as building them however and is preferred and easily accessible from git project If you want to build all dependencies for Android for all platforms, run the .sh from apothecary directory and it will build and deploy all binaries to the libraries of the project with secure hash. Problem with other package built systems is you don't really have control of the bloat or commands and many of the dependencies are custom patched to fix crashes, security problems or to support platforms not available from source. |
Beta Was this translation helpful? Give feedback.
-
A note about By the way, you can browse through all available packages on Conan at https://conan.io/center. Could someone please take a quick look at it and tell if it is possible to switch to another library? |
Beta Was this translation helpful? Give feedback.
-
re SVGtiny, there is no specific requirement but it's what's in the implementation of ofxSVG, which is a builtin addon. It is not a large class, so depending how nanosvg's |
Beta Was this translation helpful? Give feedback.
-
Okay as per the QBS discussion, people want to use CMake soon, but apothecary/packages is not yet ready to serve all packages in the new way. I think the current OF CMake should more or less work, but it is a huge mess due to inconsistencies and I don't want to ship it that way. Now, as a temporary fix, we could slightly modify the libs.zip and add a few CMake files into there, that are used to locate and import the binaries. That would significantly reduce complexity and I would be willing to release CMake support under these circumstances. Now, I am not familiar with the old apothecary: Is it feasible to achieve said thing and add a few CMake files into the libs archives, without breaking everything or a lot of manual work? |
Beta Was this translation helpful? Give feedback.
-
Great initiative! I'm doing something similar but using https://www.chalet-work.space for everything suggestions and PRs are welcome |
Beta Was this translation helpful? Give feedback.
-
Hi there!
I am planning in contributing significantly to modernize OF. I just contributed full CMake-support here: https://forum.openframeworks.cc/t/all-about-cmake/41777
I had many issues while implementing it because many parts of OF have grown significantly over the years that result in a lot of mess and spaghetti code. I love OF for the tremendous amount of features and for what it could be.
I think the apothecary is a central point of mess which could seriously be improved as stated by @ofTheo in the above discussion.
My plan would be to:
This would then allow me to use that for the CMake support, which makes everything a lot easier.
What do you think? Any issues with the plan above, or improvement suggestions?
Disclaimer:
I am not actively using OF currently and I have not been around for long, which is bad because I don't know all the use cases, but also good because I now see many many serious flaws that others simply oversee as they're used to it. I am only trying to help and make OF more modern so more people can approach it and make sure it always simply works (which it never has for me). If I am trying to do something wrong or trying to change something which would violate core ideas of OF, please tell me!
Beta Was this translation helpful? Give feedback.
All reactions