On Thu, 26 Aug 2021 15:30:49 +0000
Charlene Wendling <juliana...@posteo.jp> wrote:

> Hi,
> 
> Kanjipad is broken in the current macppc bulk:
> 
> > https://bin.charlenew.xyz/kanjipad.log
> 
> macppc does not inline sqrt(3) so it actually uses libm, unlike
> other archs [0]. I don't know why this has not happened before.
> 
> The below diff adds the necessary `-lm' linker flag to allow kanjipad
> to be built with lld on macppc [1]. While here i've refreshed WANTLIB.
> 
> The runtime is fine on macppc and amd64.
> 
> OK? 

ok gkoehler@

This has not happened before, because ld.bfd linked kanjipad to libm.
There was no -lm, but there is -lgtk-x11-2.0 (in `pkg-config --libs
gtk+-2.0`), and libgtk-x11-2.0 is linked to libm:

$ ldd /usr/local/lib/libgtk-x11-2.0.so.2400.0 | grep libm

This might cause ld.bfd to add -lm after -lgtk-x11-2.0, so ld.bfd
finds sqrt, but lld fails, "ld: error: undefined symbol: sqrt"

Other "undefined symbol" errors happened when amd64 switched to lld,
https://marc.info/?l=openbsd-ports&m=154015655305933&w=2

--George

> Charlène.
> 
> 
> [0] https://marc.info/?l=openbsd-ports&m=161299356616167&w=2
> [1] https://bin.charlenew.xyz/kanjipad_fixed.log
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/japanese/kanjipad/Makefile,v
> retrieving revision 1.20
> diff -u -p -u -p -r1.20 Makefile
> --- Makefile  12 Jul 2019 21:02:22 -0000      1.20
> +++ Makefile  26 Aug 2021 15:20:48 -0000
> @@ -3,7 +3,7 @@
>  COMMENT=     Japanese handwriting recognition
>  
>  DISTNAME=    kanjipad-2.0.0
> -REVISION=    7
> +REVISION=    8
>  CATEGORIES=  japanese
>  
>  HOMEPAGE=    https://fishsoup.net/software/kanjipad/
> @@ -16,13 +16,18 @@ MASTER_SITES=     https://fishsoup.net/softw
>  WANTLIB += X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
>  WANTLIB += Xrandr Xrender atk-1.0 c cairo fontconfig freetype
>  WANTLIB += gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0 glib-2.0 gobject-2.0
> -WANTLIB += gtk-x11-2.0 intl m pango-1.0 pangocairo-1.0 pangoft2-1.0
> -WANTLIB += z
> +WANTLIB += gtk-x11-2.0 harfbuzz intl pango-1.0 pangocairo-1.0
> +WANTLIB += pangoft2-1.0 z
> +
> +# Needed for architectures not inlining sqrt(3), like powerpc
> +WANTLIB += m
>  
>  LIB_DEPENDS= devel/gettext,-runtime \
>               x11/gtk+2
>  
> -MAKE_FLAGS=OPTIMIZE='${CFLAGS}' PREFIX=${PREFIX}
> +MAKE_FLAGS=OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" PREFIX="${PREFIX}"
> +
> +LDFLAGS+=    -lm
>  
>  post-install:
>       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/kanjipad
> 


-- 
George Koehler <kern...@gmail.com>

Reply via email to