raku-community-modules / Linenoise

Linenoise bindings for Raku
MIT License
15 stars 6 forks source link

Linenoise broken on Windows as of 2016.11 #17

Open stmuk opened 7 years ago

stmuk commented 7 years ago

I had to revert the version of Linenoise shipped with star to the one before Native::Resources removal in order to get it to work on Windows 10/mingw (from Strawberry Perl)

hoelzro commented 7 years ago

@stmuk What kinds of problems did you see with the latest linenoise?

ugexe commented 7 years ago

The problem is the make file has a hard coded liblinenoise%SO% but also relies on the $*VM.platform-library-name elsewhere which doesn't prefix the library name with 'lib'. So it fails trying to find liblinenoise.dll when it should be linenoise.dll

I've fixed that issue in #19, but starting linenoise via perl6 after install prints out a message about a missing symbol. I suspect this is an issue with the dll being renamed to $some-sha1 ~ '.dll' when installed, and that it needs to keep its original file name (see: https://github.com/sergot/openssl/commit/91efa8c4f53e86501f23b3a6aeb4184cfedbfa9f)

hoelzro commented 7 years ago

@ugexe Thanks for the feedback - I've merged your PR. Is there other work that needs to be done for this to work on Windows?

ugexe commented 7 years ago

Yes, you need to implement something like https://github.com/sergot/openssl/blob/91efa8c4f53e86501f23b3a6aeb4184cfedbfa9f/lib/OpenSSL/NativeLib.pm6 and replace your use of %?RESOURCES<libraries/linenoise> with something like the &ssl-lib from OpenSSL/NativeLib.pm6. The purpose of NativeLib.pm6 is that on Windows it copies the installed perl6/install/site/resource/lakjf09jf2093jf.dll to a temporary directory, renames it to its original linenoise.dll, and returns an IO::Path pointing at that. The PR simply allowed this to be installed on windows again

This is really a bug in CompUnit::Repository::Installation in that there needs to be a way to declare a file name cannot be mangled, so don't view this suggestion as anything other than a workaround.

hoelzro commented 7 years ago

@ugexe I'm kind of loathe to copy/paste some DLL-fixing code from the OpenSSL module, partially since it doesn't have a license in place. I don't like Linenoise being broken on Windows, but perhaps it would be better to wait for the CompUnit system to support the non-workaround behavior you described above.

raiph commented 5 years ago

I'm not a windows user and I'm not aware of anyone newly complaining about this but I encountered this issue while following up on another issue, and then dug a bit further to understand the status of this issue, and think it would be useful to update this issue with what I see, especially point 4:

  1. Aiui, Linenoise works on windows for rob but is broken for at least ugexe and stmuk and maybe others, maybe all others. (I've no idea but I find it hard to believe it's broken for all windows users!)

  2. Per ugexe's comment just above, there's a "bug in CompUnit::Repository::Installation in that there needs to be a way to declare a file name cannot be mangled".

  3. Per that same comment, there's a workaround that's been used for OpenSSL.

  4. Per your comment just above one of the reasons you didn't copy/paste that workaround for this Linenoise module was a lack of license at that time. Since then one has been added: https://github.com/sergot/openssl/blob/master/LICENSE

  5. Per ugexe's 2018 comment comment https://github.com/rakudo/rakudo/pull/2212#issuecomment-413698734 I'm guessing they have not fixed the above mentioned bug

hoelzro commented 5 years ago

@raiph Thanks for filling in this information! BTW, do you know of anyone would like to take over maintainership of Linenoise? I haven't worked on Perl 6 for a while and free time is at a premium for me, so I can't really give it the love and attention it deserves!

JJ commented 4 years ago

OK, I guess that'll have to be us. This one is a blocker for #29, so we'll try this one to go first.

JJ commented 4 years ago

For the time being, the Makefile (and some paths) are Linux-specific. I'm trying to find a way to compile it, in its current version, in Windows, and eventually I think we'll have to create two separate Makefiles.

JJ commented 4 years ago

OK, this is working now in Windows so we have at least a procedure to carry it out. I'll try and find a way to put this in the Makefile so that it's OS-independent.