0

Building PHP from source on macOS (Ventura) I've installed ICU in a non-standard location and built the intl extension as a shared library.

I can run this by setting my non-standard location with an environment variable DYLD_FALLBACK_LIBRARY_PATH=/usr/local/php80/lib (Same technique as per the documented trick using LD_LIBRARY_PATH). However, I don't want to use environment variables. I won't muddy the waters here with why. I'd like to understand why the shared object intl.so is not looking in the configured location for the ICU library files.

In the Makefile I can see this line, which I assume defines linker flags:
INTL_SHARED_LIBADD = -Wl,-rpath,/usr/local/php80/lib -L/usr/local/php80/lib -licuio -licui18n -licuuc -licudata

This seems correct, but this is not where the extension is looking. Something is overriding it at runtime. It looks in some sensible locations like /usr/lib but also some bizarre places such as under /System/Volumes/Preboot/Cryptexes/OS which is not a path that I can see comes from the PHP build at all.

I also tried modifying the shared object's rpath using tools like install_name_tool but it makes no difference as the problem seems to be external.

I'm inclined to symlink the ICU libs into one of its search paths, but it's not a great solution. I could also just install ICU into /usr/local/lib but I like to keep my play things separate.

Does anyone know how to fix this properly?

Tim
  • 584
  • 2
  • 9
  • 20

0 Answers0