Skip to content

Commit cc2e710

Browse files
committed
configure.ac: generate debug symbols for Win
<https://stackoverflow.com/questions/74416539/clang-14-does-not-generate-pdb-file> Set it only when linking, not for configure.
1 parent d317977 commit cc2e710

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

.github/scripts/Windows/prepare_msys.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ PACMAN_INSTALL='pacman -Sy --needed --noconfirm --disable-download-timeout'
4646
MINGW_PACKAGE_PREFIX=mingw-w64-clang-x86_64
4747
m=$MINGW_PACKAGE_PREFIX
4848
$PACMAN_INSTALL automake autoconf git make pkgconf \
49-
$m-clang $m-winpthreads \
49+
$m-clang $m-lld $m-winpthreads \
5050
$m-gcc-compat \
5151
unzip zip
5252
$PACMAN_INSTALL $m-asciidoc \

Makefile.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ src/dir-stamp:
241241

242242
$(TARGET): src/dir-stamp $(ULTRAGRID_OBJS) $(GENERATED_HEADERS) $(BIN_DEPS)
243243
$(MKDIR_P) $$(dirname $@)
244-
$(LINKER) $(LDFLAGS) $(ULTRAGRID_OBJS) $(LIBS) $(ULTRAGRID_LIBS) -o $(TARGET)
244+
$(LINKER) $(LDFLAGS) @UV_LDFLAGS@ $(ULTRAGRID_OBJS) $(LIBS) $(ULTRAGRID_LIBS)\
245+
-o $(TARGET)
245246
@if [ -n '@DLL_LIBS@' ]; then $(INSTALL) -m 644 @DLL_LIBS@ bin; fi
246247

247248
$(REFLECTOR_TARGET): src/dir-stamp $(REFLECTOR_OBJS) $(GENERATED_HEADERS) bin/hd-rum-av
@@ -554,6 +555,7 @@ clean:
554555
$(COND_SILENCE)-rm -rf @TOREMOVE@ @MODULES@ @LIB_GENERATED_HEADERS@
555556
$(COND_SILENCE)-rm -rf $(DEP_FILES)
556557
$(COND_SILENCE)-rm -rf bin/shaders
558+
$(COND_SILENCE)-rm -f bin/uv.pdb
557559
$(COND_SILENCE)if [ -f "gui/QT/Makefile" ]; then make -C gui/QT/ distclean; fi
558560

559561
distclean: clean
@@ -690,6 +692,10 @@ install: all
690692
if [ -n "@VULKAN@" ]; then\
691693
$(INSTALL) -D -m 644 "$(srcdir)/share/ultragrid/vulkan_shaders/"* -t "$(DESTDIR)$(datadir)/ultragrid/vulkan_shaders"; \
692694
fi
695+
if [ -f bin/uv.pdb ]; then\
696+
$(INSTALL) -m 644 bin/uv.pdb $(DESTDIR)$(bindir); \
697+
fi
698+
693699
uninstall:
694700
$(RM) $(DESTDIR)$(bindir)/uv
695701
$(RM) $(DESTDIR)$(bindir)/hd-rum-transcode
@@ -710,5 +716,6 @@ uninstall:
710716
rmdir $(DESTDIR)$(datadir)/ultragrid/vulkan_shaders;\
711717
rmdir $(DESTDIR)$(datadir)/ultragrid;\
712718
fi
719+
$(RM) $(DESTDIR)$(bindir)/uv.pdb
713720

714721
# vim: set noexpandtab

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,23 @@ if test $system = Windows; then
174174
LIBS="$LIBS -lsetupapi -lws2_32 -liphlpapi -lole32 -loleaut32"
175175
LIBS="$LIBS -ldbghelp"
176176
AC_CHECK_FUNCS(SetThreadDescription)
177+
if $CXX -dM -E - </dev/null | grep clang >/dev/null; then
178+
AC_CHECK_PROG([LLD], [lld], [yes])
179+
if test "$LLD" = yes; then
180+
COMMON_FLAGS="${COMMON_FLAGS:+$COMMON_FLAGS }-gcodeview"
181+
UV_LDFLAGS="-fuse-ld=lld -g -Wl,--pdb=bin/uv.pdb"
182+
fi
183+
fi
184+
if ! expr "x$COMMON_FLAGS" : '.*gcodeview' >/dev/null; then
185+
UG_MSG_WARN([Windows stacktrace will not be available.])
186+
fi
177187
fi
178188

179189
LINKER=$CXX
180190

181191
AC_SUBST(LINKER)
182192
AC_SUBST(LDFLAGS)
193+
AC_SUBST(UV_LDFLAGS)
183194
AC_SUBST(CXXFLAGS)
184195

185196
AC_ARG_ENABLE(depends-version-check,

0 commit comments

Comments
 (0)