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

Author Topic: Why can't I use static libs for SFML on Linux?  (Read 1896 times)

0 Members and 1 Guest are viewing this topic.

Mr_Bunkers

  • Newbie
  • *
  • Posts: 11
    • View Profile
Why can't I use static libs for SFML on Linux?
« on: April 07, 2013, 11:00:04 pm »
When trying to link the SFML libraries statically on Ubuntu, I get the following errors:

Quote
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderWindow.cpp.o)||In function `sf::RenderWindow::capture() const':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderWindow.cpp|92|undefined reference to `glReadPixels'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(GLCheck.cpp.o)||In function `sf::priv::glCheckError(char const*, unsigned int)':|
/home/wuser/Development/SFML/src/SFML/Graphics/GLCheck.cpp|40|undefined reference to `glGetError'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(GLCheck.cpp.o)||In function `sf::priv::ensureGlewInit()':|
/home/wuser/Development/SFML/src/SFML/Graphics/GLCheck.cpp|116|undefined reference to `glewInit'|
/home/wuser/Development/SFML/src/SFML/Graphics/GLCheck.cpp|123|undefined reference to `glewGetErrorString'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(ImageLoader.cpp.o)||In function `sf::priv::ImageLoader::writeJpg(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, unsigned int)':|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|274|undefined reference to `jpeg_std_error'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|277|undefined reference to `jpeg_CreateCompress'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|282|undefined reference to `jpeg_stdio_dest'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|283|undefined reference to `jpeg_set_defaults'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|284|undefined reference to `jpeg_set_quality'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|297|undefined reference to `jpeg_start_compress'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|303|undefined reference to `jpeg_write_scanlines'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|307|undefined reference to `jpeg_finish_compress'|
/home/wuser/Development/SFML/src/SFML/Graphics/ImageLoader.cpp|308|undefined reference to `jpeg_destroy_compress'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::clear(sf::Color const&)':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|60|undefined reference to `glClearColor'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|61|undefined reference to `glClear'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::draw(sf::Vertex const*, unsigned int, sf::PrimitiveType, sf::RenderStates const&)':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|217|undefined reference to `glVertexPointer'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|218|undefined reference to `glColorPointer'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|219|undefined reference to `glTexCoordPointer'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|228|undefined reference to `glDrawArrays'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::pushGLStates()':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|245|undefined reference to `glPushClientAttrib'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|246|undefined reference to `glPushAttrib'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|247|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|248|undefined reference to `glPushMatrix'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|249|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|250|undefined reference to `glPushMatrix'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|251|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|252|undefined reference to `glPushMatrix'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::popGLStates()':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|264|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|265|undefined reference to `glPopMatrix'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|266|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|267|undefined reference to `glPopMatrix'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|268|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|269|undefined reference to `glPopMatrix'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|270|undefined reference to `glPopClientAttrib'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|271|undefined reference to `glPopAttrib'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::resetGLStates()':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|285|undefined reference to `glDisable'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|286|undefined reference to `glDisable'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|287|undefined reference to `glDisable'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|288|undefined reference to `glDisable'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|289|undefined reference to `glEnable'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|290|undefined reference to `glEnable'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|291|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|292|undefined reference to `glEnableClientState'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|293|undefined reference to `glEnableClientState'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|294|undefined reference to `glEnableClientState'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::applyCurrentView()':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|329|undefined reference to `glViewport'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|332|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|333|undefined reference to `glLoadMatrixf'|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|336|undefined reference to `glMatrixMode'|
/home/wuser/Development/SFML/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::applyBlendMode(sf::BlendMode)':|
/home/wuser/Development/SFML/src/SFML/Graphics/RenderTarget.cpp|353|undefined reference to `__GLEW_EXT_blend_func_separate'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

This is not a problem, as I can link dynamically, but why can't I link statically? It looks like a problem with OpenGL.
« Last Edit: April 07, 2013, 11:05:41 pm by Mr_Bunkers »

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Re: Why can't I use static libs for SFML on Linux?
« Reply #1 on: April 07, 2013, 11:18:41 pm »
When you link statically, the static libs can't be linked to other libs. Dynamic libs can be linked to other libs, though. If you want to link to SFML statically, you need to link to all of SFML's dependencies as well. So just link to OpenGL and you should be fine.
I use the latest build of SFML2

Mr_Bunkers

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Why can't I use static libs for SFML on Linux?
« Reply #2 on: April 07, 2013, 11:22:42 pm »
Okay, thank you! Btw statically linking isn't useful in my situation, I was just curious as to why it wasn't working.  :P

 

anything