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

Author Topic: sfml2 linker error with code::blocks on ubuntu 10.10  (Read 5256 times)

0 Members and 1 Guest are viewing this topic.

sirGustav

  • Newbie
  • *
  • Posts: 22
    • View Profile
sfml2 linker error with code::blocks on ubuntu 10.10
« on: January 31, 2011, 11:41:44 pm »
I grabbed revision 1783 of the sfml2 from svn, cmake generated a codeblocks/makefile and tried to build it. I had to install libfreetype6-dev, libjpeg8-dev, libopenal-dev, libglew1-5dev and libsndfile1-dev for cmake to generate code::blocks files and libxrandr-dev for it to build(#include <X11/extensions/Xrandr.h> in src/SFML/Window/Linux/VideoModeImpl.cpp). This was easy to solve, but it would be nice to have a list of dependencies(just a hint).

Both shared and not-shared built fine, but I cant get the examples to "run". Static won't build and shared is missing dependencies:

First error when build "window" sample:
Code: [Select]
../../lib/libsfml-window-s.a(VideoModeImpl.cpp.o): In function `sf::priv::VideoModeImpl::GetDesktopMode()':
VideoModeImpl.cpp:(.text+0xdb): undefined reference to `XRRGetScreenInfo'
VideoModeImpl.cpp:(.text+0xf4): undefined reference to `XRRConfigCurrentConfiguration'
VideoModeImpl.cpp:(.text+0x107): undefined reference to `XRRConfigSizes'
VideoModeImpl.cpp:(.text+0x15d): undefined reference to `XRRFreeScreenConfigInfo'

I get FT_ (freetype if I'm not misstaken) errors from other samples. This looks to me that it's missing to link to some libraries so a wild guess is either that the cmake configuration is bad, something is badly installed on my part or that static is not supported.

The dynamic version builds but won't start:
Quote
error while loading shared librarues: libsfml-window.so.2.0: cannot open shared object file: No such file or directory


I guess that the cause is the same, but the dynamic version fails to load since it's missing some dependencies. So anyone got any ideas?

edit: unless there has been a name change in the build I got and the 1783 version of the supplied FindSFML.cmake, it is unable to find sfml-main.lib (because of the missing -s) when requesting the static library.

Lupinius

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #1 on: February 01, 2011, 12:10:20 am »
Try running "sudo apt-get build-dep libsfml-dev" in a terminal to make sure you have installed all dependencies. Then try compiling again.

sirGustav

  • Newbie
  • *
  • Posts: 22
    • View Profile
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #2 on: February 01, 2011, 07:06:54 am »
didn't help, sorry :(
same error

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #3 on: February 01, 2011, 07:13:54 am »
well the static complain because: http://www.sfml-dev.org/forum/viewtopic.php?p=26407#26407

The shared I can't help you with, without further information.

Dependency list can be found here: http://www.sfml-dev.org/tutorials/1.6/start-linux.php at the bottom.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #4 on: February 01, 2011, 07:42:52 am »
Quote
error while loading shared librarues: libsfml-window.so.2.0: cannot open shared object file: No such file or directory

Is the path where you installed it in the LD_LIBRARY_PATH environment variable?

Quote
unless there has been a name change in the build I got and the 1783 version of the supplied FindSFML.cmake, it is unable to find sfml-main.lib (because of the missing -s) when requesting the static library.

sfml-main is static, there's no dynamic version. And it's for Windows only, by the way.
Laurent Gomila - SFML developer

sirGustav

  • Newbie
  • *
  • Posts: 22
    • View Profile
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #5 on: February 01, 2011, 07:55:28 pm »
Quote from: "Groogy"
well the static complain because: http://www.sfml-dev.org/forum/viewtopic.php?p=26407#26407
Quote from: "Laurent"
On Linux, external libraries are not included in SFML static libs

Dynamic linking on linux it is.
Just wondering... is this "not including externals" out of choice or force(ie not possible)?
I only do static linking on windows b/c of the ati bug, so I guess this problem is not present on linux.

Quote from: "Groogy"
Dependency list can be found here: http://www.sfml-dev.org/tutorials/1.6/start-linux.php at the bottom.
figures... rtfm, fail on me :/

Quote from: "Laurent"
Quote
error while loading shared librarues: libsfml-window.so.2.0: cannot open shared object file: No such file or directory

Is the path where you installed it in the LD_LIBRARY_PATH environment variable?
No it wasn't and I kinda missed the "sudo make install" part too. sorry... rtfm yet again.

Quote from: "Laurent"
Quote
unless there has been a name change in the build I got and the 1783 version of the supplied FindSFML.cmake, it is unable to find sfml-main.lib (because of the missing -s) when requesting the static library.

sfml-main is static, there's no dynamic version. And it's for Windows only, by the way.
Sorry for not being clear... this issue was/is on windows. I guess I should have made another thread about it..

Dynamic linking on windows, looks for sfml-main.lib and finds it. Static linking looks for sfml-main-s.lib and doesn't, since it should look for sfml-main. This is, of course, assuming that this is correct:
Code: [Select]
set(SFML_STATIC_LIBRARIES ON)
find_package(SFML COMPONENTS system window main)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #6 on: February 02, 2011, 07:46:31 am »
Quote
Just wondering... is this "not including externals" out of choice or force(ie not possible)?
I only do static linking on windows b/c of the ati bug, so I guess this problem is not present on linux.

This is not a choice. There's no linking step when creating a static library, so linking has to happen in the final application.

Quote
I only do static linking on windows b/c of the ati bug, so I guess this problem is not present on linux.

Indeed.

Quote
Dynamic linking on windows, looks for sfml-main.lib and finds it. Static linking looks for sfml-main-s.lib and doesn't, since it should look for sfml-main. This is, of course, assuming that this is correct:

I guess that FindSFML.cmake doesn't handle sfml-main properly :)
Thanks for reporting it.
For now, remove main from the list of components and link it manually.
Laurent Gomila - SFML developer

sirGustav

  • Newbie
  • *
  • Posts: 22
    • View Profile
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #7 on: February 03, 2011, 07:28:01 am »
Quote from: "Laurent"
For now, remove main from the list of components and link it manually.
I was lazy and just made a copy :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sfml2 linker error with code::blocks on ubuntu 10.10
« Reply #8 on: February 04, 2011, 11:03:54 pm »
I fixed FindSFML.cmake, "main" should now work fine.
Laurent Gomila - SFML developer

 

anything