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

Problem with using 'libncursesw.so' (Linux) #15

Open
runkharr opened this issue Dec 4, 2018 · 0 comments
Open

Problem with using 'libncursesw.so' (Linux) #15

runkharr opened this issue Dec 4, 2018 · 0 comments

Comments

@runkharr
Copy link

runkharr commented Dec 4, 2018

Hi!

You should not use 'libncursesw.so' directly as a 'dynlib' under Linux, because there is a high probability that this file is a linker script containing the line

INPUT(libncursesw.so.5 -ltinfo)

(or)

INPUT(libncursesw.so.6 -ltinfo)

Instead, you should use there 'libncursesw.so.(5|6)'. I checked this, and it works. The original 'libncursesw.so' leads to the following error message when invoking a program which was linked with your 'ncurses'-module:

could not load: libncursesw.so
compile with -d:nimDebugDlOpen for more information

With the mentioned flag set, the following error message is printed when this program is invoked:

/usr/lib/x86_64-linux-gnu/libncursesw.so: file too short
could not load: libncursesw.so

The reason for this behaviour is that 'dlopen()' is unable to handle linker scripts. Linker scripts are meant to be used solely with the linker 'ld'. I doubt that 'dlopen()' will ever be able to handle such files, because they may contain anything ld's scripting language supports, even dependencies on static libraries ('XXX.a').

Nim seems currently unable to generate modules containing dynamically loadable object files, but, until (if ever) this is the case, workarounds as described above must be used.

If you wish, i could create a pull-request with the fix, but currently this is bothersome for me, as i have little time for such things, and i have made no good experiences with these things (yet).

Greetings
    runkharr

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

Successfully merging a pull request may close this issue.

1 participant