@@ -259,8 +259,10 @@ BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace)
259259BACKTRACE_LIB_$(1 ) := $$(RT_OUTPUT_DIR_$(1 ) ) /$$(BACKTRACE_NAME_$(1 ) )
260260BACKTRACE_BUILD_DIR_$(1 ) := $$(RT_OUTPUT_DIR_$(1 ) ) /libbacktrace
261261
262- # We don't use this on platforms that aren't linux-based, so just make the file
263- # available, the compilation of libstd won't actually build it.
262+ # We don't use this on platforms that aren't linux-based (with the exception of
263+ # msys2/mingw builds on windows, which use it to read the dwarf debug
264+ # information) so just make the file available, the compilation of libstd won't
265+ # actually build it.
264266ifeq ($$(findstring darwin,$$(OSTYPE_$(1 ) ) ) ,darwin)
265267# See comment above
266268$$(BACKTRACE_LIB_$(1 ) ) :
@@ -273,7 +275,7 @@ $$(BACKTRACE_LIB_$(1)):
273275 touch $$@
274276else
275277
276- ifeq ($$(CFG_WINDOWSY_ $(1 ) ) ,1 )
278+ ifeq ($$(findstring msvc, $(1 ) ) ,msvc )
277279# See comment above
278280$$(BACKTRACE_LIB_$(1 ) ) :
279281 touch $$@
@@ -296,16 +298,25 @@ endif
296298# ./configure script. This is done to force libbacktrace to *not* use the
297299# atomic/sync functionality because it pulls in unnecessary dependencies and we
298300# never use it anyway.
301+ #
302+ # We also use `env PWD=` to clear the PWD environment variable, and then
303+ # execute the command in a new shell. This is necessary to workaround a
304+ # buildbot/msys2 bug: the shell is launched with PWD set to a windows-style path,
305+ # which results in all further uses of `pwd` also printing a windows-style path,
306+ # which breaks libbacktrace's configure script. Clearing PWD within the same
307+ # shell is not sufficient.
308+
299309$$(BACKTRACE_BUILD_DIR_$(1 ) ) /Makefile : $$(BACKTRACE_DEPS ) $$(MKFILE_DEPS )
300310 @$$(call E, configure: libbacktrace for $(1 ) )
301311 $$(Q ) rm -rf $$(BACKTRACE_BUILD_DIR_$(1 ) )
302312 $$(Q ) mkdir -p $$(BACKTRACE_BUILD_DIR_$(1 ) )
303- $$(Q ) (cd $$ (BACKTRACE_BUILD_DIR_$( 1) ) && \
313+ $$(Q ) (cd $$ (BACKTRACE_BUILD_DIR_$( 1) ) && env \
314+ PWD= \
304315 CC=" $$ (CC_$( 1) )" \
305316 AR=" $$ (AR_$( 1) )" \
306317 RANLIB=" $$ (AR_$( 1) ) s" \
307318 CFLAGS=" $$ (CFG_GCCISH_CFLAGS_$( 1) :-Werror=) -fno-stack-protector" \
308- $(S ) src/libbacktrace/configure --target =$(1 ) --host=$(CFG_BUILD ) )
319+ $(S ) src/libbacktrace/configure --build =$(CFG_GNU_TRIPLE_ $( CFG_BUILD ) ) --host=$(CFG_GNU_TRIPLE_ $( 1 ) ) )
309320 $$(Q ) echo ' #undef HAVE_ATOMIC_FUNCTIONS' >> \
310321 $$(BACKTRACE_BUILD_DIR_$(1 ) ) /config.h
311322 $$(Q ) echo ' #undef HAVE_SYNC_FUNCTIONS' >> \
@@ -317,7 +328,7 @@ $$(BACKTRACE_LIB_$(1)): $$(BACKTRACE_BUILD_DIR_$(1))/Makefile $$(MKFILE_DEPS)
317328 INCDIR=$(S ) src/libbacktrace
318329 $$(Q ) cp $$(BACKTRACE_BUILD_DIR_$(1 ) ) /.libs/libbacktrace.a $$@
319330
320- endif # endif for windowsy
331+ endif # endif for msvc
321332endif # endif for ios
322333endif # endif for darwin
323334
0 commit comments