libgmp in non-standard location

12 views
Skip to first unread message

Jan von Löwenstein

unread,
Jul 23, 2017, 4:56:42 PM7/23/17
to haskell-stack
Hi, 

When I compile libgmp to a non-standard location, install a specific ghc version (into a non-standard location) to use with `stack --system-ghc` and then `stack build` my code and its dependencies using `--extra-lib-dirs` and `--extra-include-dirs`. Should that work? 
I get complaints from `ld` that it can't find `-Lgmp`. Apparently there is some validation step that attempts to link against gmp in order to, well, validate linking will work at runtime? 

Some additional questions that came to my mind:
How would I ensure GHC itself can find libgmp (assuming there is usage of that in GHC code itself)? 
Do I have to ensure that my compiled code finds libgmp in the non-standard location and how would I do it? 

I did some googling on that but I am admittedly new to low level systems/compilation stuff so I easily got lost. 

Hopefully someone can help me out on that. 

Best regards, 
Jan 

Michael Snoyman

unread,
Jul 26, 2017, 1:05:18 AM7/26/17
to Jan von Löwenstein, haskell-stack
I'm not expert on this, but I believe you'll need to set LD_CONFIG appropriately instead of using --extra-lib-dirs. The --extra-lib-dirs is not used during GHC sanity check if I remember correctly.

Jan 

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-stack/CAJtP4w6HsEpW5umoENyAKcjLY%2BH1M7bcK0D0utxM0g-xc3qNwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jan von Löwenstein

unread,
Jul 27, 2017, 3:29:09 AM7/27/17
to Michael Snoyman, haskell-stack

For now I solved it with LD_LIBRARY_PATH & LIBRARY_PATH (see https://github.com/SAP/bosh-kubernetes-cpi-release/blob/master/packages/bosh_kubernetes_cpi/packaging#L12-L13)

I suppose I could leave one of them out.

As far as I tried that no requirement for running the resulting binary.


Michael Snoyman <michael...@gmail.com> schrieb am Mi., 26. Juli 2017, 07:05:
I'm not expert on this, but I believe you'll need to set LD_CONFIG appropriately instead of using --extra-lib-dirs. The --extra-lib-dirs is not used during GHC sanity check if I remember correctly.

On Sun, Jul 23, 2017 at 11:56 PM, Jan von Löwenstein <jan.loe...@gmail.com> wrote:
Hi, 

When I compile libgmp to a non-standard location, install a specific ghc version (into a non-standard location) to use with `stack --system-ghc` and then `stack build` my code and its dependencies using `--extra-lib-dirs` and `--extra-include-dirs`. Should that work? 
I get complaints from `ld` that it can't find `-Lgmp`. Apparently there is some validation step that attempts to link against gmp in order to, well, validate linking will work at runtime? 

Some additional questions that came to my mind:
How would I ensure GHC itself can find libgmp (assuming there is usage of that in GHC code itself)? 
Do I have to ensure that my compiled code finds libgmp in the non-standard location and how would I do it? 

I did some googling on that but I am admittedly new to low level systems/compilation stuff so I easily got lost. 

Hopefully someone can help me out on that. 

Best regards, 
Jan 

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stac...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages