<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Is the shared library of the dependency that has it statically linked in not enough? At this point I am also unsure how ghc is able to determine which library to dynamically load.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 4, 2020, at 2:03 PM, Brandon Allbery <<a href="mailto:allbery.b@gmail.com" class="">allbery.b@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">ghci loads dynamically for the same reason TH does: you would</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">otherwise need a ghc linked against your static library. (You could</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">try -fobject-code and/or an explicit -l option for the library with</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">ghci.)</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On 6/4/20, Will Song via Haskell-Cafe <</span><a href="mailto:haskell-cafe@haskell.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">haskell-cafe@haskell.org</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">> wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">The 2nd module to compile uses TemplateHaskell and that's where stack build<br class="">will fail. However, trying to load Echidna.Mutator into ghci will also fail<br class="">for the same reason, but it compiles just fine. The import list is pasted<br class="">below.<br class=""><br class="">{-# LANGUAGE FlexibleContexts #-}<br class=""><br class="">module Echidna.Mutator where<br class=""><br class="">import Control.Monad.Random.Strict (fromList, MonadRandom, getRandomR)<br class="">import Data.Maybe (maybe)<br class=""><br class="">import qualified Data.ListLike as LL<br class=""><br class=""><blockquote type="cite" class="">On Jun 4, 2020, at 1:51 PM, Jinwoo Lee <<a href="mailto:jinwoo68@gmail.com" class="">jinwoo68@gmail.com</a>> wrote:<br class=""><br class="">Does your code use TemplateHaskell? In that case, the compiler will try to<br class="">load the library for the compile-time computation.<br class=""><br class=""><br class="">On Wed, Jun 3, 2020 at 12:17 PM Will Song via Haskell-Cafe<br class=""><<a href="mailto:haskell-cafe@haskell.org" class="">haskell-cafe@haskell.org</a><span class="Apple-converted-space"> </span><<a href="mailto:haskell-cafe@haskell.org" class="">mailto:haskell-cafe@haskell.org</a>>> wrote:<br class="">Hey all, I am experiencing some weird build issues with respect to GHC. I<br class="">would like to mention that what I am doing is somewhat non-standard but<br class="">theoretically I think it should work.<br class=""><br class="">I am developing a Haskell program which depends on a library, hevm, with<br class="">several external library dependencies, libsecp256k1 and libff. Since these<br class="">libraries are a bit of a pain to install by default in the macOS<br class="">ecosystem, having no brew packages, my plan is to statically link these<br class="">libraries into the release builds. To start off this task, I have simply<br class="">moved the dynamic libraries for secp256k1 to another location, e.g. # mv<br class="">/usr/local/lib/libsecp256k1.dylib{,.bak}. Rebuilding the dependency hevm<br class="">appears to work as expected. It compiles fine, and otool reports the<br class="">following.<br class=""><br class="">% otool -L .stack-work/install/x86_64-osx/lts-14.14/8.6.5/bin/hevm<br class="">.stack-work/install/x86_64-osx/lts-14.14/8.6.5/bin/hevm:<br class="">       /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current<br class="">version 1281.0.0)<br class="">       libff.dylib (compatibility version 0.0.0, current version 0.0.0)<br class="">       /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current<br class="">version 800.7.0)<br class="">       /usr/lib/libz.1.dylib (compatibility version 1.0.0, current<br class="">version 1.2.11)<br class="">       /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0,<br class="">current version 5.4.0)<br class="">       /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current<br class="">version 7.0.0)<br class="">       /usr/lib/libcharset.1.dylib (compatibility version 2.0.0, current<br class="">version 2.0.0)<br class=""><br class="">We can check libHShevm... as well and it does not depend on the secp256k1<br class="">dylib anymore.<br class=""><br class="">However, moving back onto my program, the build fails.<br class=""><br class="">% stack build<br class="">Building all executables for `echidna' once. After a successful build of<br class="">all of them, only specified executables will be rebuilt.<br class="">echidna-1.5.0: configure (lib + exe)<br class="">Configuring echidna-1.5.0...<br class="">Warning: 'ghc-options: -threaded' has no effect for libraries. It should<br class="">only<br class="">be used for executables.<br class="">echidna-1.5.0: build (lib + exe)<br class="">Preprocessing library for echidna-1.5.0..<br class="">Building library for echidna-1.5.0..<br class="">[ 1 of 24] Compiling Echidna.Mutator  ( lib/Echidna/Mutator.hs,<br class="">.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Echidna/Mutator.o )<br class="">[ 2 of 24] Compiling Echidna.Orphans.JSON ( lib/Echidna/Orphans/JSON.hs,<br class="">.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Echidna/Orphans/JSON.o )<br class=""><command line>: can't load .so/.DLL for: libsecp256k1.dylib<br class="">(dlopen(libsecp256k1.dylib, 5): image not found)<br class=""><br class="">--  While building package echidna-1.5.0 using:<br class=""><br class="">/Users/incertia/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5<br class="">--builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:echidna<br class="">exe:echidna-test --ghc-options " -ddump-hi -ddump-to-file<br class="">-fdiagnostics-color=always"<br class=""> Process exited with code: ExitFailure 1<br class=""><br class="">Would anyone happen to know why this failure is occurring? We have no C<br class="">sources that would create unresolved references to this library, all the<br class="">code is Haskell. My understanding is that ghc should end up using the<br class="">static variant now that there is no dynamic library but clearly this<br class="">intuition is misguided.<br class="">_______________________________________________<br class="">Haskell-Cafe mailing list<br class="">To (un)subscribe, modify options or view archives go to:<br class=""><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br class=""><<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>><br class="">Only members subscribed via the mailman list are allowed to post.<br class=""></blockquote><br class=""><br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">--<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">brandon s allbery kf8nh</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:allbery.b@gmail.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">allbery.b@gmail.com</a></div></blockquote></div><br class=""></body></html>