hdevtools
hdevtools copied to clipboard
doesn't load specified .so files
My project has some .so files as part of its FFI bindings. I cannot seem to get hdevtools to use them.
I tried including the filenames with -g mylib.so , which is what cabal passes to ghc, and which also works with ghci to load the modules using this, but it seems hdevtools doesn't do anything with them, since I get a failure like this:
During interactive linking, GHCi couldn't find the following symbol: diskfree
The only workaround I have found is to pass -DNO_LIBS and then #ifdef out all imports of modules using them..
How do you invoke ghci to use your .so file?
Bit Connor wrote:
How do you invoke ghci to use your .so file?
I derive this ghc command line via a script[1] from the gcc command cabal uses to build.
/usr/bin/ghc --interactive -o dist/build/git-annex/git-annex -fbuilding-cabal-package -package-conf dist/package.conf.inplace -i -idist/build/git-annex/git-annex-tmp -i. -idist/build/autogen -Idist/build/autogen -Idist/build/git-annex/git-annex-tmp -IUtility -optP-DWITH_TESTSUITE -optP-DWITH_S3 -optP-DWITH_WEBDAV -optP-DWITH_ASSISTANT -optP-DWITH_INOTIFY -optP-DWITH_DBUS -optP-DWITH_WEBAPP -optP-DWITH_PAIRING -optP-DWITH_XMPP -optP-DWITH_CLIBS -optP-include -optPdist/build/autogen/cabal_macros.h -odir dist/build/git-annex/git-annex-tmp -hidir dist/build/git-annex/git-annex-tmp -stubdir dist/build/git-annex/git-annex-tmp -Wall -XHaskell98 dist/build/git-annex/git-annex-tmp/Utility/libdiskfree.o dist/build/git-annex/git-annex-tmp/Utility/libmounts.o
Ugly, but that works great with cabal.
I manually tweaked that for hdevtools, yielding this:
hdevtools check git-annex.hs -g -cpp -g -i -g -idist/build/git-annex/git-annex-tmp -g -i. -g -idist/build/autogen -g -Idist/build/autogen -g -Idist/build/git-annex/git-annex-tmp -g -IUtility -g -DWITH_TESTSUITE -g -DWITH_S3 -g -DWITH_ASSISTANT -g -DWITH_INOTIFY -g -DWITH_DBUS -g -DWITH_PAIRING -g -DWITH_XMPP -g -optP-include -g -optPdist/build/autogen/cabal_macros.h -g -odir -g dist/build/git-annex/git-annex-tmp -g -hidir -g dist/build/git-annex/git-annex-tmp -g -stubdir -g dist/build/git-annex/git-annex-tmp -g -threaded -g -Wall -g -XHaskell98 -g dist/build/git-annex/git-annex-tmp/Utility/libdiskfree.o -g dist/build/git-annex/git-annex-tmp/Utility/libmounts.o
That works, except for the libraries not loading, and the CPP inclusion of dist/build/autogen/cabal_macros.h apparently not working either.
see shy jo
[1] script, FYI:
#!/bin/sh if [ ! -e dist/caballog ]; then cabal build -v2 > dist/caballog fi $(grep 'ghc --make' dist/caballog | head -n 1 | perl -pe 's/--make/--interactive/; s/./[^.\s]+.hs//; s/-package-id [^\s]+//g; s/-hide-all-packages//; s/-threaded//; s/-O//') $@