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

Author Topic: Will one SFML project run on different computers?  (Read 8635 times)

0 Members and 1 Guest are viewing this topic.

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Will one SFML project run on different computers?
« on: August 16, 2016, 06:15:42 pm »
Hello. I made a SFML project, using custom SFML build, because official didn't work on my machine. Then I updated my PC to Windows 7 64 bit, and my previous project crashed on start. Then I rebuilt SFML for new PC, and connected it to my project, it ran perfectly. Why  that happended and will it happen on other machines? (for example, my friend's PC)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Will one SFML project run on different computers?
« Reply #1 on: August 16, 2016, 06:19:43 pm »
Well that depends why it crashed and what platform specific code you wrote. Generally Windows binaries can work across multiple versions of Windows. For VS binaries you need to make sure that the correct redistribution package are installed.

So what crashes did you experience?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #2 on: August 16, 2016, 09:01:33 pm »
Just "The program has stopped working..." like this:

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Will one SFML project run on different computers?
« Reply #3 on: August 16, 2016, 09:43:42 pm »
Use your debugger to find the root cause..

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #4 on: August 21, 2016, 07:19:38 pm »
So, I sent my game to my friend, and it doesn't works on his PC saying that "libgcc_s_sjlj_1.dll" is missing. How it can be fixed. Game perfectly runs on my PC.

Ziburinis

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #5 on: August 21, 2016, 09:56:36 pm »
Did you try this?
https://stackoverflow.com/questions/35332463/in-codeblocks-with-compiler-gcc-libgcc-s-sjlj-1-dll-is-missing

Gotta love the way Microsoft handles shared objects :P

Basically, a .so or .dll file is an executable with entry points that other programs can find. So when you download a development library it comes with all of the header files, so that the compiler can say "there's a function called drawWindow() that I can find at this entry point in the run time library". The end user doesn't need the development library, but they still need the run time library.

A runtime library is usually dynamically linked, that is, a .dll (Windows) or a .so (Linux). This way, you can have multiple programs sharing the same library and reduce the size on your disk, the memory consumed, and the size of downloads.

I've never needed to statically link something, but it's more common in a Windows environment. My understanding is that all of the libraries are plopped into the executable, so you're assured it exists on your friends computer.

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #6 on: August 21, 2016, 10:04:25 pm »
I read that this dll controls error handling, and I got this error before I used custom SFML build.

Ziburinis

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #7 on: August 21, 2016, 10:42:11 pm »
Regardless of what it does, the executable wants a library and it wont run until it finds it. You can either distribute your game with a dll file and put it somewhere the executable will find when it runs, or you can include it straight into your code, or you can try to remove the dependency.

I would recommend trying the link I posted, and if the resulting executable isn't too huge, and you don't get more errors, just go with that option.

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #8 on: August 21, 2016, 10:47:29 pm »
Including this lib in program is not a problem. My question is: why my game runs on my pc very well, but crashes on other pc?

Ziburinis

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #9 on: August 21, 2016, 11:04:16 pm »
Oh, it's because you installed MinGW/codeblocks/whatever it was, I assume. That would have put all of the gcc runtime libraries somewhere in your system path. If you installed MinGW on another computer, it would presumably run there, too.

The path is a system wide variable that tells the OS where to look for dll files. Google says you can see its value by running echo %PATH% in the command line.

The executable file lists the libraries it needs at the beginning, and when you start it the path variable is checked. On linux, you can print out where it's finding/not finding a library by running ldd executable. It looks like it's a bit more involved in Windows:
https://stackoverflow.com/questions/1993673/what-is-the-equivalent-of-linuxs-ldd-on-windows

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #10 on: August 21, 2016, 11:48:18 pm »
If I want to make game public, publish to Steam, how can I make game runnable on every Windows system?

Ziburinis

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #11 on: August 22, 2016, 12:28:43 am »
If your error is still "libgcc_s_sjlj_1.dll missing", then as I said you have three options:

1. Statically link in the gcc library, as the earlier stack overflow answer suggested.
2. Include the necessary dll and put it in the proper directory during installation.
3. Remove the dependency (I'd guess this means compiling with visual studio).

I'm not a Windows guru, as you can probably guess. Hopefully another forum member will correct me if I'm wrong on any of this.

Ziburinis

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #12 on: August 22, 2016, 05:12:02 am »
The path is a system wide variable that tells the OS where to look for dll files. Google says you can see its value by running echo %PATH% in the command line.

^ serious brain fart on my part. I'm all foggy from allergy meds today, sorry.

PATH just specifies where it looks for executables. Here's the search path for DLLs:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Re: Will one SFML project run on different computers?
« Reply #13 on: August 22, 2016, 10:25:05 am »
Direct solution to your current problem:

1) Locate your MinGW's install directory.
2) Locate the mentioned DLL from the MinGW's bin directory
3) Copy the DLL next to the .exe
4) Distribute your game with the DLLs

Keep in mind that you'll also need the DLL that contains "libgcc".

All of this is outlined in the official tutorial. ;)

PATH just specifies where it looks for executables. Here's the search path for DLLs:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx
There is a search order and PATH is searched as well. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Will one SFML project run on different computers?
« Reply #14 on: August 22, 2016, 04:33:55 pm »
So, I included libgcc_s_sjlj_1.dll in folder with executable, but it complained about libstdc++-6.dll. I included it and everything worked perfectly.