digitalmars.D - dub can build library for dependencies
- zoujiaqing (5/5) Jul 30 2020 I want to rely on a library, but I don't want to compile it on my
- Andre Pany (9/14) Jul 30 2020 Python solves this with the many-linux libraries. The dub package
- zoujiaqing (4/21) Jul 30 2020 Andre, Thanks for the response.
- zoujiaqing (2/2) Jul 30 2020 Java can use gradle manager depends on compiled *.jar to Maven
- Andre Pany (20/22) Jul 30 2020 In dub the same thing is already possible like it is done for
- Guillaume Piolat (7/9) Jul 30 2020 What you may do is commit the .lib/.a and add them to the source
- Steven Schveighoffer (7/9) Jul 30 2020 No it cannot.
- zoujiaqing (4/13) Jul 31 2020 Thanks Steve! But about libphobos?
- Steven Schveighoffer (16/33) Aug 03 2020 If you compile against phobos with different versions than what it was
- Petar Kirov [ZombineDev] (13/18) Jul 30 2020 I think the best way to address this problem is via something
I want to rely on a library, but I don't want to compile it on my computer. I hope dub can help us with this function. Just as I rely on a docker mirror, this docker mirror is not built on my computer. This will increase my compilation time. Thanks.
Jul 30 2020
On Thursday, 30 July 2020 at 12:04:18 UTC, zoujiaqing wrote:I want to rely on a library, but I don't want to compile it on my computer. I hope dub can help us with this function. Just as I rely on a docker mirror, this docker mirror is not built on my computer. This will increase my compilation time. Thanks.Python solves this with the many-linux libraries. The dub package author has to package the libraries and all the dependencies + d header files. The libraries needs to be build to be runnable on many linux systems (+ libraries for windows, + libraries for osx). As far as I see, from dub side everything is there, just the dub package author needs to provide a complete dub package. Kind regards Andre
Jul 30 2020
On Thursday, 30 July 2020 at 12:23:29 UTC, Andre Pany wrote:On Thursday, 30 July 2020 at 12:04:18 UTC, zoujiaqing wrote:Andre, Thanks for the response. dub services should support corresponding support. Compile if some platforms are not supported. similar brew on macOS.I want to rely on a library, but I don't want to compile it on my computer. I hope dub can help us with this function. Just as I rely on a docker mirror, this docker mirror is not built on my computer. This will increase my compilation time. Thanks.Python solves this with the many-linux libraries. The dub package author has to package the libraries and all the dependencies + d header files. The libraries needs to be build to be runnable on many linux systems (+ libraries for windows, + libraries for osx). As far as I see, from dub side everything is there, just the dub package author needs to provide a complete dub package. Kind regards Andre
Jul 30 2020
Java can use gradle manager depends on compiled *.jar to Maven server.
Jul 30 2020
On Thursday, 30 July 2020 at 18:50:54 UTC, zoujiaqing wrote:Java can use gradle manager depends on compiled *.jar to Maven server.In dub the same thing is already possible like it is done for Python Wheels or Node packages. Have a look at this python wheel: https://files.pythonhosted.org/packages/5e/89/fa556c4f9ac56d466e229dceaa5cbc3993308c5c9574f739964f853415bb/FMPy-0.2.21-py2.py3-none-any.whl Rename the extension to zip and extract it. It contains the *.so files for linux / *.dylib for macos / *.dll for windows. The python code makes use of the functionality using wrapper code. You could just create a new dub package, copy the *.so/*.dll/*.dylib files into it, write the wrapper code in D and upload it to dub registry. This is almost your scenario except the dynamic libraries are written in C and in your case in D. (Java is a different thing, as the jar files contains byte code...) Kind regards André
Jul 30 2020
On Thursday, 30 July 2020 at 18:50:54 UTC, zoujiaqing wrote:Java can use gradle manager depends on compiled *.jar to Maven server.What you may do is commit the .lib/.a and add them to the source files. Example here: https://github.com/Devisualization/window/blob/master/dub.json#L39 Or you can find out why dub recompiles your stuff. --combined breaks caching
Jul 30 2020
On 7/30/20 8:04 AM, zoujiaqing wrote:I want to rely on a library, but I don't want to compile it on my computer. I hope dub can help us with this function.No it cannot. Every build of a library for a project has a unique set of version definitions (e.g. has_vibe_d) So a library built for your project may possibly be different than one built for another project. -Steve
Jul 30 2020
On Friday, 31 July 2020 at 03:09:03 UTC, Steven Schveighoffer wrote:On 7/30/20 8:04 AM, zoujiaqing wrote:Thanks Steve! But about libphobos? I can't compile phobos library! easy! fast!I want to rely on a library, but I don't want to compile it on my computer. I hope dub can help us with this function.No it cannot. Every build of a library for a project has a unique set of version definitions (e.g. has_vibe_d) So a library built for your project may possibly be different than one built for another project. -Steve
Jul 31 2020
On 7/31/20 2:07 PM, zoujiaqing wrote:On Friday, 31 July 2020 at 03:09:03 UTC, Steven Schveighoffer wrote:If you compile against phobos with different versions than what it was compiled with, then you will have potential problems. But Phobos also isn't meant to have dependencies on vibe or the like. An example: https://github.com/mysql-d/mysql-native/blob/master/source/mysql/connection.d#L446-L471 If you have a pre-compiled mysql-native app without vibe-core support (i.e. wasn't compiled with vibe-core also as a dependency), but then you compile an app and include vibe-core, your app will build, run, and promptly crash. So yes, technically, you can have a library that has no other dependencies (because you know it doesn't), and one could compile it once and use it wherever. But dub cannot be the one that decides how to do this. You have to do it manually. -SteveOn 7/30/20 8:04 AM, zoujiaqing wrote:Thanks Steve! But about libphobos? I can't compile phobos library! easy! fast!I want to rely on a library, but I don't want to compile it on my computer. I hope dub can help us with this function.No it cannot. Every build of a library for a project has a unique set of version definitions (e.g. has_vibe_d) So a library built for your project may possibly be different than one built for another project.
Aug 03 2020
On Thursday, 30 July 2020 at 12:04:18 UTC, zoujiaqing wrote:I want to rely on a library, but I don't want to compile it on my computer. I hope dub can help us with this function. Just as I rely on a docker mirror, this docker mirror is not built on my computer. This will increase my compilation time. Thanks.I think the best way to address this problem is via something along the lines of https://cachix.org/. The idea is that you create a Nix package (which declaratively describes the complete dependency graph of the thing you want to build) and then the first time the package is built it would be placed in a shared cache, which can be securely access by other developers. I am a Nix user and I haven't tried cachix yet, but from what I've seen many people use it successfully speed up both their local and CI builds. I think the Dub registry should host cachix-like server. The first step in this direction would be to add the nix store as an alternative registry provider to dub.
Jul 30 2020