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

Author Topic: SFML on Solaris (failed attempt)  (Read 3088 times)

0 Members and 1 Guest are viewing this topic.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
SFML on Solaris (failed attempt)
« on: September 22, 2013, 10:27:18 am »
A few days ago I downloaded Solaris because I figured it'd be fun to check out another OS and see if I could get SFML to build in it, since I'm very curious as to how portable C++ code really is across all the *nixes.  The short version is it didn't work (as I expected), but since I don't see any other Solaris threads (ignoring a few from before SFML 2.0 came out), and the errors I got were much stranger than I expected, I thought someone might either be interested in what happened to me or be able to tell me some simple thing I did horribly wrong.

So here's a brief summary of the procedure I went through:

1) Download Oracle's Solaris 11 pre-made VM for VirtualBox.  For some reason it was marked as .gz even though it was supposed to be a .tgz, so I had to manually add the tar part before I could extract the .ova file you're supposed to give VirtualBox.

1a) Make sure you enable 3D hardware acceleration (or else OpenGL won't do much) as well as audio (or else OpenAL won't do much).  The default ICH audio chip worked fine for me.  I believe these are the only VirtualBox settings you should have to mess with.

2) Boot and install Solaris like any other OS.

3) Inside Solaris, download the CMake package, the GLEW sources and the OpenAL Soft sources.  Compile GLEW and OpenAL Soft yourself, then copy the headers and libraries into any of the standard *nix directories for them so that CMake can locate them. (this part took me days to figure out even though in retrospect it was pretty straightforward and easy; let's just say it was a very educational experience)

3a) For some reason Solaris' CMake has a curses interface instead of regular GUI.  Fortunately, adapting to it is really easy, since the interface essentially includes a tutorial.

4) Change various bits of the SFML code that won't compile on Solaris.  Since this was just for fun, not a serious porting effort, I naively removed what didn't seem to work.
a) Comment out all Joystick-related code.
b) Remove the FD_ZERO macro wherever it caused a "'memset' not declared in this scope" error.  I believe this rendered the entire networking module unusable (lol).
c) Change Config.cmake and Config.hpp so that SFML won't simply refuse to compile on an OS it doesn't recognize.  I decided to try #define SFML_SYSTEM_FREEBSD since that was the only *nix-but-not-Linux system the files had a macro for.
d) In Linux/WindowImplX11.cpp the one line that calls basename() gets a "'basename' not declared in this scope" error, which I had no idea what to do with so I simply commented it out.  In retrospect this seems like the most obvious potential source of the weird crashes I got, though all my googling efforts failed to turn up any hint as to where this basename() function comes from, so I had no idea how to resolve the scope error.

5) Now simply build SFML and its examples using CMake per the usual tutorial.  Change the CMakeLists.txt file in the examples folder so that the networking examples don't get built.  All the other examples I built without a single error or warning.

6) Test the examples and watch what breaks!
The opengl and window examples run perfectly fine, until you close them.  Then VirtualBox crashes.
The shader example crashes VirtualBox on startup.
The sound example seems to hang for a little while and then exit without doing anything.  Note that other sources of audio (eg, the terminal beeping at me whenever tab-completion fails) were working just fine for me.
The pong example seems to do nothing but open a window and immediately close it again.  It continues doing this even after I remove all the window-related code (or literally all of the code except main()) and rebuild it.

Just to clarify, I was expecting this to fail.  This is not meant as a help request, which is why it's not in the help section.  It'd be cool if someone actually has an idea how to make the non-networking examples work, but I didn't have my heart set on doing any Solaris porting in the near future.  It just seems like a good idea to at least have one thread about this topic somewhere.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: SFML on Solaris (failed attempt)
« Reply #1 on: September 22, 2013, 03:36:34 pm »
If you want to test another OS, you'll have to run it native, otherwise you'll never know if it was yet another VirtualBox bug. Currently I can't run an SFML application on a VM Linux, because it crashes at window initialization in the VirtualBox graphics driver something.
But yep, SFML was never tested/adjusted for Solaris, so it's no wonder most of the stuff doesn't work. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: SFML on Solaris (failed attempt)
« Reply #2 on: September 22, 2013, 10:29:46 pm »
Personally I've had success with running ports of my SFML program on Mac and Linux VMs, so I feel like it's probably my fault rather than VirtualBox, especially considering Solaris and VirtualBox are made by the same company, but you're right, it's a definite possibility.  Whenever I have multiple computers and feel safe playing around with multi-boot on one of them I might try this again.

To be honest I think it's cool how much of SFML already compiles and works (at least until the window closes).  The graphics and audio modules in particular didn't seem to need a single change, unless you count me having to install GLEW and OpenAL myself.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFML on Solaris (failed attempt)
« Reply #3 on: September 22, 2013, 10:49:42 pm »
May I ask why are you doing this? ;D
Oracle didn't 'make' VB and Solaris they just own and develop it for now. Solaris was made by Sun who got bought by Oracle and VB was made by innotek who was bought by Sun before Oracle bought Sun.
It's like a food chain of corps. :P
Back to C++ gamedev with SFML in May 2023

 

anything