tbarnetlamb / hyphen

hyphen - access Haskell modules from Python
GNU General Public License v2.0
89 stars 8 forks source link

Cannot find .dyn_o files #11

Closed hellandhansen closed 4 years ago

hellandhansen commented 4 years ago

Hi!

Running

import hyphen hyphen.find_and_load_haskell_source() import hs.Tryit

Getting this error:

Traceback (most recent call last): File "/home/ai/haskell/hyphen/test_in_place.py", line 7, in hyphen.find_and_load_haskell_source() File "/home/ai/haskell/hyphen/hyphen/source_loading.py", line 136, in find_and_load_haskell_source fetch_source_modules(found_modules) File "/home/ai/haskell/hyphen/hyphen/caches.py", line 51, in fetch_source_modules module_cache.update(hslowlevel.import_src(*paths)) hyphen.HsException: : fatal: cannot find object file ‘/home/ai/haskell/hyphen/Test.dyn_o’ while linking an interpreted expression

Is there any workaround to get this to work?

Help much appreciated for this noob ;-)

Kind regards

tbarnetlamb commented 4 years ago

This may be a dumb question, but have you actually compiled all your Haskell source? (Hyphen will not do that for you.) It looks like you may have compiled your Tryit.hs module but not the Test.hs example file that's part of the standard hyphen codebase. ghc -dynamic-too -shared -fPIC Test.hs -no-link should compile the provided file. You could also just delete Test.hs and it will no longer try to import it and look for the compiled version.

hellandhansen commented 4 years ago

Hm. I hadn't actually. That solved it. I'm only learning, much Haskellology is still abstruse to me.

Thank you for being so very prompt and helpful. Kudos.

tbarnetlamb commented 4 years ago

You're very welcome.

FWIW, you're not the only person who's been tripped up by this particular issue. If you have time to make a PR editing the readme.md so it warned people of this issue (i.e. that they should compile their Haskell code before find_and_load_haskell_source), I'd be very grateful!