March 06, 2018
On Monday, 5 March 2018 at 17:58:25 UTC, Joakim wrote:
> On Monday, 5 March 2018 at 14:34:44 UTC, aberba wrote:
>> On Sunday, 25 February 2018 at 22:12:38 UTC, Joakim wrote:
>>> On Sunday, 25 February 2018 at 16:51:09 UTC, yawniek wrote:
>>>> [...]
>>>
>>> I don't know, presumably you're referring to the static linking support Jacob mentioned earlier in this thread.  I have not tried that.
>>>
>>> On Sunday, 25 February 2018 at 17:48:34 UTC, aberba wrote:
>>>> [...]
>>>
>>> OK, I will look at releasing a native ldc binary for Alpine with the upcoming 1.8 release.
>>
>> LDC 1.8 is out!
>
> The Alpine build is up, let me know if you have any problems.  Note the changelog entry that says you'll need to install llvm and maybe other packages from the Alpine package manager first.

Nice. I usually use the docker images though.
March 08, 2018
On Monday, 5 March 2018 at 17:58:25 UTC, Joakim wrote:
> On Monday, 5 March 2018 at 14:34:44 UTC, aberba wrote:
>> [snip]
>
> The Alpine build is up, let me know if you have any problems.  Note the changelog entry that says you'll need to install llvm and maybe other packages from the Alpine package manager first.

I took a shot at dockerizing dub-registry with the alpine build using multistage builds.  I got ldc installed and dub built.  Unfortunately when I tried to build dub-registry, I found that vibe-d's vibe-core, libevent, and libasync configurations can't run under musl due to some of the networking dependencies in druntime core, e.g. `core.sys.linux.netinet.in_`.

I realize that's something that you can't really prevent as the packager, but it's still relevant to the status of D for microservices.

Bad news: not being able to build vibe.d is a pretty big hit for this objective.
Good news: there are other libraries we can try and we know how to fix this problem.
March 08, 2018
On Thursday, 8 March 2018 at 06:49:07 UTC, Andrew Benton wrote:
> On Monday, 5 March 2018 at 17:58:25 UTC, Joakim wrote:
>> [...]
>
> I took a shot at dockerizing dub-registry with the alpine build using multistage builds.  I got ldc installed and dub built.  Unfortunately when I tried to build dub-registry, I found that vibe-d's vibe-core, libevent, and libasync configurations can't run under musl due to some of the networking dependencies in druntime core, e.g. `core.sys.linux.netinet.in_`.
>
> I realize that's something that you can't really prevent as the packager, but it's still relevant to the status of D for microservices.
>
> Bad news: not being able to build vibe.d is a pretty big hit for this objective.
> Good news: there are other libraries we can try and we know how to fix this problem.

This guys says that vide.d works https://forum.dlang.org/thread/gikoeutmdyvolfshpqqq@forum.dlang.org
March 08, 2018
On Thursday, 8 March 2018 at 07:20:53 UTC, Radu wrote:

> This guys says that vide.d works https://forum.dlang.org/thread/gikoeutmdyvolfshpqqq@forum.dlang.org

Yes, it's pretty straightforward:

1. Build on Ubuntu, or some other dist
2. Statically link the whole binary with LDC, then you don't need to use Musl
3. Run it on Alpine

--
/Jacob Carlborg
March 08, 2018
On Thursday, 8 March 2018 at 06:49:07 UTC, Andrew Benton wrote:
> On Monday, 5 March 2018 at 17:58:25 UTC, Joakim wrote:
>> [...]
>
> I took a shot at dockerizing dub-registry with the alpine build using multistage builds.  I got ldc installed and dub built.  Unfortunately when I tried to build dub-registry, I found that vibe-d's vibe-core, libevent, and libasync configurations can't run under musl due to some of the networking dependencies in druntime core, e.g. `core.sys.linux.netinet.in_`.
>
> I realize that's something that you can't really prevent as the packager, but it's still relevant to the status of D for microservices.
>
> Bad news: not being able to build vibe.d is a pretty big hit for this objective.
> Good news: there are other libraries we can try and we know how to fix this problem.

What is the exact error? Maybe report it here:

https://github.com/lindt/docker-dmd/issues/1
March 08, 2018
On Thursday, 8 March 2018 at 07:20:53 UTC, Radu wrote:
> On Thursday, 8 March 2018 at 06:49:07 UTC, Andrew Benton wrote:
>> On Monday, 5 March 2018 at 17:58:25 UTC, Joakim wrote:
>> [snip]
>
> This guys says that vide.d works https://forum.dlang.org/thread/gikoeutmdyvolfshpqqq@forum.dlang.org

Unfortunately the link that's associated with is based on an ubuntu build which should be using glibc, not alpine w/ musl.
March 08, 2018
On Thursday, 8 March 2018 at 08:07:23 UTC, Joakim wrote:
> On Thursday, 8 March 2018 at 06:49:07 UTC, Andrew Benton wrote:
>> On Monday, 5 March 2018 at 17:58:25 UTC, Joakim wrote:
>> [snip]
>
> What is the exact error? Maybe report it here:
>
> https://github.com/lindt/docker-dmd/issues/1

I built out LDC on Alpine using the v1.8.0 LDC release.  It's available now through Docker Hub and Github.

Docker: https://hub.docker.com/r/andrewbenton/alpine-ldc/
Github: https://github.com/andrewbenton/alpine-ldc/

I get errors like below when trying to compile dub-registry:

>/root/.dub/packages/eventcore-0.8.28/eventcore/source/eventcore/drivers/posix/dns.d(11,9): Error: module core.sys.posix.netdb import 'AI_ADDRCONFIG' not found
>/root/.dub/packages/eventcore-0.8.28/eventcore/source/eventcore/drivers/posix/dns.d(11,9): Error: module core.sys.posix.netdb import 'AI_V4MAPPED' not found
>/root/.dub/packages/eventcore-0.8.28/eventcore/source/eventcore/drivers/posix/sockets.d(13,9): Error: module core.sys.posix.netdb import 'AI_ADDRCONFIG' not found
>/root/.dub/packages/eventcore-0.8.28/eventcore/source/eventcore/drivers/posix/sockets.d(13,9): Error: module core.sys.posix.netdb import 'AI_V4MAPPED' not found
>/root/.dub/packages/eventcore-0.8.28/eventcore/source/eventcore/drivers/posix/sockets.d(47,10): Error: module core.sys.linux.netinet.in_ import 'IP_ADD_MEMBERSHIP' not found
>/root/.dub/packages/eventcore-0.8.28/eventcore/source/eventcore/drivers/posix/sockets.d(47,10): Error: module core.sys.linux.netinet.in_ import 'IP_MULTICAST_LOOP' not found, did you mean enum member 'IPV6_MULTICAST_LOOP'?
>ldc2 failed with exit code 1.
March 08, 2018
On Thursday, 8 March 2018 at 07:54:29 UTC, Jacob Carlborg wrote:
> On Thursday, 8 March 2018 at 07:20:53 UTC, Radu wrote:
>
>> This guys says that vide.d works https://forum.dlang.org/thread/gikoeutmdyvolfshpqqq@forum.dlang.org
>
> Yes, it's pretty straightforward:
>
> 1. Build on Ubuntu, or some other dist
> 2. Statically link the whole binary with LDC, then you don't need to use Musl
> 3. Run it on Alpine
>
> --
> /Jacob Carlborg

Looks like that works out much nicer than using alpine as the first stage right now.  I'm not sure anyone will be too upset about the extra 7MB.
March 08, 2018
On Thursday, 8 March 2018 at 09:28:02 UTC, Andrew Benton wrote:
> On Thursday, 8 March 2018 at 08:07:23 UTC, Joakim wrote:
>> [...]
>
> I built out LDC on Alpine using the v1.8.0 LDC release.  It's available now through Docker Hub and Github.
>
> Docker: https://hub.docker.com/r/andrewbenton/alpine-ldc/
> Github: https://github.com/andrewbenton/alpine-ldc/
>
> I get errors like below when trying to compile dub-registry:
>
>>[...]

OK you found an issue :). Indeed the file only covered Glibc so that's why vibe.d didn't compile for Musl. I fixed the issue for uClibc (1) and it works now (builds and runs).

Probably the fix for Musl is similar.

1. https://github.com/dlang/druntime/pull/2134
March 08, 2018
On Thursday, 8 March 2018 at 09:35:08 UTC, Andrew Benton wrote:
> On Thursday, 8 March 2018 at 07:54:29 UTC, Jacob Carlborg wrote:
>> On Thursday, 8 March 2018 at 07:20:53 UTC, Radu wrote:
>>
>>> This guys says that vide.d works https://forum.dlang.org/thread/gikoeutmdyvolfshpqqq@forum.dlang.org
>>
>> Yes, it's pretty straightforward:
>>
>> 1. Build on Ubuntu, or some other dist
>> 2. Statically link the whole binary with LDC, then you don't need to use Musl
>> 3. Run it on Alpine
>>
>> --
>> /Jacob Carlborg
>
> Looks like that works out much nicer than using alpine as the first stage right now.  I'm not sure anyone will be too upset about the extra 7MB.

Building directly in alpine will simplify automated builds too.