microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.75k stars 6.29k forks source link

[raylib] Undifined Reference to asan / ubsan #39996

Closed AregevDev closed 1 month ago

AregevDev commented 1 month ago

Describe the bug Hello, I am trying to install and use raylib port, which depends on glfw. I have a simple CMake project. It seems like the GLFW port requires the adress sanitizer runtime. When adding asan and ubsan to my target_link_library, my program compiles and runs but reports false (?) memory leaks from glfw3. My intention is to completely disable the address sanitizer runtime.

I tried manually building glfw3 from source and it doesn't happen.

Environment

To Reproduce Steps to reproduce the behavior:

  1. Download the example project
  2. Run vcpkg install
  3. Build with CMake

Expected behavior A clear and concise description of what you expected to happen.

Failure logs cmake_error.txt

Additional context Sample.zip

jimwang118 commented 1 month ago

Confirmed that the issue has been reproduced locally.

jimwang118 commented 1 month ago

You can solve your problem by adding the following two sentences in cmakelists.txt. You also need to install asan and ubsan on your Linux.

target_compile_options(raylib_text PRIVATE -fsanitize=address -fsanitize=undefined)
target_link_options(raylib_text PRIVATE -fsanitize=address -fsanitize=undefined)
dg0yt commented 1 month ago

You can solve your problem by adding the following two sentences in cmakelists.txt. You also need to install asan and ubsan on your Linux.

target_compile_options(raylib_text PRIVATE -fsanitize=address -fsanitize=undefined)
target_link_options(raylib_text PRIVATE -fsanitize=address -fsanitize=undefined)

This DOES NOT solve the problem.

AregevDev commented 1 month ago

Oh, so the problem in the raylib port, interesting. I'll try using GLFW alone to confirm it. Maybe I'll submit a PR to disable asan in the vcpkg port...

Maybe add the option to use the GLFW port instead of the vendored GLFW as well.

AregevDev commented 1 month ago

I tried to come up with a PR. It seems like enabling sanitizers is done in the toolchain settings, not in port features. There is zero documentation about it. I am not even sure where the ENABLE_ASAN and ENABLE_UBSAN flags come from.

dg0yt commented 1 month ago

Please change the issue title: The offending port is raylib, not glfw.