I'm not familiar with Haskell but I would think that it supports compiling static binaries. I tried to do so with stack build --fast --ghc-options '-optl-static' and it resulted in:
Building all executables for `capDL-tool' once. After a successful build of all of them, only specified executables will be rebuilt.
capDL-tool> configure (exe)
Configuring capDL-tool-1.0.0.1...
capDL-tool> build (exe)
Preprocessing executable 'parse-capDL' for capDL-tool-1.0.0.1..
Building executable 'parse-capDL' for capDL-tool-1.0.0.1..
[ 1 of 17] Compiling CapDL.Matrix
[ 2 of 17] Compiling CapDL.Model
[ 3 of 17] Compiling CapDL.AST
[ 4 of 17] Compiling CapDL.ParserUtils
[ 5 of 17] Compiling CapDL.Parser
[ 6 of 17] Compiling CapDL.DumpParser
[ 7 of 17] Compiling CapDL.STCC
[ 8 of 17] Compiling CapDL.State
[ 9 of 17] Compiling CapDL.PrintUtils
[10 of 17] Compiling CapDL.PrintXml
[11 of 17] Compiling CapDL.PrintModel
[12 of 17] Compiling CapDL.PrintJSON
[13 of 17] Compiling CapDL.PrintDot
[14 of 17] Compiling CapDL.PrintC
[15 of 17] Compiling CapDL.PrintIsabelle
[16 of 17] Compiling CapDL.MakeModel
[17 of 17] Compiling Main
Linking .stack-work/dist/x86_64-linux/Cabal-3.6.3.0/build/parse-capDL/parse-capDL ...
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_cond_broadcast.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_cond_destroy.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_cond_init.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_cond_signal.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_cond_wait.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_cond_wait.o)(.note.stapsdt+0x60): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_cond_wait.o)(.note.stapsdt+0xac): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_join_common.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_join_common.o)(.note.stapsdt+0x5c): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_mutex_cond_lock.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_mutex_cond_lock.o)(.note.stapsdt+0x5c): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_mutex_cond_lock.o)(.note.stapsdt+0xa0): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_mutex_destroy.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libc.a(pthread_mutex_init.o)(.note.stapsdt+0x14): error: relocation refers to local symbol "" [1], which is defined in a discarded section
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
Error: [S-7282]
Stack failed to execute the build plan.
While executing the build plan, Stack encountered the following errors:
[S-7011]
While building package capDL-tool-1.0.0.1 (scroll up to its section to see the error) using:
/home/ivanv/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.8 --verbose=1 --builddir=.stack-work/dist/x86_64-linux/Cabal-3.6.3.0 build exe:parse-capDL --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
If someone familiar with the tool or Haskell could help that would be great. I cannot find any documentation for building a static binary with stack.
I'm not familiar with Haskell but I would think that it supports compiling static binaries. I tried to do so with
stack build --fast --ghc-options '-optl-static'
and it resulted in:If someone familiar with the tool or Haskell could help that would be great. I cannot find any documentation for building a static binary with stack.