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

Author Topic: Trouble building SFML from source.  (Read 4689 times)

0 Members and 1 Guest are viewing this topic.

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Trouble building SFML from source.
« on: August 26, 2024, 07:37:00 pm »
Hello. I tried building SFML from source and ran into some errors. After generating the mingw makefile using cmake I tried building the library using "mingw32-make install".

[  0%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.obj
C__~1.EXE: error: unrecognized command line option '-Wnull-dereference'
C__~1.EXE: error: unrecognized command line option '-Wmisleading-indentation'
C__~1.EXE: error: unrecognized command line option '-Wduplicated-cond'

Help would be greatly appreciated. :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Trouble building SFML from source.
« Reply #1 on: August 26, 2024, 11:48:13 pm »
Are you using a very old compiler?

The SFML master branch (SFML 3 WIP) requires a C++17 compatible compiler.

If you want to stick to MinGW, I recommend WinLibs
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Trouble building SFML from source.
« Reply #2 on: August 27, 2024, 01:51:01 am »
Yes,I was using a old compiler. I'll try using that then.

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Trouble building SFML from source.
« Reply #3 on: August 27, 2024, 02:02:23 am »
I used the compiler you showed and made sure the bin folder was in the environment variables but it still gives the exact same error.

[  0%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.obj
C__~1.EXE: error: unrecognized command line option '-Wnull-dereference'
C__~1.EXE: error: unrecognized command line option '-Wmisleading-indentation'
C__~1.EXE: error: unrecognized command line option '-Wduplicated-cond'
mingw32-make[2]: *** [src\SFML\System\CMakeFiles\sfml-system.dir\build.make:76: src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:202: src/SFML/System/CMakeFiles/sfml-system.dir/all] Error 2
mingw32-make: *** [makefile:155: all] Error 2


EDIT:

Nevermind. That fixed it after I set cmake to use that compiler instead of the other.  Thanks a lot! :D
« Last Edit: August 27, 2024, 02:18:22 am by Me-Myself-And-I »

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Trouble building SFML from source.
« Reply #4 on: August 27, 2024, 02:28:03 am »
Well now I'm having another problem. ???

[100%] Linking CXX shared library ..\..\..\lib\sfml-audio-2.dll
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/Users/Humor/Downloads/SFML-2.6.1-sources/SFML-2.6.1/extlibs/libs-mingw/x86/libFLAC.a(stream_decoder.o):stream_decoder.c:(.text+0xfd): undefined reference to `_imp___iob'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/Users/Humor/Downloads/SFML-2.6.1-sources/SFML-2.6.1/extlibs/libs-mingw/x86/libFLAC.a(stream_decoder.o):stream_decoder.c:(.text+0x144): undefined reference to `_imp___iob'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/Users/Humor/Downloads/SFML-2.6.1-sources/SFML-2.6.1/extlibs/libs-mingw/x86/libFLAC.a(stream_decoder.o):stream_decoder.c:(.text+0x184): undefined reference to `_imp___iob'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/Users/Humor/Downloads/SFML-2.6.1-sources/SFML-2.6.1/extlibs/libs-mingw/x86/libFLAC.a(stream_decoder.o):stream_decoder.c:(.text+0x400): undefined reference to `_imp___iob'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/Users/Humor/Downloads/SFML-2.6.1-sources/SFML-2.6.1/extlibs/libs-mingw/x86/libFLAC.a(stream_decoder.o):stream_decoder.c:(.text+0x4db1): undefined reference to `_imp___iob'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/Users/Humor/Downloads/SFML-2.6.1-sources/SFML-2.6.1/extlibs/libs-mingw/x86/libFLAC.a(stream_decoder.o):stream_decoder.c:(.text+0x5064): more undefined references to `_imp___iob' follow
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\SFML\Audio\CMakeFiles\sfml-audio.dir\build.make:453: lib/sfml-audio-2.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:333: src/SFML/Audio/CMakeFiles/sfml-audio.dir/all] Error 2
mingw32-make: *** [makefile:155: all] Error 2

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Trouble building SFML from source.
« Reply #5 on: August 27, 2024, 10:53:15 pm »
Oh, I thought you were building master. If you're building 2.6.1, you'll need a non-UCRT MinGW compiler.

Or you could build the 2.6.x branch, which contains some fixes, including support for UCRT MinGW compilers.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Trouble building SFML from source.
« Reply #6 on: August 28, 2024, 12:23:45 am »
I don't understand. Shouldn't the latest SFML be able to be compiled from source using the latest GCC compiler? I am using GCC 14.2.0 and SFML 2.6.1.

EDIT:

Nevermind. I got the latest SFML binary to work with GCC 13 instead. I'm just gonna give up on building SFML from source. Thanks for the help anyways. :)
« Last Edit: August 28, 2024, 01:18:43 am by Me-Myself-And-I »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Trouble building SFML from source.
« Reply #7 on: August 28, 2024, 08:20:46 am »
It does, if you use a MSVCRT-based compiler instead of an UCRT one, or if you rebuild SFML's dependencies with your URCT-based compiler, which is what we did on the 2.6.x branch.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

svet-am

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Re: Trouble building SFML from source.
« Reply #8 on: September 06, 2024, 04:44:13 am »
@eXpl0it3r - I am just getting in to SFML development (and desktop application development in general -- I'm an embedded systems guy by trade).

I'm running in to issues (namely the infamous _setjmp linker failure with libfreetype) with my UCRT compiler toolchain (which I would prefer to use) and the in-built SFML dependencies.  When you say "recompile the dependencies from source", I've been trying to figure out how to do exactly that but can't quite get it.  Is that process covered in the tutorials?  If so, I've not seen it and would appreciate the pointer to the information so I can read it.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Trouble building SFML from source.
« Reply #9 on: September 06, 2024, 08:07:34 am »
We have added newly built dependencies using UCRT to the SFML 2.6.x branch.
If you use the SFML CMake Template, you'll automatically fetch the latest changes from that branch and build it with your solution.

As such, you no longer have to rebuild SFML's dependencies.
And this isn't covered in any tutorial, but there's a repo that has some tooling around building the dependencies.
For SFML 3, we plan to fetch all the dependencies source code and always build them from scratch, instead of shipping binaries in the repo.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything