Repository navigation
Cannot locate native library #46
Copy link
Copy link
Open
Description
My kit:
Welcome to Rakudo™ Star v2024.10.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2024.10.
On ubuntu
PRETTY_NAME="Ubuntu 22.04.5 LTS"
zef
0.22.4
I am trying to
zef install Inline::Python --exclude="python3"
And getting this error on the first test t/call.t...
===> Testing: Inline::Python:ver<0.5>:auth<cpan:NINE>
[Inline::Python] Cannot locate native library '/tmp/.zef.1731085229.69/1731085236.69.5931.3643253181135/resources/15A7732F70D51B37276F0C1819FD5F
[Inline::Python] 091BA26D2D.so': libpython3.11.so.1.0: cannot open shared object file: No such file or directory
[Inline::Python] in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
[Inline::Python] in method setup at /home/jovy
[Inline::Python] an/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 399
[Inline::Python] in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
[Inline::Python] in method BUILD at /home/jovyan/rakudo/share/perl6/site/sources/37653EDB728A26F20B16AF45FDA81F139277FD9B (Inline::Python) line 537
[Inline::Python] in block <unit> at t/call.t line 8
[Inline::Python]
[Inline::Python] Some exceptions were thrown in END blocks:
[Inline::Python] X::AdHoc: Cannot locate native library '/tmp/.zef.1731085229.69/1731085236.69.5931.3643253181135/resources/15A7732F70D51B37276F0C1819FD5F091BA26D2D.so': libpython3.11.so.1.0: cannot open shared object file: No such file or directory
[Inline::Python] in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
[Inline::Python] in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99D
[Inline::Python] E84801C5C3 (NativeCall) line 399
[Inline::Python] in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
[Inline::Python] in block at /home/jovyan/rakudo/share/perl6/site/sources/37653EDB728A26F20B16AF45FDA81F139277FD9B (Inline::Python) line 648
[Inline::Python] in any <main> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1
[Inline::Python] in any <entry> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1
[Inline::Python]
[Inline::Python] t/call.t ................ Dubious, test returned 1
So I did a
zef install Inline::Python -v --exclude="python3" --/test
And then ran this snippet:
#!/usr/bin/env perl6
use v6;
use Inline::Python;
say "1..13";
my $py = Inline::Python.new();
And got a clearer error:
(base) root@a8e00c935f1b:~/Inline-Python# raku -I. scum.raku
1..13
Cannot locate native library '/home/jovyan/Inline-Python/resources/libraries/libpyhelper.so': /home/jovyan/Inline-Python/resources/libraries/libpyhelper.so: cannot open shared object file: No such file or directory
in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 399
in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
in method BUILD at /home/jovyan/Inline-Python/lib/Inline/Python.pm6 (Inline::Python) line 537
in block <unit> at scum.raku line 8
Some exceptions were thrown in END blocks:
X::AdHoc: Cannot locate native library '/home/jovyan/Inline-Python/resources/libraries/libpyhelper.so': /home/jovyan/Inline-Python/resources/libraries/libpyhelper.so: cannot open shared object file: No such file or directory
in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 399
in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
in block at /home/jovyan/Inline-Python/lib/Inline/Python.pm6 (Inline::Python) line 648
in any <main> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1
in any <entry> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1
Here's the source
https://github.com/niner/Inline-Python/blob/05806b0aee2ded79391b63ee5537b7277d17a6b6/lib/Inline/Python.pm6#L10
There is no dir /home/jovyan/Inline-Python/resources at all which makes me suspect the
"builder": "Distribution::Builder::MakeFromJSON"
Please can someone who knows how to get libpyhelper.so to the right place please take a look...?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
librasteve commentedon Nov 8, 2024
One way to replicate my environment is to run this Dockerfile...
So go
docker build -t test .and thendocker run -it testand do the commented out command from the command line.librasteve commentedon Nov 9, 2024
OK ... try to boil this down ... I isolated the gcc issued by Distribution::Build and ran by hand...
pyhelper.c: In function ‘py_init_python’:
pyhelper.c:19:5: warning: ‘Py_SetProgramName’ is deprecated [-Wdeprecated-declarations]
19 | Py_SetProgramName(L"python");
| ^~~~~~~~~~~~~~~~~
In file included from /opt/conda/include/python3.11/Python.h:94,
from pyhelper.c:1:
/opt/conda/include/python3.11/pylifecycle.h:37:38: note: declared here
37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t );
| ^~~~~~~~~~~~~~~~~
pyhelper.c:23:5: warning: ‘PySys_SetArgv’ is deprecated [-Wdeprecated-declarations]
23 | PySys_SetArgv(_python_argc, _python_argv); / Tk needs this */
| ^~~~~~~~~~~~~
In file included from /opt/conda/include/python3.11/Python.h:96,
from pyhelper.c:1:
/opt/conda/include/python3.11/sysmodule.h:13:38: note: declared here
13 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
| ^~~~~~~~~~~~~
pyhelper.c: In function ‘py_string_as_string’:
pyhelper.c:146:12: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
146 | return PyUnicode_AsUTF8(obj);
| ^~~~~~~~~~~~~~~~~~~~~
pyhelper.c: In function ‘py_raise_missing_method’:
pyhelper.c:262:30: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
262 | char *c_class_name = PyUnicode_AsUTF8(class_name);
| ^~~~~~~~~~~~~~~~
pyhelper.c: In function ‘perl6_invoke’:
pyhelper.c:362:18: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
362 | char * buf = PyUnicode_AsUTF8AndSize(name, &length);
| ^~~~~~~~~~~~~~~~~~~~~~~
pyhelper.c: In function ‘py_call_method’:
pyhelper.c:323:12: warning: ‘py_retval’ may be used uninitialized in this function [-Wmaybe-uninitialized]
323 | return py_retval;
| ^~~~~~~~~
/usr/bin/ld: cannot open output file resources/libraries/libpyhelper.so: No such file or directory
collect2: error: ld returned 1 exit status
(base) root@3e1dd9b36003:~/Inline-Python# make clean all
make: *** No rule to make target 'clean'. Stop.
librasteve commentedon Nov 9, 2024
then I went
librasteve commentedon Nov 9, 2024
OK
I found this https://stackoverflow.com/questions/43333207/python-error-while-loading-shared-libraries-libpython3-4m-so-1-0-cannot-open ... which said go
^^ the actual path is Python installation dependent
Now I get this in /t
librasteve commentedon Nov 9, 2024
OK, now I did a clean install of Inline::Python using zef (after rm -rf the ~/Inline-Python/resources/libraries) ...
all works fine except for
import.tlibrasteve commentedon Nov 9, 2024
I have raised a new Issue for the import.t failure
Meantime please go
--/testlibrasteve commentedon Nov 10, 2024
fwiw it has been pointed out that the line
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/conda/lib(or some better version that picks the path fromwhich pythoncould be put inMakefileor inconfigure.pl6) ...