Skip to content

Another workaround for GHCI #43

Description

@guibou

In haddock we can read:

Linker error in GHCi

Attempting to import library using C extensions from ghci may result in linker failing to find symbols from libpython like PyFloat_Type or some other. Only known workaround is to set LD_PRELOAD=pathto/libpython3.XX.so environment variable.

However, this can create a huge havock if the rest of the code calls some other tools / program which are not happy with this LD_PRELOAD. For example, at work, my testsuite runs postgresql and redis-server during the haskell testsuite and these programs seems to not be happy to have the python library force loaded in their memory space when they start. I had not investigated too much.

I found another workaround which is to load the python library only inside the haskell memory space:

        System.Posix.DynamicLinker.dlopen "path/to//lib/libpython3.so" [System.Posix.DynamicLinker.RTLD_NOW, System.Posix.DynamicLinker.RTLD_GLOBAL]

Works great ;)

Could you test and if this is fine for you, I'll open an MR to update the documentation (either replace or add this suggestion).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions