[PHP] Can't compile php agent in ARM architecture

Hi, i’ve to install php agent on Ubuntu 20.04 and php7.4-fpm with ARM architecture. I’ve tried to compile from source but failed with this error:

make[1]: Entering directory '/root/src/newrelic-php-agent/axiom'
fatal: not a git repository (or any of the parent directories): .git
cc -DNR_SYSTEM_LINUX=1 -DHAVE_ALLOCA_H=1 -DHAVE_BACKTRACE=1 -DHAVE_DEV_FD=1 -DHAVE_PROC_SELF_FD=1 -DHAVE_PTHREAD_MUTEX_ERRORCHECK=1 -DHAVE_REALLOCARRAY=1  -std=gnu99 -fPIC -DPIC -pthread -Wall -Werror -Wextra -Wbad-function-cast -Wcast-qual -Wdeclaration-after-statement -Wformat -Wformat-security -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wno-write-strings -Wpointer-arith -Wshadow -Wstrict-prototypes -Wswitch-enum  -I/root/src/newrelic-php-agent/vendor/local/include  -O0 -g3 -DENABLE_TESTING_API -MMD -MP -c nr_span_encoding.c -o nr_span_encoding.o
In file included from nr_span_encoding.c:9:
nr_span_encoding_private.h:13:10: fatal error: v1.pb-c.h: No such file or directory
   13 | #include "v1.pb-c.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:175: nr_span_encoding.o] Error 1
make[1]: Leaving directory '/root/src/newrelic-php-agent/axiom'
make: *** [Makefile:253: axiom] Error 2

I hope you can help me :slight_smile:
Thank you

Hi @matteo2, welcome to the Explorers Hub! :slightly_smiling_face:

Have you tried reading through the PHP/Ubuntu Installation documentation?

I would suggest giving it a quick read through just to make sure you haven’t missed anything. If you’re still having this issue, let me know and we can take a further look into this issue for you!

Hi,
sure, but i’ve ARM64 architecture, when run apt update:

N: Skipping acquire of configured file ‘non-free/binary-arm64/Packages’ as repository ‘http://apt.newrelic.com/debian newrelic InRelease’ doesn’t support architecture ‘arm64’

Thanks

Tried the same, got the same result :slight_smile:

Hello all,

I believe a better reference point for starting with this would be our development guide for the recently open-sourced Agent: https://github.com/newrelic/newrelic-php-agent/blob/main/docs/development.md

Seeing as ARM isn’t one of our officially supported architectures, I want to call out that there is likely additional work needed to compile the Agent on ARM, and we don’t have specific guidance for that architecture. That being said, if you can get this working, I am sure the community would love to know how you did it!

Addendum to my comment above: one of our engineers did chime in and pointed out that running make with -j 8 or -j 4 may provide enough parallelism to get around the problem you’re experiencing. There is also a fix in this PR that may address it if you want to apply it manually:

1 Like

Thank you, now it works!

Great to hear @matteo2!