On 12/1/19 5:24 PM, manp...@gmail.com wrote:
> Hi Ports maintainer,
> 
> Hit another problem when trying to build textproc/mupdf, which says
> failed to link 32-bit and 64-bit code:
> 
> /usr/bin/ld: build/release/libmupdf.a(Dingbats.cff.o): warning: linking
> PIC files with non-PIC files
> /usr/bin/ld: build/release/libmupdf.a(Dingbats.cff.o): linking 32-bit
> code with 64-bit code
> /usr/bin/ld: failed to merge target specific data of file
> build/release/libmupdf.a(Dingbats.cff.o)
> /usr/bin/ld: build/release/libmupdf.a(NimbusMonoPS-Bold.cff.o): warning:
> linking PIC files with non-PIC files
> /usr/bin/ld: build/release/libmupdf.a(NimbusMonoPS-Bold.cff.o): linking
> 32-bit code with 64-bit code
> /usr/bin/ld: failed to merge target specific data of file
> build/release/libmupdf.a(NimbusMonoPS-Bold.cff.o)
> 
> The full build log is attached.
> 

With help from Brian, I finally get it built (thanks a lot Brian!)  The
problem is that the default linker (ld.bfd) cannot handle the font
archive format well and when linking with fonts and code archive so it
gives the errors in the log.  ld.lld is required to make this work.
Also because the linker will be called through compiler, we need to
explicitly use clang.  The patch is attached.  Please consider refine
and submit.  Thanks!
Index: Makefile
===================================================================
RCS file: /cvs/ports/textproc/mupdf/Makefile,v
retrieving revision 1.92
diff -u -p -r1.92 Makefile
--- Makefile    17 Sep 2019 09:22:51 -0000      1.92
+++ Makefile    4 Dec 2019 01:02:32 -0000
@@ -53,6 +53,17 @@ MAKE_FLAGS = CC="${CC}" CXX="${CXX}" \
                USE_SYSTEM_LIBS=yes \
                build=release verbose=yes
 
+# mips64* needs lld to link the font files so clang is required.
+# Neither is in LLD_ARCHS, so need to explicitly declare LLD_EMUL.
+.if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
+MAKE_FLAGS +=  CC="/usr/bin/clang" CXX="/usr/bin/clang++" 
LDFLAGS="-fuse-ld=lld" LD="/usr/bin/ld.lld"
+.  if ${MACHINE_ARCH} == "mips64"
+MAKE_FLAGS +=  LLD_EMUL="-melf64btsmip"
+.  else
+MAKE_FLAGS +=  LLD_EMUL="-melf64ltsmip"
+.  endif
+.endif
+
 FAKE_FLAGS =   prefix=${PREFIX} mandir=${PREFIX}/man
 
 pre-configure:

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to