conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
957 stars 1.75k forks source link

[glfw] glfw/3.3.*: pdb files built by MSVC in Debug are not exported to the package. #13578

Open Adnn opened 2 years ago

Adnn commented 2 years ago

Description

When building glfw (tested v3.3.6 and v3.3.8) on Windows with MSVC compiler in Debug, the Debug Information Format is \Zi, thus producing a separate .pdb file.

When building the recipe locally, you can see that the .pdb is indeed present next to glfw3.lib in the build folder, but it is not exporter alongside in the package folder.

This causes linker waring when using glfw3 as upstream:

warning LNK4099: PDB 'glfw3.pdb' was not found with 'glfw3.lib(init.obj)' or at 'D:\projects\build-conan-Visual Studio16\src\apps\Debug\glfw3.pdb'; linking object as if no debug info

Package and Environment Details

Conan profile

[settings] arch=x86_64 build_type=Debug compiler=Visual Studio compiler.runtime=MDd compiler.version=16 os=Windows

[requires] opengl/system

[options] shared=False vulkan_static=False

[full_settings] arch=x86_64 build_type=Debug compiler=Visual Studio compiler.runtime=MDd compiler.version=16 os=Windows

[full_requires] opengl/system:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9

[full_options] shared=False vulkan_static=False

[recipe_hash] 205c31edba0c4d470236d5216c7329ca

[env]

Steps to reproduce

conan install glfw/3.3.8@ --build=glfw -s build_type=Debug

Then take a look into the produced build and package folders in conan cache.

Logs

Click to expand log ``` warning LNK4099: PDB 'glfw3.pdb' was not found with 'glfw3.lib(init.obj)' or at 'D:\projects\build-conan-Visual Studio16\src\apps\Debug\glfw3.pdb'; linking object as if no debug info ```
Adnn commented 2 years ago

Note that this is the same issue than described in: https://github.com/bincrafters/community/issues/126

I think I will propose a PR to naively copy over the PDB, unless advised otherwise.

SpaceIm commented 2 years ago

https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#why-pdb-files-are-not-allowed

Adnn commented 2 years ago

Very interesting, thank you @SpaceIm.

On the other hand, would that be okay to patch the project (via a recipe patch) to use /Z7?

SpaceIm commented 2 years ago

I don't think so, it can be injected externally.

Adnn commented 2 years ago

Thank you for your response.

If I understand correctly, this means the default (i.e. without the user taking explicit steps to provide /Z7) would be to always have a linker warning when consuming glfw recipe on Windows with MSVC Degub builds.

Moreover, it seems uncommon for a consumer to request a debug build while not being interested in having the symbols for said build (making actual debugging much more difficult). I am not saying there are not legitimate cases for this, but making it the default assumption does not sound like the most user friendly option to me.

prince-chrismc commented 1 year ago

The goal is to allow you to debug your application... it's pretty rare you need to step into the code of ur dependencies. (in a perfect code you would never need to).

The warning is annoying but the overhead and cost of the PDBs are pretty considerable given they are a nice to have so we prioritized our resources, hopefully that makes sense. It's pretty easy to suppress the warning from a profile or cli.

Adnn commented 1 year ago

In a perfect world, we would not debug applications ; )

Most other dependencies we tried are probably compiling with /Z7, as we do not have warnings when linking in debug. I was surprised that neither embedding the pdb nor patching glfw from the recipe to compile with /Z7 was considered a better alternative than a warning.

But that is not a hill I am willing to die on. I appreciate the feedback, and will have a local patch for the recipe.

uilianries commented 1 year ago

@Adnn You can configure /Z7 directly from your profile, as Prince commented.

The global.conf has all supported configurations. Based on that, you can use tools.build:cflags and tools.build:cxxflags.