Grisha Levit <grishale...@gmail.com> writes: > On macOS, using a default configure (without --with-libintl-prefix) causes > link errors due to missing frameworks used by localename-unsafe: > > $ ./configure > ... > > $ grep -w -e LIBINTL -e USE_NLS config.status > S["USE_NLS"]="no" > S["LIBINTL"]="" > > $ make src/du V=1 > gcc -Wno-format-extra-args > -Wno-implicit-const-int-float-conversion > -Wno-tautological-constant-out-of-range-compare -g -O2 -o src/du > src/du.o src/show-date.o src/libver.a lib/libcoreutils.a > lib/libcoreutils.a > ld: warning: ignoring duplicate libraries: 'lib/libcoreutils.a' > Undefined symbols for architecture arm64: > "_CFGetTypeID", referenced from: > _gl_locale_name_default in > libcoreutils.a[183](libcoreutils_a-localename-unsafe.o) > "_CFPreferencesCopyAppValue", referenced from: > _gl_locale_name_default in > libcoreutils.a[183](libcoreutils_a-localename-unsafe.o) > "_CFStringGetCString", referenced from: > _gl_locale_name_default in > libcoreutils.a[183](libcoreutils_a-localename-unsafe.o) > "_CFStringGetTypeID", referenced from: > _gl_locale_name_default in > libcoreutils.a[183](libcoreutils_a-localename-unsafe.o) > "___CFConstantStringClassReference", referenced from: > in libcoreutils.a[183](libcoreutils_a-localename-unsafe.o) > "_kCFPreferencesCurrentApplication", referenced from: > _gl_locale_name_default in > libcoreutils.a[183](libcoreutils_a-localename-unsafe.o) > ld: symbol(s) not found for architecture arm64 > clang: error: linker command failed with exit code 1 (use -v to > see invocation) > make: *** [src/du] Error 1 > > OTOH, when USE_NLS is "yes", linking is fine because then $LIBINTL contains > $INTL_MACOSX_LIBS, and LDADD in src/local.mk always includes $(LIBINTL). > > The attached patch might be too complicated or the wrong approach but > addresses the issue for me.
Thanks for the patch. I noticed this too, but didn't get around to fixing it since it was not my focus. > +if !USE_NLS > +# for CFPreferencesCopyAppValue > +src_date_LDADD += @INTL_MACOSX_LIBS@ > +src_du_LDADD += @INTL_MACOSX_LIBS@ > +src_ls_LDADD += @INTL_MACOSX_LIBS@ > +src_pr_LDADD += @INTL_MACOSX_LIBS@ > +src_stat_LDADD += @INTL_MACOSX_LIBS@ > +src_uptime_LDADD += @INTL_MACOSX_LIBS@ > +endif > + I don't think the if !USE_NLS is needed, since it should be harmless to have duplicate link flags (even though Apple's ld likes to warn about it annoyingly). Collin