| Thread overview | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 15, 2014 Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
I'm currently attempting to package my D project (https://github.com/GreatEmerald/libarcomage/) as a shared library for openSUSE and whatnot, but I'm running into some policy problems. First, in order to build a shared library, it has to link against libphobos2.so. libphobos2.so is provided by the DMD package. Which means... The users of my library have to have DMD installed at runtime. Even though they don't intend to compile anything. Ideally, this problem would be solved by splitting libphobos2.so into its own package. After all, even the licenses of DMD and Phobos2 are different. This can be done downstream, but for instance for openSUSE, there's not much of a downstream to begin with. And this is needed for each distribution. While I'm at it, in the DMD RPM it's also set as Provides "libphobos2.so.0.66" instead of the expected "libphobos2.so.0.66()(64bit)" on openSUSE. I'm not too sure if this is distribution-specific or a standard practice, though. Second, what's the suggested method of providing includes? Put all the source of the library into includes? Make .di files? What about templates? Is there a suggested directory structure? | ||||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to GreatEmerald | Well, because of this reason, I completely left D and started writing my shared library in pure C. As much as I miss the syntax of D, I needed to do this (Where are you betterC? Are you there yet?). Since it is not a big library, that wouldn't be a big problem.
Anyway, I think instead of installing DMD to target OS just to get libphobos, I think you can just copy it from development OS. That should solve the problem. But make sure to name the library correctly. If my experience is accurate, it should be with the name libphobos2.so.0.66. If still doesn't work (tells that libphobos is not found), create a link to library with the name libphobos2.so as well.
About your problem solving part, the thing is that Phobos includes druntime inside it, and druntime is what makes most features of D tick like GC, arrays, etc. Also there are things like compile time regular expression, etc. Thus, neither leaving nor keeping the system in its current state is making everybody happy. I am still looking forward for "betterC" though. Which would allow me to write in D instead of C when I am not looking for D's libraries.
On Saturday, 15 November 2014 at 11:21:49 UTC, GreatEmerald wrote:
> I'm currently attempting to package my D project (https://github.com/GreatEmerald/libarcomage/) as a shared library for openSUSE and whatnot, but I'm running into some policy problems.
>
> First, in order to build a shared library, it has to link against libphobos2.so. libphobos2.so is provided by the DMD package. Which means... The users of my library have to have DMD installed at runtime. Even though they don't intend to compile anything.
>
> Ideally, this problem would be solved by splitting libphobos2.so into its own package. After all, even the licenses of DMD and Phobos2 are different. This can be done downstream, but for instance for openSUSE, there's not much of a downstream to begin with. And this is needed for each distribution.
>
> While I'm at it, in the DMD RPM it's also set as Provides "libphobos2.so.0.66" instead of the expected "libphobos2.so.0.66()(64bit)" on openSUSE. I'm not too sure if this is distribution-specific or a standard practice, though.
>
> Second, what's the suggested method of providing includes? Put all the source of the library into includes? Make .di files? What about templates? Is there a suggested directory structure?
| |||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to GreatEmerald | El 15/11/14 a les 12:21, GreatEmerald via Digitalmars-d ha escrit: > Ideally, this problem would be solved by splitting libphobos2.so into its own package. Since dmd v2.064.0, a shared phobos2 library package already exist for Debian based systems: <http://downloads.dlang.org/releases/2014/libphobos2-66_2.066.1-0_i386.deb> <http://downloads.dlang.org/releases/2014/libphobos2-66_2.066.1-0_amd64.deb> As every dmd release breaks libphobos2 API, these deb packages can be installed in diverse versions at same time. I.e. "libphobos2-65_2.065.0-0_amd64.deb" and "libphobos2-66_2.066.1-0_amd64.deb" can be installed together. This allow to have diverse dmd programs linked to diverse libphobos2 shared libraries at the same system. > Second, what's the suggested method of providing includes? Put all the source of the library into includes? Make .di files? What about templates? Is there a suggested directory structure? The default path for "d" and "di" sources should be "/usr/include/d/". DMD deb packages uses "/usr/include/dmd/" to avoid sources conflict with the ldc sources packaged for Debian. Regards, -- Jordi Sayol | |||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jordi Sayol | On Saturday, 15 November 2014 at 14:49:23 UTC, Jordi Sayol via Digitalmars-d wrote: > Since dmd v2.064.0, a shared phobos2 library package already exist for Debian based systems: > <http://downloads.dlang.org/releases/2014/libphobos2-66_2.066.1-0_i386.deb> > <http://downloads.dlang.org/releases/2014/libphobos2-66_2.066.1-0_amd64.deb> Nice. Now if only there were RPMs as well... If only as a template. > The default path for "d" and "di" sources should be "/usr/include/d/". Ah, thanks. | |||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to GreatEmerald | El 15/11/14 a les 18:29, GreatEmerald via Digitalmars-d ha escrit: > Nice. Now if only there were RPMs as well... If only as a template. Meanwhile there is not an RPM package for phobos 2 shared library, I think you can spread it together with your library: "/usr/lib/i386-linux-gnu/libphobos2.so.0.66.1" (for 32-bit) "/usr/lib/x86_64-linux-gnu/libphobos2.so.0.66.1" (for 64-bit) It has no sense to install ALL the dmd compiler tools into the final runtime computer. Regards, -- Jordi Sayol | |||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jordi Sayol | On Saturday, 15 November 2014 at 18:36:28 UTC, Jordi Sayol via Digitalmars-d wrote:
>
> Meanwhile there is not an RPM package for phobos 2 shared library, I think you can spread it together with your library:
> "/usr/lib/i386-linux-gnu/libphobos2.so.0.66.1" (for 32-bit)
> "/usr/lib/x86_64-linux-gnu/libphobos2.so.0.66.1" (for 64-bit)
That wouldn't really work well if I also want to use LuaD as a shared library, as both packages would then conflict with each other over providing libphobos2. Probably better to just depend on DMD for a while.
Though it does make me wonder, how do GDC and LDC handle this issue? Do they also include libphobos2 as part of the compiler?
| |||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to GreatEmerald Attachments:
| On 15 Nov 2014 21:05, "GreatEmerald via Digitalmars-d" < digitalmars-d@puremagic.com> wrote: > > On Saturday, 15 November 2014 at 18:36:28 UTC, Jordi Sayol via Digitalmars-d wrote: >> >> >> Meanwhile there is not an RPM package for phobos 2 shared library, I think you can spread it together with your library: >> "/usr/lib/i386-linux-gnu/libphobos2.so.0.66.1" (for 32-bit) >> "/usr/lib/x86_64-linux-gnu/libphobos2.so.0.66.1" (for 64-bit) > > > > That wouldn't really work well if I also want to use LuaD as a shared library, as both packages would then conflict with each other over providing libphobos2. Probably better to just depend on DMD for a while. > > Though it does make me wonder, how do GDC and LDC handle this issue? Do they also include libphobos2 as part of the compiler? It's a libgphobos-dev package for gdc. Iain. | |||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to GreatEmerald | On Saturday, 15 November 2014 at 21:01:49 UTC, GreatEmerald wrote:
> Though it does make me wonder, how do GDC and LDC handle this issue? Do they also include libphobos2 as part of the compiler?
That's something entirely up to the distro packagers to get right in the case of LDC. We don't directly offer .debs/.rpms or what have you as part of our binary releases.
That being said, for example on Arch Linux, Phobos and druntime are provided as separate packages (thanks, Dicebot!).
David
| |||
November 15, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | On Saturday, 15 November 2014 at 22:19:07 UTC, Iain Buclaw via Digitalmars-d wrote:
> It's a libgphobos-dev package for gdc.
Ah, so they repackage it as well. Same with LDC.
Not that it helps much, given that there's also no GDC on openSUSE. Oh well.
| |||
November 17, 2014 Re: Shared library packaging issues | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jordi Sayol | Am Sat, 15 Nov 2014 15:35:48 +0100 schrieb Jordi Sayol via Digitalmars-d <digitalmars-d@puremagic.com>: > El 15/11/14 a les 12:21, GreatEmerald via Digitalmars-d ha escrit: > > > Ideally, this problem would be solved by splitting libphobos2.so into its own package. > > Since dmd v2.064.0, a shared phobos2 library package already exist for Debian based systems: <http://downloads.dlang.org/releases/2014/libphobos2-66_2.066.1-0_i386.deb> <http://downloads.dlang.org/releases/2014/libphobos2-66_2.066.1-0_amd64.deb> > > As every dmd release breaks libphobos2 API, these deb packages can be installed in diverse versions at same time. > I.e. "libphobos2-65_2.065.0-0_amd64.deb" and "libphobos2-66_2.066.1-0_amd64.deb" can be installed together. This allow to have diverse dmd programs linked to diverse libphobos2 shared libraries at the same system. > > > Second, what's the suggested method of providing includes? Put all the source of the library into includes? Make .di files? What about templates? Is there a suggested directory structure? > > The default path for "d" and "di" sources should be "/usr/include/d/". > DMD deb packages uses "/usr/include/dmd/" to avoid sources conflict with the ldc sources packaged for Debian. > > Regards, Exactly a year ago I created a poll[1] about the include path and 65% voted for "dlang" over just "d". We should stick to "/usr/include/dlang" now for a consistent experience across distributions. Compilers' import paths are less of an issue as they are either built-in or configured in dmd.conf. But for build tools it would be nice if imports for library X could always be found in "/usr/include/dlang/X/". [1] http://forum.dlang.org/thread/20131112205019.12585bbd@marco-leise -- Marco | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply