Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross compiling perl for Android ld.lld: error: unable to find library -lpthread

Tags:

c++

android

perl

Good day,

I'm following this tutorial to cross compile perl for Android Compiling Perl for Android Unfortunately I got stuck when running the Configure Script in the Perl directory:

Checking your choice of C compiler and flags for coherency...

I've tried to compile and run the following simple program:

#include <stdio.h>
int main() { printf("Ok\n"); return(0); }

I used the command:

/home/janny/Android/Sdk/ndk/26.2.11394342/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android23-clang -o try -O2 -fno-strict-aliasing -pipe -fstack-protector-strong -fstack-protector-strong try.c -lpthread -ldl -lm -lcrypt -lutil -lc -llog
/home/janny/perl-5.38.2/Cross/run-adb-shell ./try

and I got the following output:

ld.lld: error: unable to find library -lpthread
ld.lld: error: unable to find library -lcrypt
ld.lld: error: unable to find library -lutil
clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
I can't compile the test program.
You have a BIG problem.  Shall I abort Configure [y]  
Ok.  Stopping Configure.

I'm trying to compile it on ubuntu-22.04.4 and as a windows only user I'm a bit lost here. I already tried installing the pthread lib using:

apt install libpthread-stubs0-dev

But the error persists.

like image 669
JayTee Avatar asked Dec 01 '25 16:12

JayTee


1 Answers

I found out about: https://arsv.github.io/perl-cross/usage.html You simply unpack the files on top of the perl distribution and are ready to go.

like image 116
JayTee Avatar answered Dec 03 '25 07:12

JayTee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!