[Buildroot] [PATCH v3] package/mupdf: fix building with mips toolchains

Arnout Vandecappelle arnout at mind.be
Tue Oct 5 19:33:21 UTC 2021



On 27/09/2021 13:03, Raphaël Mélotte wrote:
> With some toolchains (e.g. mips64el), partial linking fails in the
> following way:
> /tmp/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mips64el-buildroot-linux-uclibc/8.4.0/../../../../mips64el-buildroot-linux-uclibc/bin/ld: build/release/libmupdf.a(Dingbats.cff.o): ABI is incompatible with that of the selected emulation
> /tmp/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mips64el-buildroot-linux-uclibc/8.4.0/../../../../mips64el-buildroot-linux-uclibc/bin/ld: failed to merge target specific data of file build/release/libmupdf.a(Dingbats.cff.o)
> 
> Taking inspiration from commit
> 9eca4b9f84fe2535d8caee6eeb062ce33733bdf1, fix it by using GCC instead
> of LD for partial linking.
> 
> Note that on mips the build will now produce warnings similar to this
> one:
> buildroot/output/host/lib/gcc/mips64el-buildroot-linux-gnu/10.3.0/../../../../mips64el-buildroot-linux-gnu/bin/ld: build/release/libmupdf.a(NotoSansTaiTham-Regular.ttf.o): warning: linking abicalls files with non-abicalls files
> 
> During a runtime test on mips64el under qemu, mupdf-x11 was
> nonetheless able to display a sample PDF file correctly.
> 
> Fixes:
> - http://autobuild.buildroot.net/results/156fe9ee5f6dccdc98990f6c5de5562383bc2b74/
> 
> Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>

  Applied to master, thanks.

[snip]

> +
> +Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
> +[Upstream status: https://bugs.ghostscript.com/show_bug.cgi?id=704442]

  Upstream commented that you could also build with HAVE_OBJCOPY=no, but I like 
this solution better.

> +---
> + Makefile | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Makefile b/Makefile
> +index b0fb617e2..0a8795e0e 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -64,7 +64,7 @@ endif
> + LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
> + TAGS_CMD = $(QUIET_TAGS) ctags -R --c-kinds=+p
> + WINDRES_CMD = $(QUIET_WINDRES) $(MKTGTDIR) ; $(WINDRES) $< $@
> +-OBJCOPY_CMD = $(QUIET_OBJCOPY) $(MKTGTDIR) ; $(LD) -r -b binary -z noexecstack -o $@ $<
> ++OBJCOPY_CMD = $(QUIET_OBJCOPY) $(MKTGTDIR) ; $(CC) -Wl,-r -Wl,-b -Wl,binary -Wl,-z -Wl,noexecstack -nostdlib -o $@ $<

  Note that -Wl allows you to separate options with commas, i.e.:

$(CC) -Wl,-r,-b,binary,-z,noexecstack -nostdlib -o $@ $<

  However, I didn't feel like doing a build to test, so I left it as is.

  Regards,
  Arnout


> +
> + # --- Rules ---
> +
> +--
> +2.33.0
> +
> 


More information about the buildroot mailing list