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

Author Topic: Problem with colors on Ubuntu  (Read 1974 times)

0 Members and 1 Guest are viewing this topic.

simfouy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Problem with colors on Ubuntu
« on: April 11, 2017, 12:10:27 pm »
Hi,
I recently (yesterday) installed libsfml-dev on Ubuntu 16.04, and I get a weird error while trying to load my graphic lib (using sfml) trough dlsym:
Quote
undefined symbol: _ZN2sf5Color5BlackE
I tried on an other system (ArchLinux) and everything works fine. This is the part causing problem :
Quote
sf::Color::Black
I tried to change the color (to :
Quote
sf::Color::Blue
), and the error becomes
Quote
undefined symbol: _ZN2sf5Color5BlueE
So the error is from sf::Color
Any ideas ?  :'(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10829
    • View Profile
    • development blog
    • Email
Re: Problem with colors on Ubuntu
« Reply #1 on: April 11, 2017, 12:42:03 pm »
Do you link the graphics module in the right order?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

simfouy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with colors on Ubuntu
« Reply #2 on: April 11, 2017, 12:46:15 pm »
I compile my graphic lib with
Quote
-lsfml-graphics -lsfml-window -lsfml-system
. This lib includes all the SFML stuff.
I then link at runtime but dlopens fails with the error I gave in the first post.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10829
    • View Profile
    • development blog
    • Email
Re: Problem with colors on Ubuntu
« Reply #3 on: April 11, 2017, 12:46:55 pm »
dlopen fails?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

simfouy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with colors on Ubuntu
« Reply #4 on: April 11, 2017, 12:52:59 pm »
Yes, it returns NULL and dlerror return this:
Quote
undefined symbol: _ZN2sf5Color5BlackE

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10829
    • View Profile
    • development blog
    • Email
Re: Problem with colors on Ubuntu
« Reply #5 on: April 11, 2017, 01:10:45 pm »
Ah okay, I didn't realize that you were using dlsym, must have jumped that line. :D

The colors are typedef-ed in the SFML header, so they'd generally get statically "linked" into your application. Not sure how one deals with header defines when using dlsym.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

simfouy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with colors on Ubuntu
« Reply #6 on: April 11, 2017, 01:14:08 pm »
Well I include these headers in the lib I'm calling with dlopen:
Quote
#include <SFML/Graphics.hpp>
#include <SFML/Window/Keyboard.hpp>
Is that enough ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10829
    • View Profile
    • development blog
    • Email
Re: Problem with colors on Ubuntu
« Reply #7 on: April 11, 2017, 01:15:29 pm »
In your build command, did you place your cpp file after the linker arguments?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

simfouy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with colors on Ubuntu
« Reply #8 on: April 11, 2017, 01:21:24 pm »
In your build command, did you place your cpp file after the linker arguments?
Yes  :'( But as I said, this code works on ArchLinux but not on my Ubuntu  :'(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10829
    • View Profile
    • development blog
    • Email
Re: Problem with colors on Ubuntu
« Reply #9 on: April 11, 2017, 01:38:53 pm »
Well you shouldn't. If your code depends on the libraries, you need to put them in front of the linker arguments.
Just because something works on system X doesn't mean it's generally correct. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

simfouy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with colors on Ubuntu
« Reply #10 on: April 11, 2017, 01:43:39 pm »
Well you shouldn't. If your code depends on the libraries, you need to put them in front of the linker arguments.
Just because something works on system X doesn't mean it's generally correct. ;)
I'm not sure what you mean by linker. I'm linking only at runtime