Open JanClaasSchreiber opened 2 years ago
Looks like it is compiling the toy XS okay, but failing when it tries to load it. This can happen if the .so file is not in the system search path.
Hello Graham, thanks for looking into this. Maybe one step back. Based on the Description section of your github page, an already existing librdkafka is used by Alien::Librdkafka instead of downloading and compiling it. Based on the output above, is this the case?
From this output from above, the installation via perl -MCPAN -e 'shell' seems to be looking at the right place.
# Alien::Librdkafka->libs = -L/usr/local/lib -lrdkafka
# Alien::Librdkafka->dynamic_libs = /usr/local/lib/librdkafka.so.1
And the library is there
# find /usr | grep librdkafka.so | xargs ls -l
lrwxrwxrwx 1 root root 15 Oct 14 09:57 /usr/local/lib/librdkafka.so -> librdkafka.so.1
-rwxr-xr-x 1 root root 9130552 Oct 14 09:57 /usr/local/lib/librdkafka.so.1
Is there a way to manually execute the step(s) that is/are failing to dig into this further?
You can get more detail by running prove in verbose mode:
prove -bvm t/alien_librdkafka.t
I think thought that this is a configuration problem with the system. I understand the .so file is in /usr/local/lib
, otherwise the link step wouldn't work. It's breaking when the XS shared library is being loaded. The search for dynamic libs (librdkafka.so.1) doesn't have anything to do with the compiler or linker flags, and is unfortunately platform dependent.
On Linux and some other platforms you can use LD_LIBRARY_PATH
to explicitly add directories to the search path, but I recommend using that only to troubleshoot. If you let me know exactly what OS (and which distribution if Linux) I might be able to point you in the right direction.
Hey Graham,
it works...
The system I am using is SLES15SP3.
I reverted my VM to the original state and installed librdkafka-v1.8.0.
# ll /usr/local/lib/librdkafka.so*
lrwxrwxrwx 1 root root 15 Oct 14 20:10 /usr/local/lib/librdkafka.so -> librdkafka.so.1
-rwxr-xr-x 1 root root 9130552 Oct 14 20:10 /usr/local/lib/librdkafka.so.1
I then installed Alien::Librdkafka, which again failed.
Then I ran
server1:~/.cpan/build/Alien-Librdkafka-1.05-0 # prove -bvm t/alien_librdkafka.t
t/alien_librdkafka.t ..
#
#
#
# Alien::Librdkafka->version = 1.8.0
# Alien::Librdkafka->cflags = -DOPENSSL_LOAD_CONF -I/usr/local/include
# Alien::Librdkafka->libs = -L/usr/local/lib -lrdkafka
# Alien::Librdkafka->dynamic_libs = /usr/local/lib/librdkafka.so.1
#
#
ok 1 - Alien::Librdkafka responds to: cflags libs dynamic_libs bin_dir
not ok 2 - xs
# Failed test 'xs'
# at t/alien_librdkafka.t line 26.
# XSLoader failed
# Can't load '/root/.cpan/build/Alien-Librdkafka-1.05-0/_alien/tmp/test-alien-hPQ4xr/auto/librdkafka/librdkafka.so' for module librdkafka: librdkafka.so.1: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.26.1/x86_64-linux-thread-multi/DynaLoader.pm line 193.
# at /usr/lib/perl5/site_perl/5.26.1/Test/Alien.pm line 422.
# Compilation failed in require at /usr/lib/perl5/site_perl/5.26.1/Test/Alien.pm line 422.
# BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.26.1/Test/Alien.pm line 422.
ok 3 - xs subtest {
1..0 # SKIP subtest requires xs success
}
ok 4 - ffi # skip Test requires FFI::Platypus 0.12
ok 5 - ffi subtest {
1..0 # SKIP subtest requires ffi success
}
1..5
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/5 subtests
(less 1 skipped subtest: 3 okay)
Test Summary Report
-------------------
t/alien_librdkafka.t (Wstat: 256 Tests: 5 Failed: 1)
Failed test: 2
Non-zero exit status: 1
Files=1, Tests=5, 1 wallclock secs ( 0.05 usr 0.00 sys + 0.58 cusr 0.14 csys = 0.77 CPU)
Result: FAIL
I then configured LD_LIBRARY_PATH=/usr/local/lib.
export LD_LIBRARY_PATH=/usr/local/lib
prove -bvm t/alien_librdkafka.t
t/alien_librdkafka.t ..
#
#
#
# Alien::Librdkafka->version = 1.8.0
# Alien::Librdkafka->cflags = -DOPENSSL_LOAD_CONF -I/usr/local/include
# Alien::Librdkafka->libs = -L/usr/local/lib -lrdkafka
# Alien::Librdkafka->dynamic_libs = /usr/local/lib/librdkafka.so.1
#
#
ok 1 - Alien::Librdkafka responds to: cflags libs dynamic_libs bin_dir
ok 2 - xs
ok 3 - xs subtest {
ok 1 - library version is at least 0.9.3
# version = 1.8.0
1..1
}
ok 4 - ffi # skip Test requires FFI::Platypus 0.12
ok 5 - ffi subtest {
1..0 # SKIP subtest requires ffi success
}
1..5
ok
All tests successful.
Files=1, Tests=5, 1 wallclock secs ( 0.04 usr 0.02 sys + 0.73 cusr 0.12 csys = 0.91 CPU)
Result: PASS
I went ahead and reran perl -MCPAN -e 'shell' with LD_LIBRARY_PATH and installed Alien::Librdkafka, which worked fine as well.
My perl application then started without LD_LIBRARY_PATH being set.
Thanks a lot for your help!
Hello!
I successfully compiled the latest version (1.8.2) of librdkafka. But getting this into the perl context fails. What I did:
Would be nice if someone could comment on this...