in reply to Unable to use created PerlXS Modul ( using c++ )

Did libmyclass build successfully? What files did you get? Do any of these files (or their folder paths) get mentioned in Makefile? You should try adding those LIBS=-Ldirpath

Also, all the myclass files should be in MANIFEST also

  • Comment on Re: Unable to use created PerlXS Modul ( using c++ )

Replies are listed 'Best First'.
Re^2: Unable to use created PerlXS Modul ( using c++ )
by lamchob (Initiate) on Feb 10, 2014 at 10:02 UTC
    libmyclass builds successfully, and the test I created for it works fine. I added the myclass/myclass.h/.cpp and the Makefile.PL to the manifest. Added '-L/home/dr/Abby/XS/Mytest/myclass' to LIBS. myclass/libmyclass gets mentions in the Makefile as MYEXTLIB. Nothing solved the problem so far. This is the output of the make-command:
    Skip blib/lib/Mytest.pm (unchanged) cd myclass && make make[1]: Betrete Verzeichnis '/home/dr/Abby/XS/Mytest/myclass' g++ -c -fPIC -O2 -g -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC "-I/usr +/lib/perl/5.14/CORE" myclass.cpp ar cr libmyclass.a myclass.o unitTest.o : libmyclass.a make[1]: Verlasse Verzeichnis '/home/dr/Abby/XS/Mytest/myclass' make[1]: Betrete Verzeichnis '/home/dr/Abby/XS/Mytest/myclass' make[1]: Für das Ziel »all« ist nichts zu tun. make[1]: Verlasse Verzeichnis '/home/dr/Abby/XS/Mytest/myclass' g++ -c -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing - +pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FI +LE_OFFSET_BITS=64 -O2 -g -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" - +fPIC "-I/usr/lib/perl/5.14/CORE" Mytest.c Running Mkbootstrap for Mytest () chmod 644 Mytest.bs rm -f blib/arch/auto/Mytest/Mytest.so g++ -shared -O2 -g -L/usr/local/lib -fstack-protector Mytest.o -o bl +ib/arch/auto/Mytest/Mytest.so myclass/libmyclass.a \ \ chmod 755 blib/arch/auto/Mytest/Mytest.so cp Mytest.bs blib/arch/auto/Mytest/Mytest.bs chmod 644 blib/arch/auto/Mytest/Mytest.bs Manifying blib/man3/Mytest.3pm
    and this for make test
    make[1]: Betrete Verzeichnis '/home/dr/Abby/XS/Mytest/myclass' make[1]: Für das Ziel »all« ist nichts zu tun. make[1]: Verlasse Verzeichnis '/home/dr/Abby/XS/Mytest/myclass' PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/Mytest.t .. 1/2 # Failed test 'use Mytest;' # at t/Mytest.t line 12. # Tried to use 'Mytest'. # Error: Can't load '/home/dr/Abby/XS/Mytest/blib/arch/auto/Mytes +t/Mytest.so' for module Mytest: /home/dr/Abby/XS/Mytest/blib/arch/aut +o/Mytest/Mytest.so: undefined symbol: _ZN7MyClassD1Ev at /usr/lib/per +l/5.14/DynaLoader.pm line 184. # at (eval 4) line 2 # Compilation failed in require at (eval 4) line 2. # BEGIN failed--compilation aborted at (eval 4) line 2. Can't locate object method "new" via package "Mytest" at t/Mytest.t li +ne 14. # Looks like you planned 2 tests but ran 1. # Looks like you failed 1 test of 1 run. # Looks like your test exited with 255 just after 1. t/Mytest.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 2/2 subtests Test Summary Report ------------------- t/Mytest.t (Wstat: 65280 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 255 Parse errors: Bad plan. You planned 2 tests but ran 1. Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.03 cusr + 0.00 csys = 0.06 CPU) Result: FAIL Failed 1/1 test programs. 1/1 subtests failed. make: *** [test_dynamic] Fehler 255
        The following files are created: libmyclass.a myclass.o

        objdump

        dr@Marvin:~/Abby/XS/Mytest/myclass$ objdump -p myclass.o | grep MyCla +ss dr@Marvin:~/Abby/XS/Mytest/myclass$ objdump -p libmyclass.a | grep My +Class dr@Marvin:~/Abby/XS/Mytest/myclass$ objdump -p libmyclass.a In archive libmyclass.a: myclass.o: file format elf32-i386 unitTest.o: file format elf32-i386 dr@Marvin:~/Abby/XS/Mytest/myclass$ objdump -p myclass.o myclass.o: file format elf32-i386

        ldd -d ...

        dr@Marvin:~/Abby/XS/Mytest$ ldd -v /home/dr/Abby/XS/Mytest/blib/arch/a +uto/Mytest/Mytest.so linux-gate.so.1 => (0xb77b0000) libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb76b20 +00) libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7694000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb74e9000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb74bd000) /lib/ld-linux.so.2 (0xb77b1000) Version information: /home/dr/Abby/XS/Mytest/blib/arch/auto/Mytest/Mytest.so: libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6 libgcc_s.so.1 (GCC_3.0) => /lib/i386-linux-gnu/libgcc_s.so.1 libstdc++.so.6 (CXXABI_1.3) => /usr/lib/i386-linux-gnu/libstdc +++.so.6 libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib/i386-linux-gnu/libstd +c++.so.6 /usr/lib/i386-linux-gnu/libstdc++.so.6: libm.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libm.so.6 ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2 libgcc_s.so.1 (GCC_4.2.0) => /lib/i386-linux-gnu/libgcc_s.so.1 libgcc_s.so.1 (GLIBC_2.0) => /lib/i386-linux-gnu/libgcc_s.so.1 libgcc_s.so.1 (GCC_3.3) => /lib/i386-linux-gnu/libgcc_s.so.1 libgcc_s.so.1 (GCC_3.0) => /lib/i386-linux-gnu/libgcc_s.so.1 libc.so.6 (GLIBC_2.4) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.3.4) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.1) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.3) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.3.2) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.2) => /lib/i386-linux-gnu/libc.so.6 /lib/i386-linux-gnu/libgcc_s.so.1: libc.so.6 (GLIBC_2.2.4) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6 /lib/i386-linux-gnu/libc.so.6: ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2 ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2 ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2 /lib/i386-linux-gnu/libm.so.6: ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2 libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6 libc.so.6 (GLIBC_PRIVATE) => /lib/i386-linux-gnu/libc.so.6
        I can see what you are getting at, but what should I do now?