Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't load specified .so files #14

Open
joeyh opened this issue Mar 12, 2013 · 2 comments
Open

doesn't load specified .so files #14

joeyh opened this issue Mar 12, 2013 · 2 comments

Comments

@joeyh
Copy link

joeyh commented Mar 12, 2013

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..

@bitc
Copy link
Owner

bitc commented Mar 12, 2013

How do you invoke ghci to use your .so file?

@joeyh
Copy link
Author

joeyh commented Mar 12, 2013

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//') $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants