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

Author Topic: libsfml-system has undefined references to libjpeg linking "Hello SFML" in Linux  (Read 6100 times)

0 Members and 1 Guest are viewing this topic.

altersun

  • Newbie
  • *
  • Posts: 2
    • View Profile
I'm running 64-bit Ubuntu 10.04 with g++ 4.4. I downloaded the 64-bit SFML 2.0 precompiled headers and shared object files and installed them in /usr/include and /usr/lib respectively. However, when linking, I'm getting an error that libsfml-system has undefined references to libjpeg. Funny thing is, I have libjpeg installed! I can see it in the file system and I can confirm that Ubuntu knows it's installed with the package manager Synaptic. Any idea what could be causing this?

I tried it again with the headers and SOs for 1.6 and got the same result.


$ g++ -c main.cpp -I/usr/include

$ g++ main.o -o sfml_app -L/usr/lib -lsfml-graphics -lsfml-window -lsfml-system
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_finish_compress@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_write_scanlines@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_std_error@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_set_quality@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_set_defaults@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_CreateCompress@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_start_compress@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_destroy_compress@LIBJPEG_6.2'
/usr/lib/libsfml-graphics.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_6.2'
collect2: ld returned 1 exit status

$ find /usr/lib/ -iname "libjpeg*" -print
/usr/lib/debug/usr/lib/libjpeg.so.62.0.0
/usr/lib/libjpeg.a
/usr/lib/libjpeg.so.62
/usr/lib/gthumb/modules/libjpegtran.so
/usr/lib/libjpeg.la
/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libjpeg.so
/usr/lib/libjpeg.so
/usr/lib/libjpeg.so.62.0.0


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
It's weird. The version is even the same.

Can you print the symbols that /usr/lib/libjpeg.so.62.0.0 exports? (I have no idea how to do that on Linux, so don't ask me -- I just know that it can be done).
Laurent Gomila - SFML developer

altersun

  • Newbie
  • *
  • Posts: 2
    • View Profile
Apologies, I just noticed that the thread topic is incorrect - the shell dump shows that libsfml-graphics.so is where I'm having the issue, not libsfml-system.

I used the readelf command to pull the symbols from libjpeg.so.62.0.0. The results are pretty big, so rather than just post them here I'll link to pastebin.

Symbol table:
http://pastebin.com/XsMhTRNU

Whole output:
http://pastebin.com/n26eySjb

I noticed all the symbols that libsfml-graphics claims it can't find seem to be in there. I had the same problem on another computer also running Ubuntu 10.04...so maybe it's unique to Ubuntu's brand of libjpeg they keep in their repository?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
I really have no idea, sorry :-\
Laurent Gomila - SFML developer

jacob

  • Newbie
  • *
  • Posts: 5
    • View Profile
I had this same issue but compiling SFML from source resolved it so I doubt it is an issue with libjpeg. I will also test this on Fedora later today though to make sure. (I know this is late but since I came across this post I though I might as well give some updated information).

Anonymouseable

  • Newbie
  • *
  • Posts: 14
    • View Profile
Try adding -ljpeg to the commandline?