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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - LucaCiucci

Pages: [1]
1
General / Re: Failing to link release build on Windows
« on: March 27, 2021, 03:34:01 pm »
Hi, I'll explain you my setup since I use SFML on Windows with CMake.

SFML installation
We need CMake system to properly find the SFML library:
  • Add a global environment variable, for exaple SFML_install="G:\SFML-2.5.1";
  • add the following to PATH:
     
    • "%SFML_install%\lib"
    • "%SFML_install%\bin"
    • "%SFML_install%\lib\cmake\SFML"
    (the last one sould not be necessary, but I fund that camake won't find the library without it)

Note: obviously you would need to restart the IDE, cmd or anything you use. Sometimes Windows would not expand the PATH entries automatically. To solve this you should use the admin rights or simply sobstitute %SFML_install% with the actual value)

Configurations
I use Visual studio in my project, I create the debug and release configurations. The debug configuration should work fine while the release one would not work since VS will build your project in "RelWithDebInfo" by default, but the SFML are only built in "Debug" ad "Release". You have to edit the release configuration and change "Configuration Type" (not the configuration name) from "RelWithDebInfo" to "Release".

This method works fine for me, but if you want the "RelWithDebInfo" you have to build the SFML library from source... but I did not succeed: https://en.sfml-dev.org/forums/index.php?topic=27949.0


2
General / Re: dll problems while compiling SFML with VS2019
« 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

3
General / 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.

Pages: [1]
anything