Creating a Perl Extension Module on OpenBSD

How do I create a Perl XS module on OpenBSD if the required .so files are missing?

Background: on vanilla OpenBSD 5.3 vm install, I cannot create a perl module that needs to be associated with -lpthread . pthread.a and pthread.so.Maj.Min exist on the system.

However, Makefile.PL is looking for pthread.so , which is missing. Is this common with OpenBSD? (I can get the Makefile to contact pthread.a, and everything works just fine, as it happens.)

In the Redhat-ish Linux environment, I just installed the correct -devel RPM and ran it again. However, in OpenBSD, I am missing something very common in the development environment.

UPDATE . The main problem was the incorrect detection of the Dynaloader library inside Makefile.PL.

+4
source share
2 answers

Makefile is invalid, report an error in the upstream. It should never search for a specific file. Check out this example:

 $ cat test.c int main(){ return 0; } $ gcc -lpthread -o test test.c $ ldd test test: Start End Type Open Ref GrpRef Name 00000c4321600000 00000c4321a02000 exe 1 0 0 test 00000c4521f63000 00000c4522374000 rlib 0 2 0 /usr/lib/libpthread.so.17.1 00000c4524c1c000 00000c4525103000 rlib 0 1 0 /usr/lib/libc.so.68.2 00000c452a100000 00000c452a100000 rtld 0 1 0 /usr/libexec/ld.so 

In addition, in OpenBSD you do not need to install the -devel package. An OpenBSD battery has batteries.

0
source

When editing Makefile.PL is one of the ways I usually see people use link files to specify shared libraries / executables for version-specific names.

 For Example: pthread.so -> pthread.so.maj.min pthread.so.maj -> pthread.so.maj.min 

Thus, things that want to get the "latest" version can be obtained by reference and think that just taking care of the main version can capture the latest version of its main version ...

0
source

Source: https://habr.com/ru/post/1482173/


All Articles