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

Author Topic: SFML 2.4 does not compile with g++. JPEG error. (Linux)  (Read 4970 times)

0 Members and 1 Guest are viewing this topic.

DasOhmoff San

  • Guest
SFML 2.4 does not compile with g++. JPEG error. (Linux)
« on: September 01, 2016, 06:13:21 pm »
Hi, i recently wanted to try out SFML 2.4. I am currently using Linux (Fedora 24/Korora 24).
SFML 2.4 is not in the repositorys yet, so I downloaded "GCC - 64-bit" from the download page
and stored it in my Documents folder, after i extracted it.

So that's the command:
g++ Test.cpp -I ~/Dokumente/C++/SFML-2.4.0/include/ -L ~/Dokumente/C++/SFML-2.4.0/lib -lsfml-graphics -lsfml-window -lsfml-system

That's the output:
/usr/bin/ld: warning: libjpeg.so.8, needed by /home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_std_error@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_set_defaults@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_start_compress@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_set_quality@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_finish_compress@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_CreateCompress@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_destroy_compress@LIBJPEG_8.0'
/home/DasOhmoff/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so: undefined reference to `jpeg_write_scanlines@LIBJPEG_8.0'
collect2: Fehler: ld gab 1 als Ende-Status zurück

Folder content:
[17:55 DasOhmoff ~/Dokumente/C++]$ ls -a
.  .. SFML-2.4.0  Test.cpp

Test.cpp file:
#include <SFML/Graphics.hpp>

int main()
{
        sf::Texture txtr;
        sf::Sprite sprt;

        txtr.loadFromFile("test.png");
        sprt.setTexture(txtr);

        sf::RenderWindow window(sf::VideoMode(1280, 720), "Test");
        sf::Event event;

        while(window.isOpen())
        {
                while(window.pollEvent(event))
                {
                        if(event.type == sf::Event::Closed)
                                window.close();
                }

                window.clear();
                window.draw(sprt);
                window.display();
        }

        return 0;
}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10818
    • View Profile
    • development blog
    • Email
Re: SFML 2.4 does not compile with g++. JPEG error. (Linux)
« Reply #1 on: September 01, 2016, 07:10:19 pm »
Sounds like you need to install libjpeg/libjpeg8 (or however it is called on your system) then. ;)

As far as I know we only ship SFML dependencies for Windows.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: SFML 2.4 does not compile with g++. JPEG error. (Linux)
« Reply #2 on: September 01, 2016, 08:04:36 pm »
You can try running the following command to get a detailed list of all dependencies and whether they're satisfied. If they aren't (as it appears here), you'll see that as well:

Code: [Select]
ldd ~/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so

DasOhmoff San

  • Guest
Re: SFML 2.4 does not compile with g++. JPEG error. (Linux)
« Reply #3 on: September 01, 2016, 08:37:06 pm »
Sounds like you need to install libjpeg/libjpeg8 (or however it is called on your system) then. ;)

Yeah, I thought the same.
Problem is that on my system these files are called differently (libjpeg.so.62 or something like that).
I don't know how to tell sfml to use this instead of libjpeg8. I probably have to recompile it from the source code  ????

 
You can try running the following command to get a detailed list of all dependencies and whether they're satisfied. If they aren't (as it appears here), you'll see that as well:

Code: [Select]
ldd ~/Dokumente/C++/SFML-2.4.0/lib/libsfml-graphics.so

Wow, thanks, a really nice thing.
The output is:

  linux-vdso.so.1 (0x00007ffc72778000)
  ibsfml-window.so.2.4 => not found
  ibsfml-system.so.2.4 => not found
  ibGL.so.1 => /lib64/libGL.so.1 (0x00007f82b7b4a000)
  ibSM.so.6 => /lib64/libSM.so.6 (0x00007f82b7942000)
  ibICE.so.6 => /lib64/libICE.so.6 (0x00007f82b7725000)
  ibX11.so.6 => /lib64/libX11.so.6 (0x00007f82b73e5000)
  ibXext.so.6 => /lib64/libXext.so.6 (0x00007f82b71d3000)
  ibfreetype.so.6 => /usr/lib64/freetype-freeworld/libfreetype.so.6 (0x00007f82b6f23000)
  ibjpeg.so.8 => not found
  ibpthread.so.0 => /lib64/libpthread.so.0 (0x00007f82b6d07000)
  ibrt.so.1 => /lib64/librt.so.1 (0x00007f82b6afe000)
  ibxcb.so.1 => /lib64/libxcb.so.1 (0x00007f82b68dc000)
  ibX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f82b66da000)
  ibxcb-image.so.0 => /lib64/libxcb-image.so.0 (0x00007f82b64d4000)
  ibxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007f82b62c6000)
  ibudev.so.1 => /lib64/libudev.so.1 (0x00007f82b62a5000)
  ibstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f82b5f1d000)
  ibm.so.6 => /lib64/libm.so.6 (0x00007f82b5c14000)
  ibgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f82b59fd000)
  ibc.so.6 => /lib64/libc.so.6 (0x00007f82b563a000)
  ibexpat.so.1 => /lib64/libexpat.so.1 (0x00007f82b540e000)
  ibxcb-dri3.so.0 => /lib64/libxcb-dri3.so.0 (0x00007f82b520b000)
  ibxcb-present.so.0 => /lib64/libxcb-present.so.0 (0x00007f82b5007000)
  ibxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f82b4dff000)
  ibxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x00007f82b4bf5000)
  ibxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x00007f82b49f0000)
  ibxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007f82b47e9000)
  ibxshmfence.so.1 => /lib64/libxshmfence.so.1 (0x00007f82b45e6000)
  ibglapi.so.0 => /lib64/libglapi.so.0 (0x00007f82b43b6000)
  ibselinux.so.1 => /lib64/libselinux.so.1 (0x00007f82b418f000)
  ibXdamage.so.1 => /lib64/libXdamage.so.1 (0x00007f82b3f8c000)
  ibXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007f82b3d85000)
  ibxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x00007f82b3b6c000)
  ibxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x00007f82b3967000)
  ibXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x00007f82b3760000)
  ibdrm.so.2 => /lib64/libdrm.so.2 (0x00007f82b3551000)
  ibdl.so.2 => /lib64/libdl.so.2 (0x00007f82b334d000)
  ibuuid.so.1 => /lib64/libuuid.so.1 (0x00007f82b3147000)
  ibz.so.1 => /lib64/libz.so.1 (0x00007f82b2f31000)
  ibbz2.so.1 => /lib64/libbz2.so.1 (0x00007f82b2d20000)
  ibpng16.so.16 => /lib64/libpng16.so.16 (0x00007f82b2aed000)
  lib64/ld-linux-x86-64.so.2 (0x0000564bce128000)
  ibXau.so.6 => /lib64/libXau.so.6 (0x00007f82b28e9000)
  ibxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f82b26e4000)
  ibxcb-util.so.1 => /lib64/libxcb-util.so.1 (0x00007f82b24de000)
  ibcap.so.2 => /lib64/libcap.so.2 (0x00007f82b22d9000)
  ibresolv.so.2 => /lib64/libresolv.so.2 (0x00007f82b20be000)
  ibpcre.so.1 => /lib64/libpcre.so.1 (0x00007f82b1e4b000)
  ibattr.so.1 => /lib64/libattr.so.1 (0x00007f82b1c45000)
It seems like only the jpeg error matters, because sfml-window and sfml-system should be solved after the library path is added to g++. At least that's what I think.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10818
    • View Profile
    • development blog
    • Email
Re: SFML 2.4 does not compile with g++. JPEG error. (Linux)
« Reply #4 on: September 02, 2016, 03:58:28 am »
It's always a good idea to rebuild SFML when you use SFML on a different distro than the binaries were created on.

However you should be able to install the libjpeg8-dev or similar. libjpeg exists in multiple versions and I guess you have only the 6.something installed while SFML was built with 8.something. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

DasOhmoff San

  • Guest
Re: SFML 2.4 does not compile with g++. JPEG error. (Linux)
« Reply #5 on: September 04, 2016, 04:32:17 pm »
Ok, thank you for your help guys.
So I finally managed to install SFML.
I compiled it from source with cmake.

After some trouble I found out that g++ had a bug and had to be patched, because I got an error when I was trying to compile my test program.

After I did that, I could remake SFML, and compile my programs.
I moved the lib files into /usr/lib64 and the include files to /usr/include.
Now everything is working fine.  ;D

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 2.4 does not compile with g++. JPEG error. (Linux)
« Reply #6 on: September 14, 2016, 12:30:15 am »
Hello,

I'm posting here because I'm having the same issue:
Code: [Select]
/usr/bin/ld: warning: libjpeg.so.8, needed by /usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so, not found (try using -rpath or -rpath-link)
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_std_error@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_set_defaults@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_start_compress@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_set_quality@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_finish_compress@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_CreateCompress@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_destroy_compress@LIBJPEG_8.0'
/usr/local/SFML-2.4.0/lib/libsfml-graphics-d.so: undefined reference to `jpeg_write_scanlines@LIBJPEG_8.0'
collect2: error: ld returned 1 exit status

I know I can rebuild SFML, but as I'm distributing binaries it is annoying if users can't then just use my library + SFML downloaded from SFML website.

I checked what I have on my system (Debian 9)
Code: [Select]
$ locate libjpeg.so
/usr/lib/x86_64-linux-gnu/libjpeg.so
/usr/lib/x86_64-linux-gnu/libjpeg.so.62
/usr/lib/x86_64-linux-gnu/libjpeg.so.62.2.0

And a search through the repo shows this:
Code: [Select]
apt-cache search libjpeg
gem-plugin-jpeg - Graphics Environment for Multimedia - JPEG support
imgsizer - Adds WIDTH and HEIGHT attributes to IMG tags in HTML files
jp2a - converts jpg images to ascii
libjpeg-dev - Development files for the JPEG library [dummy package]
libjpeg-turbo-progs - Programs for manipulating JPEG files
libjpeg62-turbo - libjpeg-turbo JPEG runtime library
libjpeg62-turbo-dev - Development files for the libjpeg-turbo JPEG library
libturbojpeg0 - TurboJPEG runtime library - SIMD optimized
libturbojpeg0-dev - Development files for the TurboJPEG library
Showing details of package libjpeg-dev says that it only depends on libjpeg62-turbo-dev. So obviously I won't get libjpeg8 here.

I can't say I'm satisfied with rebuilding SFML, providing my library and have some users happy because they also have libjpeg.so.62, and some others unhappy because they have libjpeg.so.8 and they need to rebuild my library.

Is there any solution at all to provide suitable binaries with my current system?
Also I don't know how related are libjpeg.so.8 and lijpeg.so.62. Is 62 just a newer (incompatible) version or is it using an unrelated versioning scheme?

Thanks,
Ceylo
Want to play movies in your SFML application? Check out sfeMovie!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10818
    • View Profile
    • development blog
    • Email
Re: SFML 2.4 does not compile with g++. JPEG error. (Linux)
« Reply #7 on: September 14, 2016, 12:50:09 am »
Quite honestly the provided Linux binaries on the website are more for completion's sake than to actually be a recommend way to get Linux binaries. Every Linux distro (I know of) has a package manager and that should be used to retrieve the SFML binaries. If the package manager doesn't provide the version you want, then - as with pretty much every library in existence - you'll need to build SFML yourself or use the CI snapshot builds, which however use the same system as the package that was created for the website.
Another reason why the provided binaries on the download page are not recommended is simply because there's no guarantee that they'll work on any other distro. Until now we seem to have been lucky and got away with it.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything