<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Binary on Miek Gieben</title>
    <link>https://miek.nl/tags/binary/</link>
    <description>Recent content in Binary on Miek Gieben</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <copyright>© Copyright 2007-2024 Miek Gieben</copyright>
    <lastBuildDate>Sat, 06 Jun 2015 11:13:00 +0000</lastBuildDate>
    <atom:link href="https://miek.nl/tags/binary/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Go and Alpine Linux</title>
      <link>https://miek.nl/2015/june/06/go-and-alpine-linux/</link>
      <pubDate>Sat, 06 Jun 2015 11:13:00 +0000</pubDate>
      <guid>https://miek.nl/2015/june/06/go-and-alpine-linux/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.alpinelinux.org/&#34;&gt;Alpine Linux&lt;/a&gt; is &lt;em&gt;the&lt;/em&gt; small Linux OS everybody&#xA;is using for Docker images. It is super small and has a sh*tload of packages.&#xA;It&amp;rsquo;s libc is &lt;a href=&#34;http://www.musl-libc.org/&#34;&gt;musl libc&lt;/a&gt;, which is different than&#xA;glibc most other Linux distros are using. When deploying Go on such a image you&#xA;want a truly static binary.&lt;/p&gt;&#xA;&lt;p&gt;Building a static binary can be done with the following command (this is for&#xA;&lt;a href=&#34;https://github.com/miekg/skydns&#34;&gt;SkyDNS&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;% go build -ldflags &amp;quot;-linkmode external -extldflags -static&amp;quot;&#xA;# github.com/miekg/skydns&#xA;/var/tmp/go-link-FI6Ox0/000000.o: In function `_cgo_632c88804cec_C2func_getaddrinfo&#39;:&#xA;/home/miek/upstream/go/src/net/cgo_unix.go:55: warning: Using &#39;getaddrinfo&#39; in&#xA;statically linked applications requires at runtime the shared libraries from the&#xA;glibc version used for linking&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That ugly warning is because glibc uses nss(5) &amp;ldquo;Nameserver Service Switch&amp;rdquo; which&#xA;uses dlopen(3) to &lt;em&gt;dynamically&lt;/em&gt; load the correct resolver library. The end&#xA;result is that the Go binary &lt;em&gt;can&amp;rsquo;t resolve any DNS records&lt;/em&gt;!&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
