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

Author Topic: CMake Libraries Version/Dependency Problem  (Read 9073 times)

0 Members and 1 Guest are viewing this topic.

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
CMake Libraries Version/Dependency Problem
« on: May 23, 2014, 12:49:47 am »
Hello,

I had a project in Visual Studio 2012 with working code that used SFML-2.1. I updated it to Visual Studio 2013 and quickly discovered that I needed to get the 2013 version of SFML libraries. Here are a few of the errors I got:


(click to show/hide)


I would much prefer to simply download and use them, however there's no 2013 version on the SFML website and the only files I found for it in the forums were dynamic; I'm using the static libraries.

I got CMake gui to work properly using the tutorial: configure, configure, generate, etc. No problems. I used the VC++12 compiler option or whatever (version 12 is for VS2013).

Then I opened it in VS2013, built the debug and release libraries, copied them over into my now 2013 project, updated the include header files for SFML as well, and tried to run it. I got a whole bunch of linker errors that I have never seen before, which seem to be related to SFML's dependencies now. Here are a few:


(click to show/hide)


Just for the heck of it I tried adding this line to my code:

#pragma comment(lib, "OpenGL32.lib")

The GL errors seem to go away, and now I seem to get GLEW errors. Is it possible that this statement in the CMake tutorial:

Quote
On Windows and Mac OS X, all the needed dependencies are provided directly with SFML, so you don't have to download/install anything. Compilation will work out of the box.

would somehow not be true? I followed the tutorial by the letter, I'm confident I did not miss anything, I triple checked that I used the updated version of SFML's include header files and library files, I tried running in release and debug mode, etc. What should I do?

Thanks,

- Andrew

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #1 on: May 23, 2014, 12:59:16 am »
A while back static linking was changed so that more (all?) of the dependencies have to be specified manually.  I believe https://github.com/SFML/SFML/wiki/FAQ#build-link-static is the closest thing we have at the moment to an official list of what exactly needs to be added to the link line.  Presumably the official tutorials for 2.2 will clarify this.
« Last Edit: May 23, 2014, 01:01:23 am by Ixrec »

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #2 on: May 23, 2014, 01:13:12 am »
Okay, so, from looking at that diagram I conclude that if I'm going to link network, audio, window, and graphics, I'll need to also link: ws2_32, openal32, sndfile, opengl32, gdi32, freetype, glew, and jpeg. Is this correct?

Also, is this linking supposed to happen in the VS2013 binaries solution (where I build the 2013 SFML libraries), or do I need to link in my actual project? Do I just need to add them to the link input list? Etc.

Thanks,

- Andrew

G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: CMake Libraries Version/Dependency Problem
« Reply #3 on: May 23, 2014, 01:14:20 am »
In your actual project. Same place you link sfml-graphics-s etc.
« Last Edit: May 23, 2014, 01:16:05 am by G. »

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #4 on: May 23, 2014, 01:38:48 am »
Is there any practical way I would be able to combine all of these libraries into one, then?

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #5 on: May 23, 2014, 02:08:24 am »
Alright I give up. 2012 it is...

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #6 on: May 23, 2014, 04:52:53 pm »
Is there any practical way I would be able to combine all of these libraries into one, then?

No  ??? this wouldn't even make sense to do.

Alright I give up. 2012 it is...

Come SFML 2.2 and static linking you will be doing the exact same thing in 2012, so why not just do it now and get over it?
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #7 on: May 23, 2014, 07:46:06 pm »
Because now there isn't sufficient information or support for how to do it.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: CMake Libraries Version/Dependency Problem
« Reply #8 on: May 23, 2014, 07:57:45 pm »
Because now there isn't sufficient information or support for how to do it.
There's a whole tutorial that explains every single step of building SFML for any platform. Then there are nightly builds. There are various threads on this forum and additional hints on the Wiki. Some people have even written their installers to make the task of building SFML even easier. And of course there's a whole community answering specific questions. You call that insufficient information?

In programming, you won't get around doing a bit of research to achieve your goals. I really recommend you learn how to properly build SFML, then you know it once and forever. This knowledge can be very valuable, as SFML might not be the last library you're using. And building SFML is really not as difficult as you might imagine. However, it's crucial that you read the tutorial and other advice carefully. A lot of people quickly glance over it, miss important details and waste a tremendous amount of time debugging -- much more than they saved in the first place.
« Last Edit: May 23, 2014, 08:00:30 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #9 on: May 23, 2014, 08:04:56 pm »
Seriously, building SFML from source is trivial compared to most other stuff. Just learn it once and for all.

In a nutshell it's basically just
 - git clone
 - mkdir build
 - cd build
 - cmake ..
 - make
 - sudo make install

and you're done. Takes maybe 5-10 minutes (tops).
Details differ by platform, but that's the gist of it; clone the repo, generate build files, build, install ...

Try something like building the Linux kernel, X.org, glibc, Qt, dcmtk and similar some day - not that they are hard, but just that in comparison; SFML is a walk in the park.
You might as well learn your way around the preprocessor, compiler & linker as well as tools such as CMake, SCons, make, msbuild etc. and (d)vcs tools like svn, git, mercurial and the like, sooner rather than later if you are serious about building software.
« Last Edit: May 23, 2014, 08:10:31 pm by Jesper Juhl »

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #10 on: May 23, 2014, 08:52:23 pm »
What I mean is there isn't sufficient information about the dependencies. All it does is list a bunch of libraries, some of which aren't even found in the extlibs folder.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #11 on: May 23, 2014, 08:55:10 pm »
All the dependencies are free open source libraries. A quick Google search locates them all.
On Linux all you have to do is just install them via your package manager since most distros ship them. On Windows and other "challenged" platforms you may have to download and build them yourself, but even then they are not hard to find.

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: CMake Libraries Version/Dependency Problem
« Reply #12 on: May 23, 2014, 09:30:37 pm »
My point is just that I use SFML so I don't have to deal with problems like this. I understand that the change was made for good reasons, whatever they are, but now it's losing its ease of use for those who use VS2013 or other currently unsupported compilers/IDE's. Believe me though, I understand the extent as to how much coding can be a hassle; I just like to avoid it wherever possible. For now, I'd rather just use VS2012 so I can continue working on my own code.

Another problem with the switch is that if I use SFML in more than one project, I now have to copy a bunch of libraries and link all of them.

I'll give it another shot when I have time.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10853
    • View Profile
    • development blog
    • Email
AW: CMake Libraries Version/Dependency Problem
« Reply #13 on: May 23, 2014, 09:34:45 pm »
For Windows and OS X all the dependencies are provided in the extlibs directory.

Besides that it's not SFML's job nor goal to teach people how to generally build, link and inter-link libraries. This is general C++ development knowledge that needs to be acquired differently.

Still we try to make things as easy as possible and if you have specific suggestions on how to improve the tutorials, we'd be happy to hear them.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Andrew

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: AW: CMake Libraries Version/Dependency Problem
« Reply #14 on: May 23, 2014, 10:01:11 pm »
For Windows and OS X all the dependencies are provided in the extlibs directory.

Are you sure about that? Because I didn't find all of the ones listed in the link Ixrec mentioned (https://github.com/SFML/SFML/wiki/FAQ#build-link-static).

 

anything