I hope someone has already done this before, because this is kind of out of my comfort zone:
I’m trying to build an Alpine Linux docker image to build our code on, and I thought I’d try the ghc-musl
images.
So far so good, but now I’m at the point where it’s trying to build wai-app-static
because of servant-server
, and I get the following error:
wai-app-static > Preprocessing executable 'warp' for wai-app-static-3.1.8..
wai-app-static > Building executable 'warp' for wai-app-static-3.1.8..
wai-app-static > [1 of 1] Compiling Main
wai-app-static > Linking .stack-work/dist/aarch64-linux/ghc-9.2.8/build/warp/warp ...
wai-app-static > /usr/lib/gcc/aarch64-alpine-linux-musl/bin/ld: /root/.stack/snapshots/aarch64-linux/90c4bf6db80e5043083a5d99a748e5c0d2deda42eb9b8614d67e82e4ae4536f7/9.2.8/lib/aarch64-linux-ghc-9.2.8/simple-sendfile-0.2.31-L8f2VR7YUNWHGWBIC85RU7/libHSsimple-sendfile-0.2.31-L8f2VR7YUNWHGWBIC85RU7.a(Linux.o): in function `simplezmsendfilezm0zi2zi31zmL8f2VR7YUNWHGWBIC85RU7_NetworkziSendfileziLinux_zdwsendfileloop_info':
wai-app-static > (.text+0x784): undefined reference to `sendfile64'
wai-app-static > collect2: error: ld returned 1 exit status
wai-app-static > `gcc' failed in phase `Linker'. (Exit code: 1)
I can’t seem to find a (C?) library that has this function, or have any idea how I would get around this issue. I hope someone else has already had this issue, since building servant
is a pretty common thing.
EDIT: Added extra lines at the top of the example; it seems it fails because it tries to build the warp
executable from the wai-app-static
.cabal file. Is there a way to ignore the executable? --skip wai-app-static:exe:warp
doesn’t seem to work
(I’m building with stack --resolver lts-20.26 build --only-dependencies --ghc-options="-j" --system-ghc --skip wai-app-static:exe:warp
)