raku-community-modules / Linenoise

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

/bin/ld: cannot find -luv #28

Open raiph opened 5 years ago

raiph commented 5 years ago

TL;DR:


The long version:

In SOQ Installing Linenoise for Perl6 on CentOS: cannot find library “luv” @con shows the error they were getting when installing Linenoise:

===> Building: Linenoise:ver<0.1.1>:auth<Rob Hoelz>
/bin/ld: cannot find -luv
collect2: error: ld returned 1 exit status
make: *** [/root/.zef/store/p6-linenoise.git/480fd919b2c082e691c518fd50c19ad8719532b6/resources/libraries/liblinenoise.so] Error 1

I wildly guessed it was something to do with libuv and commented as such. (My guess was that the -luv was a -l switch with uv as its argument, and that a lib was being inserted by something. It looks like I was right.) A couple minutes later @con then answered their question and noted:

the issue was that if libuv isn't installed, it gives an error with -luv which doesn't really help me know what library I need. @raiph gave me the hint I needed

In the meantime I was investigating by searching this repo for ld which led to this line:

%LD% %LDSHARED% %LDFLAGS% %LIBS% %LDOUT%resources/libraries/%linenoise% linenoise%O%

I was 99% sure this was the right line because of the resources/libraries/ bit which matched the make error message line. But before I got any further @con had figured the answer out from my libuv hint.

hoelzro commented 5 years ago

Thanks for forwarding the report to me @raiph - that line you posted is filled in by LibraryMake, which uses the build flags from $*VM to populate the template. I spun up a little VM with CentOS 7 to try to reproduce this - no dice, unfortunately. However, I have a theory:

My guess is that the user installed a pre-built perl6/rakudo package that uses a MoarVM built against the libuv that ships with CentOS, rather than the vendored version of libuv that MoarVM includes in its 3rdparty directory. That way, $*VM.config<libs> would probably have -luv in it. However, if that were the case, I wouldn't expect perl6 to run at all, since it would need to link to libuv at runtime. So I'm not really sure what's happening here!

Unfortunately, without knowing more about how the user installed Rakudo, there's not much more I can do!

hhg7 commented 5 years ago

@hoelzro I installed rakudo/perl6 with yum at the command line, but I had a similar issue with apt-get install on Ubuntu. I installed perl6 on Ubuntu with sudo apt-get install perl6

hoelzro commented 5 years ago

@hhg7 Is that rakudo/perl6 package in the default CentOS repos? Also, which version of CentOS are you using?

raiph commented 5 years ago

Rob, have you read (answer to) How can I figure out why Linenoise is failing to install?? This led to a PR which you merged but I think it's important you read that SO answer. Also, from the merged PR:

Note that while this allows Linenoise to be installed on windows once again, it still does not work properly.

That's not directly relevant here because that's windows and this is linux but thought I'd mention it.

hoelzro commented 5 years ago

@raiph I haven't seen that SO thread - thanks for pointing it out! That issue sounds more like a problem with hardcoding DLL/SO prefixes; this issue sounds more like "MoarVM is telling Rakudo that it was built with -luv in its linker flags".

ElectricCoffee commented 4 years ago

I'm having the same issue on Ubuntu. Running zef install Linenoise results in the following error

===> Searching for: Linenoise
===> Building: Linenoise:ver<0.1.1>:auth<Rob Hoelz>
[Linenoise] /usr/bin/ld: cannot find -luv
[Linenoise] collect2: error: ld returned 1 exit status
[Linenoise] make: *** [Makefile:9: /home/nle/.zef/store/p6-linenoise.git/4b98fe19b999a6da63f7427ab77f22e78739af88/resources/libraries/liblinenoise.so] Error 1
===> Building [FAIL]: Linenoise:ver<0.1.1>:auth<Rob Hoelz>
Aborting due to build failure: Linenoise:ver<0.1.1>:auth<Rob Hoelz> (use --force-build to override)

My system has a package called libuv1 installed, which seems to be the current version of the libuv dependency on Ubuntu, but the installer doesn't seem to recognise that.

raiph commented 4 years ago

Quoting https://colabti.org/irclogger/irclogger_log/moarvm?date=2020-06-10#l55:

15:56 | nine | raiph: re https://github.com/hoelzro/p6-linenoise/issues/28#issuecomment-463043982 it's worth perusing how those users installed MoarVM and how those packages were built precisely. MoarVM bundles a libuv and links to it statically. I guess those distro packagers didn't follow that.

raiph commented 4 years ago

Hi @ElectricCoffee,

Stefan's comment (above) suggests MoarVM normally ships with its own libuv but that your MoarVM perhaps doesn't. If you could post details about your MoarVM install beyond "Ubuntu", and especially the build log showing your MoarVM build output, that would be wonderful.

ElectricCoffee commented 4 years ago

@raiph how do I provide this information?

raiph commented 4 years ago

@ElectricCoffee

Two options I can think of:

  1. We dialog about how you got Rakudo onto your Ubuntu in the first place, and then we try figure out if the build logs are still available; or, perhaps way easier:

  2. You remove Rakudo, then install it again, but this time with the specific intent of grabbing the output from the building process and copying that into a gist, and also rerunning zef install Linenoise and copying that output into the gist too, and then linking to the gist in a comment here.

Thanks for following up.

ElectricCoffee commented 4 years ago

@raiph Here's the installation:

nle@ubuntu:~$ sudo apt install rakudo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  fonts-glyphicons-halflings libgraph-perl libjs-angularjs libjs-bootstrap moarvm nqp
Suggested packages:
  valgrind
The following NEW packages will be installed:
  fonts-glyphicons-halflings libgraph-perl libjs-angularjs libjs-bootstrap moarvm nqp rakudo
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,469 kB of archives.
After this operation, 47.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-1 [117 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libgraph-perl all 1:0.9704-1 [109 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libjs-angularjs all 1.7.9-1 [551 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libjs-bootstrap all 3.4.1+dfsg-1 [124 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 moarvm amd64 2019.11+dfsg-2build2 [1,225 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 nqp amd64 2019.11+dfsg-2 [584 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 rakudo amd64 2019.11-4 [3,759 kB]
Fetched 6,469 kB in 11s (590 kB/s)                                                                                                                                                                                
Selecting previously unselected package fonts-glyphicons-halflings.
(Reading database ... 319973 files and directories currently installed.)
Preparing to unpack .../0-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-1_all.deb ...
Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-1) ...
Selecting previously unselected package libgraph-perl.
Preparing to unpack .../1-libgraph-perl_1%3a0.9704-1_all.deb ...
Unpacking libgraph-perl (1:0.9704-1) ...
Selecting previously unselected package libjs-angularjs.
Preparing to unpack .../2-libjs-angularjs_1.7.9-1_all.deb ...
Unpacking libjs-angularjs (1.7.9-1) ...
Selecting previously unselected package libjs-bootstrap.
Preparing to unpack .../3-libjs-bootstrap_3.4.1+dfsg-1_all.deb ...
Unpacking libjs-bootstrap (3.4.1+dfsg-1) ...
Selecting previously unselected package moarvm.
Preparing to unpack .../4-moarvm_2019.11+dfsg-2build2_amd64.deb ...
Unpacking moarvm (2019.11+dfsg-2build2) ...
Selecting previously unselected package nqp.
Preparing to unpack .../5-nqp_2019.11+dfsg-2_amd64.deb ...
Unpacking nqp (2019.11+dfsg-2) ...
Selecting previously unselected package rakudo.
Preparing to unpack .../6-rakudo_2019.11-4_amd64.deb ...
Unpacking rakudo (2019.11-4) ...
Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-1) ...
Setting up libgraph-perl (1:0.9704-1) ...
Setting up libjs-angularjs (1.7.9-1) ...
Setting up moarvm (2019.11+dfsg-2build2) ...
Setting up libjs-bootstrap (3.4.1+dfsg-1) ...
Setting up nqp (2019.11+dfsg-2) ...
Setting up rakudo (2019.11-4) ...
  rakudo-helper.pl: Reinstalling all perl6 modules ...
Processing triggers for fontconfig (2.13.1-2ubuntu3) ...
Processing triggers for man-db (2.9.1-1) ...

nle@ubuntu:~$ sudo apt install perl6-zef
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  perl6-zef
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 402 kB of archives.
After this operation, 2,564 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 perl6-zef all 0.8.2-1 [402 kB]
Fetched 402 kB in 1s (385 kB/s)    
Selecting previously unselected package perl6-zef.
(Reading database ... 321113 files and directories currently installed.)
Preparing to unpack .../perl6-zef_0.8.2-1_all.deb ...
Unpacking perl6-zef (0.8.2-1) ...
Setting up perl6-zef (0.8.2-1) ...

And here's installing Linenoise

nle@ubuntu:~$ zef install Linenoise
===> Searching for: Linenoise
===> Building: Linenoise:ver<0.1.1>:auth<Rob Hoelz>
[Linenoise] /usr/bin/ld: cannot find -luv
[Linenoise] collect2: error: ld returned 1 exit status
[Linenoise] make: *** [Makefile:9: /home/nle/.zef/store/p6-linenoise.git/4b98fe19b999a6da63f7427ab77f22e78739af88/resources/libraries/liblinenoise.so] Error 1
===> Building [FAIL]: Linenoise:ver<0.1.1>:auth<Rob Hoelz>
Aborting due to build failure: Linenoise:ver<0.1.1>:auth<Rob Hoelz> (use --force-build to override)
raiph commented 4 years ago

Setting up moarvm (2019.11+dfsg-2build2) ...

\o/ That's not the build info, but it looks like the package name is enough to pursue this. The first match from a google for "2019.11+dfsg-2build2" is https://launchpad.net/ubuntu/+source/moarvm. Clicking on the 2019.11+dfsg-2build2 link on that page gets us to https://launchpad.net/ubuntu/+source/moarvm/2019.11+dfsg-2build2 which says it was uploaded by Matthias Klose, who it looks is contactable by email. I'll send an email linking to this comment and see how that goes.

Thanks @ElectricCoffee!