On Wed, Apr 10 2019, Kevin Lo <ke...@kevlo.org> wrote: > On Wed, Apr 10, 2019 at 03:48:04PM +0800, Kevin Lo wrote: >> >> Hi, >> >> When I run the command m17n-dump, I get an error: >> undefined reference to `libintl_bindtextdomain' >> >> The diff below links with intl correctly, ok? > > Here's the revised diff that fixes m17n-view as well.
There are indeed two problems, one with ld and libintl, another one with the detection of Xaw. Here's an alternate diff which, compared to yours: - adds -lintl only to the build of libm17n-core, since this is the library using bindtextdomain. I'd prefer this approach since it doesn't result in overlinking and it can be pushed upstream as is. - also removes -ldl from the build of libm17n - adds both /usr/X11R6 and /usr/local to CPPFLAGS/LDFLAGS, for consistency. No need to respect user CPPFLAGS, only LDFLAGS. - removes patch-configure, it's normal for libtool+autoconf to detect whether libdl.so is available/needed Tested on amd64 with both clang/ld.lld and gcc/ld.bfd. Does it work for you? Index: Makefile =================================================================== RCS file: /cvs/ports/misc/m17n/lib/Makefile,v retrieving revision 1.2 diff -u -p -r1.2 Makefile --- Makefile 28 Mar 2019 02:03:27 -0000 1.2 +++ Makefile 11 Apr 2019 18:32:56 -0000 @@ -3,6 +3,7 @@ COMMENT = multilingual text processing library DISTNAME = m17n-lib-${M17N_V} +REVISION = 0 SHARED_LIBS += m17n-core 0.0 # 4.2 SHARED_LIBS += m17n 0.0 # 4.2 @@ -11,11 +12,13 @@ SHARED_LIBS += m17n-gui 0.0 CATEGORIES = misc -WANTLIB += ICE SM X11 Xft Xrender Xt anthy anthydic c expat fontconfig -WANTLIB += freetype fribidi gd iconv jpeg lzma m otf png16 pthread -WANTLIB += tiff webp xcb xml2 z +WANTLIB += ICE SM X11 Xau Xaw Xdmcp Xext Xft Xmu Xpm Xrender Xt +WANTLIB += anthy anthydic c expat fontconfig freetype fribidi +WANTLIB += gd iconv intl jpeg lzma m otf png16 pthread tiff webp +WANTLIB += xcb xml2 z -LIB_DEPENDS = devel/libotf \ +LIB_DEPENDS = devel/gettext \ + devel/libotf \ devel/fribidi \ graphics/gd \ inputmethods/anthy \ @@ -25,7 +28,8 @@ BUILD_DEPENDS = textproc/ispell \ ${RUN_DEPENDS} RUN_DEPENDS = misc/m17n/db=${M17N_V} -CONFIGURE_ENV = LDFLAGS="-L${LOCALBASE}/lib ${LDFLAGS}" +CONFIGURE_ENV = CPPFLAGS="-I${X11BASE}/include -I${LOCALBASE}/include" \ + LDFLAGS="-L${X11BASE}/lib -L${LOCALBASE}/lib ${LDFLAGS}" LIBTOOL_FLAGS = --tag=disable-static SEPARATE_BUILD = Yes Index: patches/patch-configure =================================================================== RCS file: patches/patch-configure diff -N patches/patch-configure --- patches/patch-configure 26 Mar 2019 16:46:59 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -$OpenBSD: patch-configure,v 1.1.1.1 2019/03/26 16:46:59 sthen Exp $ - -Index: configure ---- configure.orig -+++ configure -@@ -16808,7 +16808,6 @@ if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-ldl $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -@@ -16912,7 +16911,6 @@ if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-ldl $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - Index: patches/patch-example_Makefile_in =================================================================== RCS file: /cvs/ports/misc/m17n/lib/patches/patch-example_Makefile_in,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-example_Makefile_in --- patches/patch-example_Makefile_in 26 Mar 2019 16:46:59 -0000 1.1.1.1 +++ patches/patch-example_Makefile_in 11 Apr 2019 18:32:56 -0000 @@ -1,5 +1,7 @@ $OpenBSD: patch-example_Makefile_in,v 1.1.1.1 2019/03/26 16:46:59 sthen Exp $ +- don't hardcode libdl + Index: example/Makefile.in --- example/Makefile.in.orig +++ example/Makefile.in Index: patches/patch-src_Makefile_in =================================================================== RCS file: patches/patch-src_Makefile_in diff -N patches/patch-src_Makefile_in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_Makefile_in 11 Apr 2019 18:32:56 -0000 @@ -0,0 +1,26 @@ +$OpenBSD$ + +- fix portable linking with libintl, see info '(gettext) src/Makefile' +- don't hardcode libdl + +Index: src/Makefile.in +--- src/Makefile.in.orig ++++ src/Makefile.in +@@ -566,7 +566,7 @@ libm17n_core_la_SOURCES = \ + textprop.h textprop.c \ + mtext-lbrk.c mtext-wseg.c + +-libm17n_core_la_LIBADD = @XML2_LD_FLAGS@ @THAI_WORDSEG_LD_FLAGS@ ++libm17n_core_la_LIBADD = @XML2_LD_FLAGS@ @THAI_WORDSEG_LD_FLAGS@ @LTLIBINTL@ + libm17n_core_la_LDFLAGS = -export-dynamic ${VINFO} + libm17n_la_SOURCES = \ + charset.h charset.c \ +@@ -576,7 +576,7 @@ libm17n_la_SOURCES = \ + mlocale.h locale.c \ + m17n.h m17n.c + +-libm17n_la_LIBADD = ${top_builddir}/src/libm17n-core.la -ldl ++libm17n_la_LIBADD = ${top_builddir}/src/libm17n-core.la + libm17n_la_LDFLAGS = -export-dynamic ${VINFO} + FLT_SOURCES = \ + internal-flt.h \ -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE