On Thu, Jan 22, 2026 at 03:35:41PM +0000, Klemens Nanni wrote:
> 22.01.2026 17:26, Jeremie Courreges-Anglas пишет:
> > boost publically exposes C++ libs with ABI details encoded. That
> > doesn't work very well when mixing compilers.
>
> Right.
>
> > I suspect that passing
> > -mlong-calls to the b2 compilation (do-configure) should be enough,
> > but I'm not sure how to do that.
>
> build.sh accepts flags, but then:
>
> |clang++: warning: ignoring '-mlong-calls' option as it is not currently
> supported with the implicit usage of -mabicalls [-Woption-ignored]
>
> ... second attempt, diff below:
>
> |> clang++ -x c++ -std=c++11 -pthread -mlong-calls -mno-abicalls
> -Wno-deprecated-declarations -DNDEBUG bindjam.cpp [...] -o b2
> |fatal error: error in backend: Cannot select: 0x45fc4c9a0: i64 =
> MipsISD::GPRel TargetGlobalAddress:i64<ptr @.str> 0 [TF=3]
> | 0x442ad8ee0: i64 = TargetGlobalAddress<ptr @.str> 0 [TF=3]
> |In function: _ZN2b23jam6to_jamIbEEPNS_5valueET_
> |[...]
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/boost/Makefile,v
> diff -u -p -r1.157 Makefile
> --- Makefile 15 Jan 2026 15:00:58 -0000 1.157
> +++ Makefile 22 Jan 2026 15:30:46 -0000
> @@ -90,13 +90,15 @@ LIB_DEPENDS= archivers/bzip2 \
>
> LIB_DEPENDS-md= devel/boost
>
> +BUILD_SH_ARGS= # empty
> +.if ${MACHINE_ARCH} == "mips64"
> +# XXX bindjam.cpp:(.text+0x600): relocation truncated to fit: R_MIPS_CALL16
> ...
> +BUILD_SH_ARGS+= --cxxflags='-mlong-calls -mno-abicalls'
> +.endif
> +
> .include <bsd.port.arch.mk>
>
> -.if ${PROPERTIES:Mclang}
> -TOOLSET= clang
> -.else
> -TOOLSET= gcc
> -.endif
> +TOOLSET= ${CHOSEN_COMPILER:base-%=:ports-%=}
>
> BJAM_CONFIG= -sICU_PATH=${LOCALBASE} \
> -sBZIP2_INCLUDE=${LOCALBASE}/include \
> @@ -138,7 +140,7 @@ do-configure:
> @cd ${WRKSRC}/libs/config && \
> ${SETENV} ${CONFIGURE_ENV} /bin/sh ./configure
> @cd ${WRKSRC}/tools/build/src/engine && ${SETENV} ${CONFIGURE_ENV} \
> - /bin/sh ./build.sh ${TOOLSET} && cp b2 ${WRKSRC}
> + /bin/sh ./build.sh ${BUILD_SH_ARGS} ${TOOLSET} && cp b2
> ${WRKSRC}
> @cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} /bin/sh ./bootstrap.sh
> ${BOOTSTRAP}
>
> do-build:
>
The "relocation truncated to fit: R_MIPS_CALL16" error says that the
GOT has become too large for R_MIPS_CALL16. This size limitation can
be avoided by compiling the calling code with -mxgot (this causes
a slight performance drop in the resulting machine code).
Here is a revised patch to fix the mips64 build:
Index: Makefile
===================================================================
RCS file: ports/devel/boost/Makefile,v
diff -u -p -r1.160 Makefile
--- Makefile 10 Feb 2026 13:44:09 -0000 1.160
+++ Makefile 2 Apr 2026 13:48:56 -0000
@@ -89,6 +89,11 @@ LIB_DEPENDS= archivers/bzip2 \
LIB_DEPENDS-md= devel/boost
+BUILD_SH_ARGS=
+.if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
+BUILD_SH_ARGS+= --cxxflags='-mxgot'
+.endif
+
.include <bsd.port.arch.mk>
.if ${PROPERTIES:Mclang}
@@ -137,7 +142,7 @@ do-configure:
@cd ${WRKSRC}/libs/config && \
${SETENV} ${CONFIGURE_ENV} /bin/sh ./configure
@cd ${WRKSRC}/tools/build/src/engine && ${SETENV} ${CONFIGURE_ENV} \
- /bin/sh ./build.sh ${TOOLSET} && cp b2 ${WRKSRC}
+ /bin/sh ./build.sh ${BUILD_SH_ARGS} ${TOOLSET} && cp b2
${WRKSRC}
@cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} /bin/sh ./bootstrap.sh
${BOOTSTRAP}
do-build: