10 ms·
Very neat. Would like to see more languages targeting single binaries. This is one reason (I believe) that has made Go so popular.
by w8rbt 8y ago
Very neat. Would like to see more languages targeting single binaries. This is one reason (I believe) that has made Go so popular.
- jpic 8y agoI wish <my favorite language> also had this. However, containers work. Not sure why they do java though, i thought java has been happy with jars so far.
- regecks 8y agoIf anybody is thinking about Java, check Graal out. I was able to successfully create fast, completely static ELF binaries of real JVM applications from fat JARs (not in the fake self-executable archive way). It's still early days in terms of what's available in the runtime (e.g. the AWT subsystem is missing), but it's pretty damn impressive anyway.
- cjfont 8y agoJARs are okay, but they still require you to have the java runtime installed in order for them to execute.
- pjmlp 8y agoYou can bundle everything together, or use a commercial JDK with AOT compilation support.
- weberc2 8y agoWe're struggling using containers for our Python and Javascript applications. I think we're using venvs and node_modules and we oughtn't (or we shouldn't keep them in our project directory where they sometimes--but not always--get overwritten by source code volume mounts).
- dharmab 8y agoFor Python, this works well for my team: https://www.dharmab.com/programming/python/docker/2017/07/24/isolated-python.html https://www.dharmab.com/programming/python/docker/2017/07/24...
- weberc2 8y agoSorry if I'm a little dense; that doesn't seem like it solves any problems. It just says "use virtualenv and/or docker". I guess I was hoping for "how to manage dependencies in a localdev-friendly way for a Python/Docker app" or something.
- dec0dedab0de 8y agoHave you tried pipenv? It creates a lock file that hashes all your dependencies so it makes sure you get the right one when you deploy.. And it automatically creates the virtualenv if its nog there when you install them.
- weberc2 8y agoWe do use pipenv. I like the idea of it, but I think we ran into issues with where the pipenv lives. We used to use `--system`, but that seemed buggy and/or idiosyncratic, so we started using a venv and then we started using PIPENV_VENV_IN_PROJECT=true (for some reason) and now it's causing other issues. It seems unclear how it's supposed to be used with Docker containers, but maybe we're just overcomplicating things?
- dsnuh 8y agoI'm not sure if I understand correctly. Are you saying that you run venv commands as part of the build step for your containers (i.e. a RUN line in you Dockerfile) and then pip installing modules in another build step?
- weberc2 8y agoNo, we use pipenv instead of pip, and pipenv manages a venv. There are `--system` flags, but I guess support for installing things to the system is a little buggy or idiosyncratic or something so we use the venv behavior. I'm not sure why we tell pipenv to install the venv in the project directory though. We do the pipenv install as a RUN line in our Dockerfile. Does this answer your question?
- meddlepal 8y agoJARs are fine until you need to get someone to install a JRE. Not a problem for server apps, but definitely not painless for client distributed apps.
- munk-a 8y agoIt is nice to have the option to go with either path. I think it's a bit less relevant in the modern development world but it can also be nice to leverage dynamic linking to present several executable entry points that share a large pool of common logic between them.
- rkeene2 8y agoTcl is still the king of this kind of distribution with Starkits/Starpacks. Since you can virtualize the filesystem within Tcl, you can pack in all your resources as regular files and generally scripts will work without knowing that this has happened (and without hacky extracting of the archive to disk before running, or while running).
- dev_dull 8y agoThis is an awesome design concept and I'm surprised other languages aren't copying it.
- rkeene2 8y agoIt generally takes other languages a long time to become more like Tcl ;-)
- paavoova 8y agoPython can do something similar albeit far simpler via packaging as an executable zipfile. Just structure everything you need in a directory and zip up with __main__.py in the root. All resources are available as an in-memory binary stream, including individual source .py files. Of course if you want to package something like a C library, you need to unpack that to disk to be able to access it with ctypes.
- creatornator 8y agoAre you referring to the zipapp library? I had no idea this even existed until now but that seems pretty clever. Huh. Why can't it also dynamically unzip a shared object library?
- arendtio 8y agoBy the way, if you are looking for a tool to embed resource files in Go binaries you might find these interesting: - https://github.com/benbjohnson/genesis https://github.com/benbjohnson/genesis - https://github.com/go-bindata/go-bindata https://github.com/go-bindata/go-bindata
- artursapek 8y agoWe use go-bindata a lot - love that package
- abright 8y agoI've not used those two but have always had success with - https://github.com/gobuffalo/packr https://github.com/gobuffalo/packr I like that it allows you to `go run` without changing any code.
- ASalazarMX 8y agoI'm ambivalent about this. It is cool to distribute a single binary, but years ago there was serious vulnerability in a very common open source library library whose name escapes me (it wasn't libgcc, someone help a brother here). It was used in multiple programs in both Windows and Linux. On Windows there was a rush of individual updates as each application was fixed... on Linux, simply upgrading that library fixed all applications. I'd rather be in the latter than the former situation when the next vulnerability happens.
- TimTheTinker 8y agoI think this represents a fundamental (and rather annoying) difference between Linux and Windows. On Windows, the only platform-supported global library format is COM, and that requires a very specific programming style--HRESULTs and all the rest. True, registered COM DLLs can be linked to without separate header/symbol files, and installing new programs/libraries never requires local compilation, but the extra overhead of COM itself, and the fact that it's a walled garden code-wise, makes it rather unpopular. It's also nigh on impossible to port COM code to other apps without resorting to something like WINE (which can't compete performance-wise when running highly parallel COM apps/services). Not to mention how ugly C++ COM source files are. It would be so nice for us all if Windows shipped with compilers, straight-up C libraries with headers, a package manager, a better shell, ...
- TimJYoung 8y agoWindows has C-style, shared libraries just like Linux - DLLs. The entire Win32 API that is the backbone of Windows is implemented in system DLLs. Every compiler that produces native binaries for Windows links with these DLLs (C, C++, Go, FreePascal/Delphi, etc.), either statically or dynamically, using C calling conventions. COM is the Component Object Model, which is implemented in DLLs, but is something different: https://en.wikipedia.org/wiki/Component_Object_Model https://en.wikipedia.org/wiki/Component_Object_Model COM, or some form of it, is used heavily with .NET and the new UWP runtime, but those are newer runtimes that sort of sit on top of the Win32 API (to some extent, UWP is actually integrated into the OS itself, but, AFAIK, still uses the underlying Win32 APIs).
- dinglejungle 8y agoHere's one for Lua: https://github.com/ers35/luastatic https://github.com/ers35/luastatic
- dom96 8y agoI always wonder to what extent this is true for Go. How does it handle depending on C libraries?