Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#61464 closed defect (fixed)

php: modules fail to build with undefined symbols

Reported by: andy-yx-chen (Andy Chen) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur Cc: ohader (Oliver Hader), mssio (Mario Suharja), jonasjonas (Frank Hellenkamp), eljakim (Eljakim Schrijvers), nortcele, ugr, kirmorozov (Kirill Morozov), druidvav (Anton Vlasov)
Port: php

Description (last modified by jmroot (Joshua Root))

Looks like some c files were missing

Undefined symbols for architecture x86_64:
  "___zend_malloc", referenced from:
      _fontFetch in gdft.o
      _php_gd_gdCacheCreate in gdcache.o
      _php_gd_gdCacheGet in gdcache.o
  "__convert_to_string", referenced from:
      _zif_imagecreatefromstring in gd.o
  "__ecalloc", referenced from:
      __php_image_output_ctx in gd.o
      _php_gd_gdImageCreate in gd.o
      _php_gd_gdImageCreateTrueColor in gd.o
      _php_gd_gdImageFill in gd.o
      _php_gd_gdImageCreateFromGd2Ctx in gd_gd2.o
      _php_gd_gdImageCreateFromGd2PartCtx in gd_gd2.o
      __gd2GetHeader in gd_gd2.o
      ...
  "__efree", referenced from:
      _php_free_gd_font in gd.o
      _zif_imageloadfont in gd.o
      _zif_imagesetstyle in gd.o
      __php_image_create_from in gd.o
      __php_image_output in gd.o
      _php_imagepolygon in gd.o
      _php_imagechar in gd.o
      ...
  "__emalloc", referenced from:
      _zif_imageloadfont in gd.o
      _php_gd_gdImageCreate in gd.o
      _php_gd_gdImageCreateTrueColor in gd.o
      _php_gd_gdImageFilledPolygon in gd.o
      _php_gd_gdImageCopyResized in gd.o
      _php_gd_gdImageSetStyle in gd.o
      _gdImagePaletteToTrueColor in gd.o
      ...
  "__emalloc_1024", referenced from:
      _php_gd_gdImageStringFTEx in gdft.o
      _gdImageBmpCtx in gd_bmp.o
  "__emalloc_16", referenced from:
      __gdContributionsCalc in gd_interpolation.o
  "__emalloc_24", referenced from:
      _zif_imageloadfont in gd.o
      _php_gd_createwbmp in wbmp.o
      _php_gd_readwbmp in wbmp.o
  "__emalloc_32", referenced from:
      _php_gd_gdNewDynamicCtxEx in gd_io_dp.o
      _tweenColorFetch in gdft.o
  "__emalloc_768", referenced from:
      _php_gd_gdImageCreateFromPngCtx in gd_png.o
  "__emalloc_80", referenced from:
      _php_gd_gdNewDynamicCtxEx in gd_io_dp.o
      _php_gd_gdNewFileCtx in gd_io_file.o
      _php_gd_gdNewSSCtx in gd_io_ss.o
  "__emalloc_large", referenced from:
      _php_gd_gdImageCreateTrueColor in gd.o
  "__erealloc", referenced from:
      _php_gd_gdImageFilledPolygon in gd.o
      _gdReallocDynamic in gd_io_dp.o
      _gdImageCreateFromWebpCtx in gd_webp.o
      _gdImageTrueColorToPaletteBody in gd_topal.o
  "__estrdup", referenced from:
      _fontFetch in gdft.o
      _php_gd_gdImageXbmCtx in gd_xbm.o
  "__estrndup", referenced from:
      _php_imagechar in gd.o
  "__php_stream_cast", referenced from:
      __php_image_create_from in gd.o
  "__php_stream_copy_to_mem", referenced from:
      __php_image_create_from in gd.o
  "__php_stream_eof", referenced from:
      _zif_imageloadfont in gd.o
  "__php_stream_free", referenced from:
      _zif_imageloadfont in gd.o
      __php_image_create_from in gd.o
      __php_image_stream_ctxfreeandclose in gd.o
  "__php_stream_open_wrapper_ex", referenced from:
      _zif_imageloadfont in gd.o
      __php_image_create_from in gd.o
      __php_image_output_ctx in gd.o
  "__php_stream_read", referenced from:
      _zif_imageloadfont in gd.o
  "__php_stream_seek", referenced from:
      _zif_imageloadfont in gd.o
  "__php_stream_tell", referenced from:
      _zif_imageloadfont in gd.o
  "__php_stream_write", referenced from:
      __php_image_stream_putc in gd.o
      __php_image_stream_putbuf in gd.o
  "__safe_emalloc", referenced from:
      _zif_imagesetstyle in gd.o
      _php_imagepolygon in gd.o
      _php_gd_gdImageFill in gd.o
      __gdImageGd2 in gd_gd2.o
      _php_gd_gdImageCreateFromPngCtx in gd_png.o
      _php_gd_gdImagePngCtxEx in gd_png.o
      _php_gd_gdImageJpegCtx in gd_jpeg.o
      ...
  "__zend_new_array_0", referenced from:
      _zif_gd_info in gd.o
      _zif_imagecolorsforindex in gd.o
      _zif_imagegetclip in gd.o
      _php_imagettftext_common in gd.o
      _zif_imageaffinematrixget in gd.o
      _zif_imageaffinematrixconcat in gd.o
      _zif_imageresolution in gd.o
      ...
  "_add_assoc_bool_ex", referenced from:
      _zif_gd_info in gd.o
  "_add_assoc_long_ex", referenced from:
      _zif_imagecolorsforindex in gd.o
  "_add_assoc_string_ex", referenced from:
      _zif_gd_info in gd.o
  "_add_index_double", referenced from:
      _zif_imageaffinematrixget in gd.o
      _zif_imageaffinematrixconcat in gd.o
  "_add_next_index_long", referenced from:
      _zif_imagegetclip in gd.o
      _php_imagettftext_common in gd.o
      _zif_imageresolution in gd.o
  "_ap_php_snprintf", referenced from:
      _zm_info_gd in gd.o
      _php_gd_gdImageJpegCtx in gd_jpeg.o
      _fontFetch in gdft.o
  "_display_ini_entries", referenced from:
      _zm_info_gd in gd.o
  "_executor_globals", referenced from:
      _php_find_gd_font in gd.o
  "_php_check_open_basedir", referenced from:
      __php_image_output in gd.o
      _php_imagettftext_common in gd.o
      __php_image_convert in gd.o
  "_php_error_docref0", referenced from:
      _zif_imageloadfont in gd.o
      _zif_imagesetstyle in gd.o
      _zif_imagecreatetruecolor in gd.o
      _zif_imagetruecolortopalette in gd.o
      _zif_imagecolormatch in gd.o
      _zif_imagecreate in gd.o
      _zif_imagecreatefromstring in gd.o
      ...
  "_php_file_le_pstream", referenced from:
      __php_image_output_ctx in gd.o
  "_php_file_le_stream", referenced from:
      __php_image_output_ctx in gd.o
  "_php_info_print_table_end", referenced from:
      _zm_info_gd in gd.o
  "_php_info_print_table_row", referenced from:
      _zm_info_gd in gd.o
  "_php_info_print_table_start", referenced from:
      _zm_info_gd in gd.o
  "_php_open_temporary_file", referenced from:
      __php_image_output in gd.o
  "_php_sig_bmp", referenced from:
      _zif_imagecreatefromstring in gd.o
  "_php_sig_gif", referenced from:
      _zif_imagecreatefromstring in gd.o
  "_php_sig_jpg", referenced from:
      _zif_imagecreatefromstring in gd.o
  "_php_sig_png", referenced from:
      _zif_imagecreatefromstring in gd.o
  "_php_sig_riff", referenced from:
      _zif_imagecreatefromstring in gd.o
  "_php_sig_webp", referenced from:
      _zif_imagecreatefromstring in gd.o
  "_php_stream_stdio_ops", referenced from:
      __php_image_create_from in gd.o
  "_php_verror", referenced from:
      _php_gd_error_method in gd.o
  "_php_write", referenced from:
      __php_image_output in gd.o
      __php_image_output_putc in gd.o
      __php_image_output_putbuf in gd.o
  "_zend_error", referenced from:
      _gdImageCreateFromWebpCtx in gd_webp.o
      _gdImageWebpCtx in gd_webp.o
  "_zend_fetch_resource", referenced from:
      _zif_imagesetstyle in gd.o
      _zif_imageistruecolor in gd.o
      _zif_imagetruecolortopalette in gd.o
      _zif_imagepalettetotruecolor in gd.o
      _zif_imagecolormatch in gd.o
      _zif_imagesetthickness in gd.o
      _zif_imagefilledellipse in gd.o
      ...
  "_zend_fetch_resource2_ex", referenced from:
      __php_image_output_ctx in gd.o
  "_zend_hash_index_find", referenced from:
      _php_imagepolygon in gd.o
      _zif_imageconvolution in gd.o
      _zif_imageaffine in gd.o
      _zif_imageaffinematrixconcat in gd.o
      _php_find_gd_font in gd.o
  "_zend_hash_str_find", referenced from:
      _zif_imagecrop in gd.o
      _zif_imageaffine in gd.o
      _zif_imageaffinematrixget in gd.o
  "_zend_ini_long", referenced from:
      __php_image_create_from in gd.o
      __php_image_convert in gd.o
  "_zend_list_close", referenced from:
      _zif_imagedestroy in gd.o
  "_zend_list_insert", referenced from:
      _zif_imageloadfont in gd.o
  "_zend_parse_arg_long_slow", referenced from:
      _zif_imagecolorat in gd.o
      _zif_imagesetpixel in gd.o
  "_zend_parse_parameters", referenced from:
      _zif_imageloadfont in gd.o
      _zif_imagesetstyle in gd.o
      _zif_imagecreatetruecolor in gd.o
      _zif_imageistruecolor in gd.o
      _zif_imagetruecolortopalette in gd.o
      _zif_imagepalettetotruecolor in gd.o
      _zif_imagecolormatch in gd.o
      ...
  "_zend_register_ini_entries", referenced from:
      _zm_startup_gd in gd.o
  "_zend_register_list_destructors_ex", referenced from:
      _zm_startup_gd in gd.o
  "_zend_register_long_constant", referenced from:
      _zm_startup_gd in gd.o
  "_zend_register_resource", referenced from:
      _zif_imagecreatetruecolor in gd.o
      _zif_imagerotate in gd.o
      _zif_imagecreate in gd.o
      _zif_imagecreatefromstring in gd.o
      __php_image_create_from in gd.o
      _zif_imagecrop in gd.o
      _zif_imagecropauto in gd.o
      ...
  "_zend_register_string_constant", referenced from:
      _zm_startup_gd in gd.o
  "_zend_strndup", referenced from:
      __php_image_create_from in gd.o
  "_zend_vspprintf", referenced from:
      _error in gdkanji.o
      _php_gd_gdCtxPrintf in gd_xbm.o
  "_zend_wrong_param_count", referenced from:
      _php_imagettftext_common in gd.o
      _zif_imagefilter in gd.o
  "_zend_wrong_parameter_type_error", referenced from:
      _zif_imagecolorat in gd.o
      _zif_imagesetpixel in gd.o
  "_zend_wrong_parameters_count_error", referenced from:
      _zif_imagecolorat in gd.o
      _zif_imagesetpixel in gd.o
  "_zend_wrong_parameters_none_error", referenced from:
      _zif_gd_info in gd.o
      _zif_imagetypes in gd.o
  "_zval_get_double_func", referenced from:
      _php_imagettftext_common in gd.o
      _zif_imageconvolution in gd.o
      _zif_imageaffine in gd.o
      _zif_imageaffinematrixget in gd.o
      _zif_imageaffinematrixconcat in gd.o
  "_zval_get_long_func", referenced from:
      _zif_imagesetstyle in gd.o
      _php_imagepolygon in gd.o
      _zif_imagecrop in gd.o
      _zif_imageaffine in gd.o
ld: symbol(s) not found for architecture x86_64

Attachments (3)

xdebug-main.log (175.3 KB) - added by kirmorozov (Kirill Morozov) 3 years ago.
xdebug build log
curl-main.log (81.8 KB) - added by kirmorozov (Kirill Morozov) 3 years ago.
curl build log
build-libtool.m4.diff (1.2 KB) - added by kirmorozov (Kirill Morozov) 3 years ago.
Working patch for php 7.3 and 7.4

Download all attachments as: .zip

Change History (40)

comment:1 Changed 3 years ago by jmroot (Joshua Root)

Description: modified (diff)
Keywords: php73-gd removed
Owner: set to ryandesign
Status: newassigned

Please add the complete log as an attachment.

comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ohader added
Keywords: bigsur added
Port: php added; php73-gd removed
Status: assignedaccepted
Summary: php73-gd failed to build on MacOS11php: modules fail to build with undefined symbols

Has duplicate #61466. Probably the usual libtool bug with macOS 11+, for which there is a patch in the libtool port that can probably be copied to php.

comment:3 Changed 3 years ago by ohader (Oliver Hader)

Can you please point me to the corresponding patch for libtool you mentioned? Thx in advance!

Last edited 3 years ago by ohader (Oliver Hader) (previous) (diff)

comment:5 Changed 3 years ago by ohader (Oliver Hader)

I failed applying a similar approach to generated configure files of any of these PHP extensions - basically due to my lack of knowledge on Macports details. Looking forward to to any update or suggestion on this topic. Thx in advance!

comment:6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

No worries, I'll take a look at it. Many, many ports fail to build on macOS 11 with similar errors so we have a lot of work to do and are going as fast as we can.

comment:7 Changed 3 years ago by elcheco (Miroslav Koula)

I found out yesterday the same - php74, php74-apache2handler and php74-fpm - works, but all other php74-[extensions] ports are dying on the same message above. Than you @ryandesign to take care about it ;-)

Last edited 3 years ago by elcheco (Miroslav Koula) (previous) (diff)

comment:8 Changed 3 years ago by eljakim (Eljakim Schrijvers)

if it's a know issue, and it's just a matter of spending time going through the php74-extension ports, please let me know if I can do anything to help.

comment:9 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

It's known, in that it is reported in this ticket, and in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44605.

It is unlikely that many or any changes are needed in individual extensions, but rather that changes are needed to m4 files installed by the php74 etc ports.

Last edited 3 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:10 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: mssio added

Has duplicate #61519.

comment:11 Changed 3 years ago by jonasjonas (Frank Hellenkamp)

Cc: jonasjonas added

comment:12 Changed 3 years ago by eljakim (Eljakim Schrijvers)

Cc: eljakim added

comment:13 Changed 3 years ago by nortcele

Cc: nortcele added

comment:14 Changed 3 years ago by ugr

Cc: ugr added

comment:15 Changed 3 years ago by kirmorozov (Kirill Morozov)

Hi @ryandesign, How can I help with PHP extensions?

Is it just an issue of libtool? Give me a hint, I'll make PR for extensions I use.

Changed 3 years ago by kirmorozov (Kirill Morozov)

Attachment: xdebug-main.log added

xdebug build log

Changed 3 years ago by kirmorozov (Kirill Morozov)

Attachment: curl-main.log added

curl build log

comment:16 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Thank you, more logs are not necessary. Fixes are not needed in individual extensions. Probably just the m4 files installed by php74, php73, etc need to be fixed.

comment:17 Changed 3 years ago by kirmorozov (Kirill Morozov)

Cc: kirmorozov added

comment:18 Changed 3 years ago by kirmorozov (Kirill Morozov)

@ryandesign Are you talking about aclocal.m4 ? for php 7.2 it is the only one which has following:

 10.*)
     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
Last edited 3 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:19 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

php74 for example installs /opt/local/lib/php74/build/libtool.m4.

comment:20 Changed 3 years ago by kirmorozov (Kirill Morozov)

How good would be a patch for build/libtool.m4 ?

I'm going to open PR for 7.3 and 7.4, 7.2 goes out of support at the end of month.

comment:21 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

I will do the patch. I continue to support down to php52, although at present php72 and earlier do not build with Xcode 12.

Changed 3 years ago by kirmorozov (Kirill Morozov)

Attachment: build-libtool.m4.diff added

Working patch for php 7.3 and 7.4

comment:22 Changed 3 years ago by kirmorozov (Kirill Morozov)

Pushing patch to PHP itself soon. https://bugs.php.net/bug.php?id=80393

comment:23 Changed 3 years ago by radarhere (Andrew Murray)

Cc: radarhere added

comment:24 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

In 6b30a5c5063418e87f8ce46971f0f93c7723cddc/macports-ports (master):

php-1.1.tcl: Use deployment target 10.16 on macOS 11

See: #61464

comment:25 Changed 3 years ago by eljakim (Eljakim Schrijvers)

One port does not build:

  • php74-imap

I have tested the following other ports, and they all build fine now:

  • php74-exif
  • php74-gd
  • php74-iconv
  • php74-imagick
  • php74-imap
  • php74-intl
  • php74-ldap
  • php74-mbstring
  • php74-mysql
  • php74-openssl
  • php74-pcntl
  • php74-pdflib
  • php74-posix
  • php74-redis
  • php74-soap
  • php74-sqlite
  • php74-timezonedb
  • php74-xdebug
  • php74-xsl
  • php74-zip
  • php74-curl
  • php74-igbinary
Last edited 3 years ago by eljakim (Eljakim Schrijvers) (previous) (diff)

comment:26 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

It seemed simpler to just change the deployment target value in a central place rather than require everyone to rebuild the main php ports. We might want to apply this same fix to MacPorts as a whole until things settle down; see #61584.

The imap extension can't start to build until its dependency cclient is fixed to build with Xcode 12+. I'm working on that now.

comment:27 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

In c6db7368fae32790f43bdb10496981c13938ef2f/macports-ports (master):

cclient: Fix implicit function decls; cleanup

Fix implicit declaration of functions.

See: #61464#comment:26

Rename patchfiles to clarify their purpose and defuzz them.

Modernize portfile.

Use MacPorts CFLAGS (including optimization flags) so increase the
revision to rebuild.

comment:28 Changed 3 years ago by radarhere (Andrew Murray)

Cc: radarhere removed

comment:29 Changed 3 years ago by ohader (Oliver Hader)

Thx for your great work! Sharing my experience on additional ports

  • successful: php74-gmp, php74-sockets, php74-sodium, php74-sqlite, php74-xdebug
  • failed: php74-mcrypt due to a problem building libmcrypt

comment:30 Changed 3 years ago by druidvav (Anton Vlasov)

Thanks for the fixes! Still not building: php74-geoip, php74-imagick, php74-ssh2, php74-zip

php74-memcached not building due to error in umem

comment:31 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

This ticket was about the problem that php's libtool.m4 has the macOS 11 deployment target bug. It was fixed by forcing the use of the 10.16 deployment target.

The additional issues that are now being reported here are separate problems that each need separate solutions and should be filed in separate tickets so that they can be investigated and tracked individually.

comment:32 in reply to:  30 ; Changed 3 years ago by kirmorozov (Kirill Morozov)

Built fine, try 'port clean php74-imagick'

UMEM has same issue with its m4 config.

  10.*)
               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'

Replying to druidvav:

Thanks for the fixes! Still not building: php74-geoip, php74-imagick, php74-ssh2, php74-zip

php74-memcached not building due to error in umem

Last edited 3 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:33 in reply to:  32 Changed 3 years ago by druidvav (Anton Vlasov)

Replying to kirmorozov:

Built fine, try 'port clean php74-imagick'

My bad, cleaning fixed my issues. Only problem with umem remains.

comment:34 Changed 3 years ago by druidvav (Anton Vlasov)

I've opened ticket for umem bug: #61629

Thanks!

Last edited 3 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:35 Changed 3 years ago by druidvav (Anton Vlasov)

Cc: druidvav added

comment:36 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

comment:37 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

In a64d89a2a083631a51e4b0ffaa0c51843221ccee/macports-ports (master):

php: Fix macOS 11+ libtool bug the right way

php (the CLI SAPI) installs a libtool.m4 file that gets used to build
php extensions. php 7.4 and later already have an upstream fix for the
macOS 11+ libtool bug. Backport that patch to earlier php versions
rather than using the fake deployment target 10.16 workaround.

See: #61464

Note: See TracTickets for help on using tickets.