<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="">The 2nd module to compile uses TemplateHaskell and that's where stack build will fail. However, trying to load Echidna.Mutator into ghci will also fail for the same reason, but it compiles just fine. The import list is pasted below.<div class=""><br class=""></div><div class=""><div class="">{-# LANGUAGE FlexibleContexts #-}</div><div class=""><br class=""></div><div class="">module Echidna.Mutator where</div><div class=""><br class=""></div><div class="">import Control.Monad.Random.Strict (fromList, MonadRandom, getRandomR)</div><div class="">import Data.Maybe (maybe)</div><div class=""><br class=""></div><div class="">import qualified Data.ListLike as LL</div><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 4, 2020, at 1:51 PM, Jinwoo Lee <<a href="mailto:jinwoo68@gmail.com" class="">jinwoo68@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Does your code use TemplateHaskell? In that case, the compiler will try to load the library for the compile-time computation.</div><div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 3, 2020 at 12:17 PM Will Song via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org" class="">haskell-cafe@haskell.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey all, I am experiencing some weird build issues with respect to GHC. I would like to mention that what I am doing is somewhat non-standard but theoretically I think it should work.<br class="">
<br class="">
I am developing a Haskell program which depends on a library, hevm, with several external library dependencies, libsecp256k1 and libff. Since these libraries are a bit of a pain to install by default in the macOS ecosystem, having no brew packages, my plan is to statically link these libraries into the release builds. To start off this task, I have simply moved the dynamic libraries for secp256k1 to another location, e.g. # mv /usr/local/lib/libsecp256k1.dylib{,.bak}. Rebuilding the dependency hevm appears to work as expected. It compiles fine, and otool reports the 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 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 version 800.7.0)<br class="">
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)<br class="">
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)<br class="">
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)<br class="">
/usr/lib/libcharset.1.dylib (compatibility version 2.0.0, current version 2.0.0)<br class="">
<br class="">
We can check libHShevm... as well and it does not depend on the secp256k1 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 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 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, .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, .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 (dlopen(libsecp256k1.dylib, 5): image not found)<br class="">
<br class="">
-- While building package echidna-1.5.0 using:<br class="">
/Users/incertia/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:echidna exe:echidna-test --ghc-options " -ddump-hi -ddump-to-file -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 sources that would create unresolved references to this library, all the code is Haskell. My understanding is that ghc should end up using the static variant now that there is no dynamic library but clearly this 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" rel="noreferrer" target="_blank" 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.</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>