in reply to Re^2: How To Link -lperl to Extensions During Build
in thread How To Link -lperl to Extensions During Build

Hmm. Not sure what the correct approach might be, but here's one possible hack to try:

./Configure -des -Dprefix=/foo -Dcc=gcc -Duseshrplib make install; make distclean ./Configure -des -Dprefix=/foo -Dcc=gcc -Duseshrplib \ -Alddlflags='-shared -O2 -Wl,-E,-L/foo/lib/perl5/5.20.2/armv7l-linux +-android/CORE,-as-needed,-lperl,-no-as-needed' make install
This would compile and install perl twice, second time linking any shared objects against libperl. You may also want a ,-rpath,/foo... in the flags. But if you make a symlink in $KBOX/usr/lib to libperl.so, then neither -L nor -rpath should be required.

Replies are listed 'Best First'.
Re^4: How To Link -lperl to Extensions During Build
by cyd (Novice) on May 12, 2015 at 20:15 UTC

    Unfortunately make failed with the same error after running the simplified configure command.

    Regarding the suggestion above, are you suggesting that I run make install even though make fails?

      Well, this is totally convoluted. The build process does not use -lperl when compiling dynamic extensions. To make it happen, I tried something like this:

      ./Configure -des -Dprefix=/foo -Duseshrplib -Alddlflags="-shared -O2 - +Wl,-E,-L/foo/lib/perl5/5.20.2/armv7l-linux-android/CORE,-as-needed,-l +perl,-no-as-needed" make libperl.so COMMA=, SHRPLDFLAGS='$(subst $(COMMA)-lperl,,$(LDDLFLA +GS))' mkdir -p /foo/lib/perl5/5.20.2/armv7l-linux-android/CORE/ cp libperl.so /foo/lib/perl5/5.20.2/armv7l-linux-android/CORE/ make; make install
      Mind you, I don't actually have an android setup to play with...

        Whoa. That IS convoluted. I'll give it a shot...I think I can work around having to make the libperl.so and just use the one I have

        Well, I believe I've finally managed to link libperl with the module that is throwing the error

        readelf output for PL_re.so

        Dynamic section at offset 0x600c4 contains 23 entries: Tag Type Name/Value 0x00000001 (NEEDED) Shared library: [libperl.so] 0x00000001 (NEEDED) Shared library: [libc.so] 0x00000001 (NEEDED) Shared library: [libdl.so] 0x00000001 (NEEDED) Shared library: [libm.so]

        Unfortunately, the original error still persists

        make[1]: Leaving directory `/bld/perl/perl-5.20.2/dist/threads-shared' LD_LIBRARY_PATH=/bld/perl/perl\-5.20.2:/data/data/jackpal.androidterm/ +kbox2/lib ./perl -Ilib -f pod/buildtoc -q Can't load 'lib/5.20.2/armv7l-linux-android/auto/re/PL_re.so' for modu +le re: dlopen failed: cannot locate symbol "Perl_bytes_to_utf8" refer +enced by "PL_re.so"... at lib/5.20.2/armv7l-linux-android/DynaLoader. +pm line 218. at lib/5.20.2/Text/Wrap.pm line 58. Compilation failed in require at lib/5.20.2/Text/Wrap.pm line 58. BEGIN failed--compilation aborted at lib/5.20.2/Text/Wrap.pm line 58. Compilation failed in require at pod/buildtoc line 7. BEGIN failed--compilation aborted at pod/buildtoc line 7. make: *** [pod/perltoc.pod] Error 2

        Should I just post this to the perl-porters maillist

Re^4: How To Link -lperl to Extensions During Build
by cyd (Novice) on May 13, 2015 at 13:50 UTC

    This is in reply to AnonymousMonk's post...unfortunately the convoluted approach resulted in the same error

    However, I DID notice that for each extension built (? I'm guessing here), the following error was generated

    make config PERL_CORE=1 LIBPERL_A=libperl.so LINKTYPE=dynamic failed, continuing anyway...

    Unfortunately I;m new to perl so I don't know how to get the build to stop when this error occurs or what exactly is going on. I'll keep digging but feel free to chime in

      FYI...running make distclean cleared up the error in the previous reply, but the original error remains