Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: dll problems while compiling SFML with VS2019  (Read 1277 times)

0 Members and 1 Guest are viewing this topic.

LucaCiucci

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
dll problems while compiling SFML with VS2019
« on: March 24, 2021, 10:36:42 am »
Good morning, I am new to this forum.

I am not able to correctly build the SFML libraries and obtain an equivalent of the prebuilt windows binaries.
I use SFML in an external CMake project and I always used the prebuilt version for the Debug and Release configurations. Now, I really need the RelWithDebInfo configuration and with the prebuilt version I get the error "Stack cookie instrumentation code detected a stack-based buffer overrun" when running my executable (see this topic with a similar problem https://en.sfml-dev.org/forums/index.php?topic=27220.0).
I think I should recompile the SFML libraries in the configurations I need and with the same compiler, so I tried.

How I am tring to build the SFML
I downloaded the latest source from the "master" branch, I opened the CMake project with Visual Studio 2019 and I created the desidered configurations.
I've read the tutorial (https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php) and I think the default values for the SFML's CMake variables are fine.
I've built all targets and then I clicked "install SFML".

In the install folder I see the "bin" folder with the SFML DLLs and the openal32 dll, in the lib folder I see some expected .lib and the cmake folder.

The problem
I've updated the PATH and built my CMake project without any problem but when I run the program I get some errors for missing some dlls (freetype.dll, bz2.dll and libpng16.dll).
I found that these dlls are in the build folder, I didn't expect those dlls, but perhaps I'm missing somethig. Anyway, to solve the problem, I tried to copy these dlls in the install bin folder (but in the prebuilt version they are not present).
At this point if I run my program I get an error for not finding the inflateValidate entry point in the libpng16.dll and I don't know what to do.

Another doubt
If I set BUILD_SHARED_LIBS to false, I still get the shared version of the libraries


Thanks in advance, I hope I am not wasting your time.
« Last Edit: March 24, 2021, 10:38:53 am by LucaCiucci »

LucaCiucci

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: dll problems while compiling SFML with VS2019
« Reply #1 on: March 24, 2021, 04:41:25 pm »
Also, in Macros.cmake, in the macro "sfml_add_external" the command
add_library(${target} INTERFACE)
is used... I don't undestand why I get the external libraries compiled into DLLs (freetype.dll, bz2.dll, libpng16.dll, ...).

See:
http:// https://github.com/SFML/SFML/blob/05c83617de07a150bfac128ae892056779baf268/cmake/Macros.cmake#L319