Repository: mesonbuild/meson

Issue:
PDB files shipped with Boost/MSVC releases from sourceforge trigger ERROR when using dependency('boost')
Binary Boost releaases downloaded from https://sourceforge.net/projects/boost/files/boost-binaries/ include debbuging information in separete .pdb files stored alongside .lib and .dll files in `lib<32|64>-msvc-<version>` directories. 

The error visible in the log looks like this:

`meson.build:13:0: ERROR: Unable to process library extension "pdb" (C:\opt\moonlight-deps\boost_1_75_0\lib32-msvc-14.1\boost_atomic-vc141-mt-gd-x32-1_75.pdb)`

which hints at the following code location:

https://github.com/mesonbuild/meson/blob/2a8d6690f73ec6415c2ee592e856b3b6de7cfb02/mesonbuild/dependencies/boost.py#L155

I think the official binary releases for MSVC should be consumable in the form they are shipped.
Workaround: currently I need to move .pdb files to separate directory, which requires write access to the lib... directory - not always available on CI systems with boost preinstalled.



Discussion:
I'm running into this same issue.
Maybe the cleanest solution is to add a case here to exclude certain file suffixes?
https://github.com/mesonbuild/meson/blob/2a8d6690f73ec6415c2ee592e856b3b6de7cfb02/mesonbuild/dependencies/boost.py#L620

Or maybe the `BoostLibraryFile` class should have a static `is_file_valid(fileName: Path) -> bool:` method which is used to ignore unsupported files?
I have the same issue. What really should happen is Meson should start using the official way  of detecting boost libraries, i.e. via CMake. See #8801.
> I have the same issue. What really should happen is Meson should start using the official way of detecting boost libraries, i.e. via CMake. See #8801.

Forgive my ignorance: I use meson specifically so I can avoid the need for CMake. What is the point of Meson if it only calls CMake in the end, anyway?

Edit: I'm not saying that it must avoid CMake at all costs, I think having CMake as a fallback for finding dependencies is helpful. But why should CMake be a required dependency of Meson? If I *have to* use some buildsystem anyway and Meson requires CMake+Ninja, while CMake requires only autotools... why not use CMake at that point? Meson doesn't do anything particularly special to distinguish itself from CMake, aside from having a shorter syntax. Some projects I work on even build slower with Meson compared to CMake.

Resolving patch:
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py
--- a/mesonbuild/dependencies/boost.py
+++ b/mesonbuild/dependencies/boost.py
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 import re
+import dataclasses
 import functools
 import typing as T
 from pathlib import Path
@@ -83,6 +84,10 @@
 #     2.4 Ensure that all libraries have the same boost tag (and are thus compatible)
 #   3. Select the libraries matching the requested modules
 
+@dataclasses.dataclass(eq=False, order=False)
+class UnknownFileException(Exception):
+    path: Path
+
 @functools.total_ordering
 class BoostIncludeDir():
     def __init__(self, path: Path, version_int: int):
@@ -152,7 +157,7 @@ def __init__(self, path: Path):
         elif self.nvsuffix in ['a', 'lib']:
             self.static = True
         else:
-            raise DependencyException(f'Unable to process library extension "{self.nvsuffix}" ({self.path})')
+            raise UnknownFileException(self.path)
 
         # boost_.lib is the dll import library
         if self.basename.startswith('boost_') and self.nvsuffix == 'lib':
@@ -623,8 +628,15 @@ def detect_libraries(self, libdir: Path) -> T.List[BoostLibraryFile]:
                 continue
             if not any([i.name.startswith(x) for x in ['libboost_', 'boost_']]):
                 continue
+            # Windows binaries from SourceForge ship with PDB files alongside
+            # DLLs (#8325).  Ignore them.
+            if i.name.endswith('.pdb'):
+                continue
 
-            libs.add(BoostLibraryFile(i.resolve()))
+            try:
+                libs.add(BoostLibraryFile(i.resolve()))
+            except UnknownFileException as e:
+                mlog.warning('Boost: ignoring unknown file {} under lib directory'.format(e.path.name))
 
         return [x for x in libs if x.is_boost()]  # Filter out no boost libraries
 


Test patch: