Statically link GMP to an Haskell application using GHC (+ LLVM)

前端 未结 1 1846
自闭症患者
自闭症患者 2020-12-05 11:05
  1. How can I drop dynamic dependency on libgmp and go from this:

    linux-vdso.so.1 =>  (0x00007fffdccb1000)
    libgmp.so.10 => /usr/lib/x         
    
    
            
相关标签:
1条回答
  • 2020-12-05 11:59

    If you pass -optl-static -optl-pthread to GHC, it'll statically link all the runtime library dependencies, including GMP. Setting ld-options: -static -pthread in your Cabal file should accomplish the same thing.

    That means you'll statically link in glibc too, but that probably won't be a problem, although it might increase binary size quite a bit. Using an alternative libc like musl or uClibc should help counteract that, if it's a problem for you.

    0 讨论(0)
提交回复
热议问题