0

I can load my library through the FFI on x86_64 but not on AArch64.

FFI::cdef(
    /* ... */, 
    $root . './build/libuplink.so'
);
PHP Fatal error:  Uncaught FFI\Exception: Failed loading '/home/linaro/uplink-php/build/libuplink.so' in /home/linaro/uplink-php/src/Uplink.php:37
Stack trace:
#0 /home/linaro/uplink-php/src/Uplink.php(37): FFI::cdef()
#1 /home/linaro/uplink-php/index.php(28): Storj\Uplink\Uplink::create()
#2 {main}
  thrown in /home/linaro/uplink-php/src/Uplink.php on line 37

This is the library type (compiled for ARMv8 with Cgo):

$ file build/libuplink.so 
build/libuplink.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=50fa8518936b2e258f62d09d3ae9bed0c4686b9d, stripped

System info:

$ uname -a
Linux linaro-alip 5.9.0-qcomlt-arm64 #138 SMP PREEMPT Sat Nov 21 00:47:13 UTC 2020 aarch64 GNU/Linux
$ php -v
PHP 7.4.16 (...)

Has anyone ever even tried this and got it working?

Erik van Velzen
  • 6,211
  • 3
  • 23
  • 23

1 Answers1

0

I have tried with a toy example and it works.

Probably it is not an issue with PHP, rather with cgo not assembling the shared library correctly.

Erik van Velzen
  • 6,211
  • 3
  • 23
  • 23