aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2016-06-24 16:17:47 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2016-06-24 13:47:47 +0300
commit4934e70092cff9b0e23227da9f4c4b6c389da835 (patch)
tree27d467929c9681c77017fbf373f2c35ef26f6762
parent06a5853fdea960c363212f69f1c88a3fcb12cc78 (diff)
downloadmeson-4934e70092cff9b0e23227da9f4c4b6c389da835.zip
meson-4934e70092cff9b0e23227da9f4c4b6c389da835.tar.gz
meson-4934e70092cff9b0e23227da9f4c4b6c389da835.tar.bz2
Don't pass pdb flags while linking inside compiler tests (#614)
This causes intermittent build failures in the MSVC CI because of a race with the default anti-virus that ships with Windows while writing the .pdb file: https://ci.appveyor.com/project/jpakkane/meson/build/1.0.58 There's a separate fix for that in the works that will fix this in the general case, but for compiler tests we don't need to generate the pdb file at all. So, just fetch the CRT flag (/MDd) if needed instead. This has the side-effect of making compiler tests that use self.links and self.run faster.
-rw-r--r--mesonbuild/compilers.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 1adb7f5..4628c74 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -343,6 +343,13 @@ class CCompiler(Compiler):
def get_always_args(self):
return []
+ def get_linker_debug_crt_args(self):
+ """
+ Arguments needed to select a debug crt for the linker
+ This is only needed for MSVC
+ """
+ return []
+
def get_no_stdinc_args(self):
return ['-nostdinc']
@@ -589,11 +596,8 @@ int main () {{ {1}; }}'''
ofile.close()
# Convert flags to the native type of the selected compiler
args = self.unix_link_flags_to_native(extra_args)
- # Need to add buildtype args to select the CRT to use with MSVC
- # This is needed especially while trying to link with static libraries
- # since MSVC won't auto-select a CRT for us in that case and will error
- # out asking us to select one.
- args += self.get_buildtype_args('debug')
+ # Select a CRT if needed since we're linking
+ args += self.get_linker_debug_crt_args()
# Read c_args/c_link_args/cpp_args/cpp_link_args/etc from the cross-info file (if needed)
args += self.get_cross_extra_flags(env, compile=True, link=True)
# Arguments specifying the output filename
@@ -617,8 +621,8 @@ int main () {{ {1}; }}'''
ofile.close()
# Convert flags to the native type of the selected compiler
args = self.unix_link_flags_to_native(extra_args)
- # Same reasoning as self.links() above
- args += self.get_buildtype_args('debug')
+ # Select a CRT if needed since we're linking
+ args += self.get_linker_debug_crt_args()
# Read c_link_args/cpp_link_args/etc from the cross-info file
args += self.get_cross_extra_flags(env, compile=True, link=True)
# Create command list
@@ -1407,6 +1411,17 @@ class VisualStudioCCompiler(CCompiler):
def get_always_args(self):
return self.always_args
+ def get_linker_debug_crt_args(self):
+ """
+ Arguments needed to select a debug crt for the linker
+
+ Sometimes we need to manually select the CRT (C runtime) to use with
+ MSVC. One example is when trying to link with static libraries since
+ MSVC won't auto-select a CRT for us in that case and will error out
+ asking us to select one.
+ """
+ return ['/MDd']
+
def get_buildtype_args(self, buildtype):
return msvc_buildtype_args[buildtype]