Skip to content

Commit 211c020

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 d0a35e5 commit 211c020

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

external_deps/build.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,30 @@ build_naclruntime() {
882882
cp "scons-out/opt-linux-${NACL_ARCH}/staging/sel_ldr" "${PREFIX}/nacl_loader"
883883
}
884884

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

1147-
base_windows_amd64_msvc_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk genlib'
1171+
base_windows_amd64_msvc_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk depcheck genlib'
11481172
all_windows_amd64_msvc_packages="${base_windows_amd64_msvc_packages}"
11491173

11501174
base_windows_i686_msvc_packages="${base_windows_amd64_msvc_packages}"
11511175
all_windows_i686_msvc_packages="${base_windows_amd64_msvc_packages}"
11521176

1153-
base_windows_amd64_mingw_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk'
1177+
base_windows_amd64_mingw_packages='zlib gmp nettle curl sdl2 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk depcheck'
11541178
all_windows_amd64_mingw_packages="${base_windows_amd64_mingw_packages}"
11551179

11561180
base_windows_i686_mingw_packages="${base_windows_amd64_mingw_packages}"

0 commit comments

Comments
 (0)