Opened 4 years ago

Closed 4 years ago

#62322 closed defect (fixed)

freeimage: undefined symbols for _png_init_filter_functions_neon

Reported by: platipodium (Carsten Lemmen) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: arm64 Cc:
Port: freeimage

Description

When trying to build on Apple Silicon I get a build failure at linker stage:

:info:build Undefined symbols for architecture arm64:
:info:build   "_png_init_filter_functions_neon", referenced from:
:info:build       _png_read_filter_row in pngrutil.o
:info:build ld: symbol(s) not found for architecture arm64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make: *** [libfreeimage.3.18.0.dylib] Error 1

Attachments (1)

freeimage.main.log (479.1 KB) - added by platipodium (Carsten Lemmen) 4 years ago.

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by platipodium (Carsten Lemmen)

Attachment: freeimage.main.log added

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: aarch64 removed

Indeed, curious, it builds on macOS 11 x86_64 but not on macOS 11 arm64. Usually undefined symbols are the result of a libtool bug that affects macOS 11 regardless of architecture, so this must have a different cause.

Note that freeimage uses a bundled copy of libpng, not MacPorts libpng.

comment:2 Changed 4 years ago by jmroot (Joshua Root)

The missing symbol name contains "neon", which is the name of the ARM SIMD instruction set.

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

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

Hm no that's not it. That upstream issue was fixed in libpng 1.6.15. freeimage includes libpng 1.6.35.

The problem is more that libpng decides at configure time what sources to build, but freeimage does not use a configure script and has a hardcoded list of sources to build (in Makefile.srcs). The hardcoded list of sources is evidently correct for Intel but wrong for ARM, at least when ARM optimizations are enabled, which they are unless we specify otherwise.

We could either tell the png source not to use ARM optimizations (put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS) or we could add the required ARM-specific source files to Makefile.srcs. The first is probably easier, especially since the version of libpng bundled with freeimage is missing the entire arm directory that contains the source files that define the png_init_filter_functions_neon function.

comment:5 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Resolution: fixed
Status: newclosed

In f58e59af95281857329bb6ef08ececbc2ac64183/macports-ports (master):

freeimage: Fix build on arm64 by disabling NEON

Closes: #62322

Note: See TracTickets for help on using tickets.