Question

How ought I build an XS perl module on OpenBSD when the requisite .so files are missing?

Background: On a vanilla OpenBSD 5.3 vm install, I'm unable to build a perl module which needs to link against -lpthread. pthread.a and pthread.so.Maj.Min do exist on the system.

However Makefile.PL is looking for pthread.so, which is absent. Is this ordinary for OpenBSD? (I can coerce the Makefile to link against pthread.a and things work just fine, as it happens.)

In a Redhat-ish Linux environment, I'd just install the right -devel RPM and go again. On OpenBSD, however, I'm missing something very basic about the development environment.

UPDATE The core problem was Dynaloader mis-detection of libraries inside Makefile.PL.

Was it helpful?

Solution

The Makefile is wrong, report the bug to the upstream. It never should look for a specific file. Look 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

Also, in OpenBSD you don't need install a -devel package. OpenBSD has the batteries included.

OTHER TIPS

While editing your Makefile.PL is one way to go, I generally see folks use link files to point generic library/executable names to version specific names.

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

This way things that want the 'latest' version can get it via the link & thinks that just care about major version can grab the most recent release of it's major version...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top