Skip to content

Commit 8147b41

Browse files
committed
external_deps: check for bad DLL dependencies
We don't want the DLLs we build to depend on the MinGW standard library DLLs.
1 parent 5b6baaf commit 8147b41

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

external_deps/build.sh

+26-2
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,30 @@ build_naclruntime() {
889889
cp "scons-out/opt-linux-${NACL_ARCH}/staging/sel_ldr" "${PREFIX}/nacl_loader"
890890
}
891891

892+
# Check for DLL dependencies on MinGW stuff. For MSVC platforms this is bad because it should work
893+
# without having MinGW installed. For MinGW platforms it is still bad because it might not work
894+
# when building with different flavors, or newer/older versions.
895+
build_depcheck() {
896+
"${download_only}" && return
897+
898+
case "${PLATFORM}" in
899+
windows-*-*)
900+
local good=true
901+
for dll in $(find "${PREFIX}/bin" -type f -name '*.dll'); do
902+
# https://wiki.unvanquished.net/wiki/MinGW#Built-in_DLL_dependencies
903+
if objdump -p "${dll}" | grep -oP '(?<=DLL Name: )(libgcc_s|libstdc|libssp|libwinpthread).*'; then
904+
echo "${dll} depends on above DLLs"
905+
good=false
906+
fi
907+
done
908+
"${good}" || log ERROR 'Built DLLs depend on MinGW runtime DLLs'
909+
;;
910+
*)
911+
log ERROR 'Unsupported platform for depcheck'
912+
;;
913+
esac
914+
}
915+
892916
# The import libraries generated by MinGW seem to have issues, so we use LLVM's version instead.
893917
# So LLVM must be installed, e.g. 'sudo apt install llvm'
894918
build_genlib() {
@@ -1151,13 +1175,13 @@ setup_linux-arm64-default() {
11511175
common_setup linux aarch64-unknown-linux-gnu
11521176
}
11531177

1154-
base_windows_amd64_msvc_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk genlib'
1178+
base_windows_amd64_msvc_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk depcheck genlib'
11551179
all_windows_amd64_msvc_packages="${base_windows_amd64_msvc_packages}"
11561180

11571181
base_windows_i686_msvc_packages="${base_windows_amd64_msvc_packages}"
11581182
all_windows_i686_msvc_packages="${base_windows_amd64_msvc_packages}"
11591183

1160-
base_windows_amd64_mingw_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk'
1184+
base_windows_amd64_mingw_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk depcheck'
11611185
all_windows_amd64_mingw_packages="${base_windows_amd64_mingw_packages}"
11621186

11631187
base_windows_i686_mingw_packages="${base_windows_amd64_mingw_packages}"

0 commit comments

Comments
 (0)