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

Author Topic: SFML 2.0 32Bit on Linux 64Bit?  (Read 3575 times)

0 Members and 1 Guest are viewing this topic.

Fermi

  • Newbie
  • *
  • Posts: 3
    • View Profile
SFML 2.0 32Bit on Linux 64Bit?
« on: May 20, 2013, 01:48:03 pm »
Hello everyone!

Glad to see SFML2.0 has finally been released. :-) Unfortunately I experience the following issue right at the beginning, which is rather similar to this one about 6 years ago:

I've a fresh installed Xubuntu 13.04 amd64, I've downloaded the GCC 32-Bit development files from here and extracted them to:
Code: [Select]
<path>/SFML_2.0_32
I then went on to the linux tutorial and created a new main.cpp:
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

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

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

    return 0;
}

As next compiled the program and tried to link it:
Code: [Select]
g++ -c -I "<path>/SFML_2.0_32/include/" main.cpp
g++ main.o -o sfml-app -L "<path>/SFML_2.0_32/lib" -lsfml-graphics -lsfml-window -lsfml-system
Result:
Code: [Select]
g++ main.o -o sfml-app -L "<path>/SFML_2.0_32/lib" -lsfml-graphics -lsfml-window -lsfml-system
/usr/bin/ld: scipping incompatible <path>/SFML_2.0_32/lib/libsfml-graphics.so when searching for -lsfml-graphics
/usr/bin/ld: cannot find -lsfml-graphics
/usr/bin/ld: scipping incompatible <path>/SFML_2.0_32/lib/libsfml-window.so when searching for -lsfml-window
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: scipping incompatible <path>/SFML_2.0_32/lib/libsfml-system.so when searching for -lsfml-system
/usr/bin/ld: cannot find -lsfml-system
collect2: ld returned 1 exit status

And when using the -m32 Option:
Code: [Select]
g++ -m32 main.o -o sfml-app -L "<path>/SFML_2.0_32/lib" -lsfml-graphics -lsfml-window -lsfml-system
Code: [Select]
cs -lsfml-window -lsfml-system
/usr/bin/ld: cannot find crt1.o: File or folder not found
/usr/bin/ld: cannot find crti.o: File or folder not found
/usr/bin/ld: scipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so when searching for -lstdc++
/usr/bin/ld: scipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: scipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: scipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lc
/usr/bin/ld: scipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: scipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find crtn.o: File or folder not found
collect2: ld returned 1 exit status

What am I doing wrong? Can someone proof these errors?

Thank you very much.


« Last Edit: May 20, 2013, 03:26:26 pm by Fermi »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 32Bit on Linux 64Bit?
« Reply #1 on: May 20, 2013, 03:10:49 pm »
If you post code, you should use the code=cpp tag instead of only the code tag.

As for the error, I'm not very experienced with Linux, but from what the error says, your missing the 32bit standard libraries, thus you'll have to install them somehow.
Unless you have to release as 32bit version, I highly recommend to rebuild SFML for your system, so it'd fit all the needed libraries.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Fermi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML 2.0 32Bit on Linux 64Bit?
« Reply #2 on: May 20, 2013, 03:24:46 pm »
Unless you have to release as 32bit version, I highly recommend to rebuild SFML for your system, so it'd fit all the needed libraries.
I'd like to release most my programs as 32bit. For 64bit I compiled SFML now and it works fine.

If you post code, you should use the code=cpp tag instead of only the code tag.
Done.

As for the error, I'm not very experienced with Linux, but from what the error says, your missing the 32bit standard libraries, thus you'll have to install them somehow.
I will try to find out which those are and will post the solution later if I find one. I just thought it should run out of the box for 32bit:
Quote
Pre-compiled libraries are provided in both 32 bits and 64 bits versions. Choosing one or the other should be based on which platform you want to compile for, not which OS you have. Indeed, you can perfectly compile and run a 32 bits program on a 64 bits OS. So you'll most likely want to target 32 bits platforms, to have the largest possible audience. Choose 64 bits packages only if you have good reasons.
Besides, even the 64bit pre-compiled version threw (different) errors on my 64bit system. Anyway, that shall not be discussed here.


« Last Edit: May 20, 2013, 03:32:37 pm by Fermi »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 32Bit on Linux 64Bit?
« Reply #3 on: May 20, 2013, 03:38:03 pm »
Hmm it took a closer look at the error message again (why haven't I done this in the beginning ::)) and noticed that GCC does find the 32bit standard runtime libs, but it skips them, since it thinks they are not compatible.
Have you done a clean rebuild?

Is the -m32 really the only flag you have to set, to switch to 32bit compiling & linking?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Fermi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML 2.0 32Bit on Linux 64Bit?
« Reply #4 on: May 20, 2013, 04:52:10 pm »
Is the -m32 really the only flag you have to set, to switch to 32bit compiling & linking?
:-[ You are right.

1. In order to compile as 32bit gcc-multilib and g++-multilib have to be installed.
2. The pogram has to be compiled and linked both with the "-m32" flag.
3. All required libraries should be present as 32bit:

Code: [Select]
/usr/bin/ld: warning: libfreetype.so.6, needed by <path>/SFML_2.0_32/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libGLEW.so.1.7, needed by <path>/SFML_2.0_32/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libjpeg.so.8, needed by <path>/SFML_2.0_32/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libX11.so.6, needed by <path>/SFML_2.0_32/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libXext.so.6, needed by <path>/SFML_2.0_32/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libXrandr.so.2, needed by <path>/SFML_2.0_32/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
<path>/SFML_2.0_32/lib/libsfml-window.so: undefined reference to `XCreateIC'
<path>/SFML_2.0_32/lib/libsfml-window.so: undefined reference to `XQueryExtension'
[...]

I think with installing the required 32bit libs it should be done. I will inform you the upcoming days about my success.

Thank you.
« Last Edit: May 20, 2013, 04:54:57 pm by Fermi »

CleverBoy

  • Newbie
  • *
  • Posts: 25
  • Game on!!
    • View Profile
    • Email
Re: SFML 2.0 32Bit on Linux 64Bit?
« Reply #5 on: August 23, 2016, 07:10:07 am »
Hi,

Were you able to find all the dependencies required to build a 32 bit version on 64 bit ?  I also need one 32 bit version.

Thanks...


 

anything