public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* help wanted producing a statically linked executable
@ 2017-09-08  0:28 John MACFARLANE
  0 siblings, 0 replies; only message in thread
From: John MACFARLANE @ 2017-09-08  0:28 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I had a build process in place to produce a fully static
linux executable, but it no longer works.  And I'm a bit
baffled at what I'm seeing, so I'm hoping someone can help.

Easiest way to reproduce is with Docker.

Dockerfile:

```
FROM alpine:edge
RUN apk update
RUN apk add alpine-sdk git ca-certificates ghc cabal zlib-dev \
    dpkg fakeroot sed gawk grep bash linux-headers
RUN cabal update
RUN mkdir -p /usr/src/
WORKDIR /usr/src/
RUN git clone https://github.com/jgm/pandoc
WORKDIR /usr/src/pandoc
```

Now, get an interactive session in the docker image:

docker run -it alpine-pandoc:latest /bin/bash

You'll find yourself in /usr/src/pandoc.  Let's try a static
build:

cabal new-build --disable-executable-dynamic \
  --ghc-options='-optl=-static -optl=-pthread -fPIC' \
  -fembed_data_files

When that's done, we can see what we have:

bash-4.3# ldd dist-newstyle/build/pandoc-2.0/build/pandoc/pandoc
        /lib/ld64.so.1 (0x7ff84a618000)

Not a static executable.  When I transfer it outside the
container and examine it with OSX's 'file', I see:

artifacts/pandoc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped

When I try to run it, I get:

bash-4.3# dist-newstyle/build/pandoc-2.0/build/pandoc/pandoc --version
bash: dist-newstyle/build/pandoc-2.0/build/pandoc/pandoc: No such file or directory

because /lib/ld64.so.1 doesn't exist.

Does anyone know why I'm not getting a fully statically
linked executable?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-08  0:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08  0:28 help wanted producing a statically linked executable John MACFARLANE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).