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

Author Topic: Can't compile SFML on Windows 11  (Read 11125 times)

0 Members and 1 Guest are viewing this topic.

Grundkurs

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Can't compile SFML on Windows 11
« on: October 17, 2021, 07:38:24 pm »
[EDIT]
I could pinpoint the issue: https://winlibs.com/ offers two versions of the mingw-w64 compiler: One ships with UCRT runtime, the other with MSVCRT runtime. With MSVCRT runtime i had no compilation issues. Visual Studio Compiler also had no issues compiling SFML on Windows 11. So i guess its something with the UCRT runtime.
[/EDIT]


I tried to compile SFML on Windows 11 and it fails with the following error-message:

[ 79%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTextureImpl.cpp.obj
[ 79%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTextureImplFBO.cpp.obj
[ 80%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTextureImplDefault.cpp.obj
[ 81%] Building RC object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/sfml-graphics.rc.obj
[ 82%] Linking CXX shared library ..\..\..\lib\sfml-graphics-2.dll
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Keen/Downloads/SFML-master/extlibs/libs-mingw/x64/libfreetype.a(sfnt.c.obj):sfnt.c:(.text+0x5614): undefined reference to `_setjmp'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Keen/Downloads/SFML-master/extlibs/libs-mingw/x64/libfreetype.a(smooth.c.obj):smooth.c:(.text+0x77a): undefined reference to `_setjmp'

collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\SFML\Graphics\CMakeFiles\sfml-graphics.dir\build.make:602: lib/sfml-graphics-2.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:307: src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/all] Error 2
mingw32-make: *** [makefile:155: all] Error 2


I did not have this issue on Windows 10 using the same procedure described below:

  • 1. I use mingw-w64 compiler from https://winlibs.com/ (GCC 11.2.0 + LLVM/Clang/LLD/LLDB 13.0.0 + MinGW-w64 9.0.0 - UCRT-Runtime)
  • 2. Download SFML from https://github.com/SFML/SFML
  • 3. generate CMake-Files for MinGW.
  • 4. in Build-Folder: "mingw32-make install"

It compiles until 82 % and than cannot find '_setjmp'.
Compilation of SFML always worked for me in the past, this is the first time that it cannot get through to 100 %. Maybe it has something to do with Win 11?
« Last Edit: October 17, 2021, 10:02:24 pm by Grundkurs »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Can't compile SFML on Windows 11
« Reply #1 on: October 18, 2021, 10:13:30 am »
There's always a chance that with new OS versions that some libraries need fixes or rebuilds.
As the fix for Ryzen CPU issue are currently only on Insider builds, I'll wait some more weeks for the final release, before updating to Windows 11, then I can take a look.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Powereleven

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Can't compile SFML on Windows 11
« Reply #2 on: November 07, 2021, 08:23:02 am »
I'm on Windows 10 and get the same error

azkalaak

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Re: Can't compile SFML on Windows 11
« Reply #3 on: March 05, 2022, 10:56:57 am »
I had the same problem (windows 11 using conan to build dependencies and sfml)

However, my problem was due to a mismatch in my conan build, the libfreetype building using g++ and the SFML building using clang++

after purging the sources and using the same compiler and linker to build each dependencies I had no more problems, it does not seem to be a SFML related issue
(it happened when I tried using the sf::Font class)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Can't compile SFML on Windows 11
« Reply #4 on: March 05, 2022, 12:52:52 pm »
See edit at the top. It's caused by using different runtime libs. SFML's dependencies were compiled with MSVCRT, thus you can mix it with a compiler using UCRT
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

darkonaito_

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't compile SFML on Windows 11
« Reply #5 on: August 07, 2022, 03:21:44 am »
Is the problem with UCRT ever going to be fixed? I'm having it on windows 10

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Can't compile SFML on Windows 11
« Reply #6 on: August 08, 2022, 05:11:49 pm »
It's not really something to "fix", because it's simply two different runtime libraries, which SFML then also would have to compile for and distribute. Currently there are no plans to do so, if you want to use UCRT, you'll need to rebuild SFML's dependencies yourself.

In the near-ish future, SFML will stop providing the dependencies as binaries and instead always build from source.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

darkonaito_

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't compile SFML on Windows 11
« Reply #7 on: October 30, 2022, 12:24:51 am »
I was using the term "fix" because, as far as I read, MSVCR is a bit stuck in the past. How hard is it to build the dependencies? Do you think it's worth?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Can't compile SFML on Windows 11
« Reply #8 on: October 30, 2022, 01:52:42 am »
Not really, given that you can just download the other compiler version and everything starts working fine :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything