Skip to content

Conversation

@NattyNarwhal
Copy link
Member

The version of libtool we're using is old enough to vote, and occasionally issues crop up related to it (i.e. this should fix GH-17310 incidentally). Update it to the latest version from upstream (serial 63 from 2.5.4). I don't believe we carry any patches that don't just replicate fixes in newer versions, so it should be OK to just use upstream's version. Newer libtool has more files that we have to include manually if not using aclocal, and some macro names were changed, so adapt to this.

Tested on linux/ppc64 and macos/arm64, with autoconf 2.72. I'm a little worried about the impact this might have on other platforms since this is a major bump. In particular, AIX might be turbulent, since library naming conventions changed a lot in libtool.

This now comes with some extra files that libtool seems to need;
normally aclocal handles this for you, but we don't use aclocal.
@jordikroon
Copy link
Contributor

Nice work! I can't judge if this will give other side effect. But I can confirm that this will resolve the $PATH quotation issue.

If merged PR #21065 will be obsolete.

@iluuu1994
Copy link
Member

Previous attempt: GH-13476. /cc @petk

@petk
Copy link
Member

petk commented Jan 29, 2026

Hello, we can try updating this, yes.

In my PR (#13476) I've tried to avoid having multiple libtool m4 files for simplicity - there they are merged into a single m4 file. Otherwise, scripts/phpize.m4 and scripts/phpize.in would also need to be adjusted for this a bit further. And, probably having some basic updating script for libtool would be useful probably here.

Otherwise, another thing we can try here is to remove all libtool related files in php-src and use the libtoolize tool, which kind of comes with standard Autotools build system. The reason libtool was bundled into PHP was that it was once a very buggy tool and there were constant issues on some systems libtoolize approach didn't work. But this might be very different story today.

@NattyNarwhal
Copy link
Member Author

Otherwise, scripts/phpize.m4 and scripts/phpize.in would also need to be adjusted for this a bit further.

Did it this way, since I want to keep closer to libtool upstream.

And, probably having some basic updating script for libtool would be useful probably here.

Working on a script to update autotools stuff. WRT last paragraph. if we do want to stop vendoring libtool, said script would be useful as a basis for how we want to invoke libtoolize.

@petk
Copy link
Member

petk commented Jan 30, 2026

Can you please also mention in the final commit message some of these:

The libtool 1.5.26 is bundled with PHP since the very early days of the
Autotools build system to ease the building process and avoid additional
dependency on the system Libtool. This updates the bundled libtool to
2.5.4 version.

Fixes and implementations:

- Fixed race conditions when building PHP in parallel ("cannot create
  .libs" warnings).
- Implements request #70374 (Update libtool.m4)

Changes:
- On macOS linker now uses -undefined dynamic_lookup flag for shared
  extensions and shared embed SAPI (libphp) instead of older
  '-undefined suppress -flat_namespace' combination.

And please rename the scripts/dev/update-libtool to scripts/dev/update-libtool.sh. Those config.guess and config.sub updates aren't exactly part of libtool. I'm not sure this belongs here.

@petk
Copy link
Member

petk commented Jan 30, 2026

Here, I'd suggest to also recheck if these two code snippets AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [ are still relevant for libtool 2.5.4+ in phpize.m4 and configure.ac files. Last time I wasn't able to reproduce this issue and I think that could be removed. But I'm not sure.

Per https://autotools.info/autoconf/macros.html, the plural macro is
only available is autoconf 2.70, whereas the previous one is in 2.58.
We need to set it so that libtoolize copies things into the right place.
@NattyNarwhal
Copy link
Member Author

Here, I'd suggest to also recheck if these two code snippets AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [ are still relevant for libtool 2.5.4+ in phpize.m4 and configure.ac files. Last time I wasn't able to reproduce this issue and I think that could be removed. But I'm not sure.

This doesn't seem to be necessary anymore:

"Configuring libtool" output with CXX=false ./configure --disable-all
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /opt/local/bin/gsed
checking for fgrep... /opt/local/bin/ggrep -F
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /opt/local/bin/nm -B
checking the name lister (/opt/local/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 786432
checking how to convert aarch64-apple-darwin25.2.0 file names to aarch64-apple-darwin25.2.0 format... func_convert_file_noop
checking how to convert aarch64-apple-darwin25.2.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ranlib... ranlib
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for gawk... (cached) awk
checking command to parse /opt/local/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... ld: warning: -single_module is obsolete
no
checking for -no_fixup_chains linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common -DPIC
checking if cc PIC flag -fno-common -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin25.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... cpp
checking whether the false linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... no
libtool.m4: error: problem compiling CXX test program
checking for false option to produce PIC...  -DPIC
checking if false PIC flag  -DPIC works... no
checking if false static flag  works... no
checking if false supports -c -o file.o... no
checking if false supports -c -o file.o... (cached) no
checking whether the false linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... no
checking dynamic linker characteristics... darwin25.2.0 dyld
checking how to hardcode library paths into programs... immediate

I'll remove them then.

NattyNarwhal added a commit to NattyNarwhal/php-src that referenced this pull request Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

./configure producing errors on macOS

4 participants