@@ -259,8 +259,10 @@ BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace)
259
259
BACKTRACE_LIB_$(1 ) := $$(RT_OUTPUT_DIR_$(1 ) ) /$$(BACKTRACE_NAME_$(1 ) )
260
260
BACKTRACE_BUILD_DIR_$(1 ) := $$(RT_OUTPUT_DIR_$(1 ) ) /libbacktrace
261
261
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.
264
266
ifeq ($$(findstring darwin,$$(OSTYPE_$(1 ) ) ) ,darwin)
265
267
# See comment above
266
268
$$(BACKTRACE_LIB_$(1 ) ) :
@@ -273,7 +275,7 @@ $$(BACKTRACE_LIB_$(1)):
273
275
touch $$@
274
276
else
275
277
276
- ifeq ($$(CFG_WINDOWSY_ $(1 ) ) ,1 )
278
+ ifeq ($$(findstring msvc, $(1 ) ) ,msvc )
277
279
# See comment above
278
280
$$(BACKTRACE_LIB_$(1 ) ) :
279
281
touch $$@
@@ -296,16 +298,25 @@ endif
296
298
# ./configure script. This is done to force libbacktrace to *not* use the
297
299
# atomic/sync functionality because it pulls in unnecessary dependencies and we
298
300
# 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
+
299
309
$$(BACKTRACE_BUILD_DIR_$(1 ) ) /Makefile : $$(BACKTRACE_DEPS ) $$(MKFILE_DEPS )
300
310
@$$(call E, configure: libbacktrace for $(1 ) )
301
311
$$(Q ) rm -rf $$(BACKTRACE_BUILD_DIR_$(1 ) )
302
312
$$(Q ) mkdir -p $$(BACKTRACE_BUILD_DIR_$(1 ) )
303
- $$(Q ) (cd $$ (BACKTRACE_BUILD_DIR_$( 1) ) && \
313
+ $$(Q ) (cd $$ (BACKTRACE_BUILD_DIR_$( 1) ) && env \
314
+ PWD= \
304
315
CC=" $$ (CC_$( 1) )" \
305
316
AR=" $$ (AR_$( 1) )" \
306
317
RANLIB=" $$ (AR_$( 1) ) s" \
307
318
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 ) ) )
309
320
$$(Q ) echo ' #undef HAVE_ATOMIC_FUNCTIONS' >> \
310
321
$$(BACKTRACE_BUILD_DIR_$(1 ) ) /config.h
311
322
$$(Q ) echo ' #undef HAVE_SYNC_FUNCTIONS' >> \
@@ -317,7 +328,7 @@ $$(BACKTRACE_LIB_$(1)): $$(BACKTRACE_BUILD_DIR_$(1))/Makefile $$(MKFILE_DEPS)
317
328
INCDIR=$(S ) src/libbacktrace
318
329
$$(Q ) cp $$(BACKTRACE_BUILD_DIR_$(1 ) ) /.libs/libbacktrace.a $$@
319
330
320
- endif # endif for windowsy
331
+ endif # endif for msvc
321
332
endif # endif for ios
322
333
endif # endif for darwin
323
334
0 commit comments