Undefined symbols for architecture x86_64

Ryan Schmidt ryandesign at macports.org
Mon Sep 17 13:58:12 UTC 2018

On Sep 17, 2018, at 08:33, Mark Brethen wrote:

> I’m getting the following error when trying to build current snapshot of reduce-csl:
> :info:build Undefined symbols for architecture x86_64:
> :info:build   "_libintl_dgettext", referenced from:
> :info:build       _FcConfigFileInfoIterGet in libfontconfig.a(fccfg.o)
> :info:build ld: symbol(s) not found for architecture x86_64
> :info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
> :info:build make[3]: *** [csl] Error 1
> :info:build make[2]: *** [all] Error 2
> gettext @
> fontconfig @2.13.1_0 are installed.

Let's see. FcConfigFileInfoIterGet is a fontconfig function, and it is apparently using libintl_dgettext which is a gettext function, and it is presumably undefined because the gettext library (libintl) has not been included on the link line.

You could try adding "-lintl" to configure.ldflags when you build reduce-csl and see if that helps.

If I run "pkg-config fontconfig --libs" I see "-L/opt/local/lib -lfontconfig -lfreetype" -- it doesn't mention "-lintl". If fontconfig requires libintl, then that's a bug in fontconfig's fontconfig.pc file.

It looks like you might be linking with the fontconfig static library (libfontconfig.a); if so, try linking with the dynamic library (libfontconfig.dylib) instead; maybe that solves the problem too, and if so, that would be the preferred solution. On macOS and in MacPorts we prefer dynamic linking over static linking.

More information about the macports-dev mailing list