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

Author Topic: Static library linking Linux 2.0  (Read 2519 times)

0 Members and 1 Guest are viewing this topic.

falconmick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Static library linking Linux 2.0
« on: November 24, 2012, 04:15:18 pm »
For some reason I can't link static libraries, all I can do is use dynamic lib's to get it to work...

any solutions guys?

This is the errors I get

undefined reference to 'glClearColor'
etc etc

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static library linking Linux 2.0
« Reply #1 on: November 24, 2012, 09:49:47 pm »
You must link to all the dependencies of SFML, the list can be found in the tutorial if I remember correctly.
Laurent Gomila - SFML developer

falconmick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Static library linking Linux 2.0
« Reply #2 on: November 25, 2012, 06:55:50 am »
http://sfmlcoder.wordpress.com/2011/08/16/building-sfml-2-0-with-make-for-gcc/

I followed this tutorial... I think the issue is that I have to glew that is provided in extLibs/libs-mingw isn't statically built.. or somthing like that...

my cmake commands were this:

Quote
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=FALSE
make
sudo make install

cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=FALSE
make
sudo make install

how should I use cmake to compile? do I need to edit the cmake file????
I've tried specifying the exlib/ming to the linker search directory and ive idded extlibs/headers to compiler search directory

btw i'm using code::blocks

trying using static and specifying extlibs glew




I also tried building static where I didn't linker settings link libraries libglew and I didn't add search directories for linker or compiler for extlibs

only way it works is with dynamic libraries
« Last Edit: November 25, 2012, 07:03:14 am by falconmick »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static library linking Linux 2.0
« Reply #3 on: November 25, 2012, 10:59:15 am »
1. Don't use extlibs/mingw, it's for Windows -- use what's installed on your system, add what's missing with your package manager

2. Link all these dependencies in your final application
Laurent Gomila - SFML developer

falconmick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Static library linking Linux 2.0
« Reply #4 on: November 25, 2012, 05:22:58 pm »
you wouldn't be able to mention all the linkings required would ya?
I installed em all but no idea what their lib's are

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static library linking Linux 2.0
« Reply #5 on: November 25, 2012, 07:16:28 pm »
The complete list of dependencies is in the CMake tutorial. The exact names/paths depend on your environment (and can be found easily if you know some basic Linux commands -- I don't ;D).
Laurent Gomila - SFML developer

falconmick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Static library linking Linux 2.0
« Reply #6 on: November 26, 2012, 12:36:06 pm »
neither do I ;(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static library linking Linux 2.0
« Reply #7 on: November 26, 2012, 01:05:21 pm »
If you're on Ubuntu, which is Debian-based, the names should be:
-lpthread -lGL -lX11 -lXrandr -lfreetype -lGLEW -ljpeg -lsndfile -lopenal

Look at /usr/lib if there are names that don't match.
Laurent Gomila - SFML developer

falconmick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Static library linking Linux 2.0
« Reply #8 on: November 26, 2012, 04:18:40 pm »
thanks, ill try it out

 

anything