Spherical forums

Sphere Development => Sphere Support => Topic started by: pancakes4ever on March 07, 2014, 02:37:24 pm

Title: Linux install instructions
Post by: pancakes4ever on March 07, 2014, 02:37:24 pm
A few years ago I had successfully installed sphere on linux/wine with some really handy instructions somewhere on the old site. Now that those years have passed by a lot has changed, including the site and me getting a new computer. Anyway, do linux install instructions exist anywhere?
Title: Re: Linux install instructions
Post by: Flying Jester on March 07, 2014, 06:03:47 pm
I recently hacked up the Sphere source to compile on Linux again. I was working with DaVince to get it set up for him, but that effort stalled. I didn't plan on posting up any instructions until that succeeded.

I have, however, compiled and run Sphere natively on Linux on several of my own machines. I could help you get that running, if you want.
If you want to do it that way, you will need:




Clone the git repos at https://github.com/FlyingJester/Corona (https://github.com/FlyingJester/Corona), https://github.com/FlyingJester/Audiere (https://github.com/FlyingJester/Audiere), and https://github.com/FlyingJester/Sphere (https://github.com/FlyingJester/Sphere). Build and install Corona and Audiere. Then, download, build,and install SpiderMonkey (contemporarily just called JS) as we did here (http://forums.spheredev.org/index.php/topic,155.msg3965.html#msg3965).

Then, you should be able to build my fork of Sphere.

The Sphere GL driver is spotty on Linux, but there is another driver (https://github.com/FlyingJester/FJ-GL) that works on Linux that provides hardware acceleration if Sphere GL doesn't work and SDL32 is too slow. And SDL32 is slow.
Title: Re: Linux install instructions
Post by: Rahkiin on March 07, 2014, 06:06:19 pm

Clone the git repos at (...) Build and install Corona and Audiere. Then, download, build,and install SpiderMonkey (contemporarily just called JS)

Then, you should be able to build my fork of Sphere.


@pancakes4ever I hope you are not a GUI-only Ubuntu user :P
Title: Re: Linux install instructions
Post by: Flying Jester on March 07, 2014, 06:19:34 pm
To be sure, this isn't as simple as running an installer.

If you have trouble or are confused at any point, I can help. Just ask  :)
Title: Re: Linux install instructions
Post by: DaVince on March 08, 2014, 02:36:24 pm
If you want the Windows version to work well on Wine, do the following:

Get Winetricks (it's in the package repo). Run:
Code: [Select]
winetricks mfc42


Now you'll be able to open both the engine and included editor with Wine through your file manager.


Quote
I recently hacked up the Sphere source to compile on Linux again. I was working with DaVince to get it set up for him, but that effort stalled. I didn't plan on posting up any instructions until that succeeded.

Oops... Sorry! I kind of forgot you replied. My main system is half-broken so I use another one now, but will see if I can get you some debug output later.
Title: Re: Linux install instructions
Post by: pancakes4ever on March 09, 2014, 07:27:56 pm

To be sure, this isn't as simple as running an installer.
If you have trouble or are confused at any point, I can help. Just ask  :)


Awesome! Thanks. Yeah I will ask if I have any trouble. I'm gonna try giving it go tonight. I was expecting a bit of a challenge to get it up and running but it sounds fun :)


@pancakes4ever I hope you are not a GUI-only Ubuntu user :P


Luckily, no. Although, I did make the mistake of being a home Linux user without internets before. Ugh, that was a rough time.


If you want the Windows version to work well on Wine, do the following:
Get Winetricks (it's in the package repo). Run:
Code: [Select]
winetricks mfc42

Now you'll be able to open both the engine and included editor with Wine through your file manager.


That's what I was forgetting! I remembered the audiere bit but definitely not mfc42.
I was using wine method the first time. I think I'm gonna try going native first but it'll be nice to know I have an escape rope in case I fail miserably.

Thanks everybody.
Title: Re: Linux install instructions
Post by: pancakes4ever on March 12, 2014, 11:38:00 am
So I got pretty far into the build and am currently trying to build sphere. Getting a slew of errors about  Corona.o has unreferenced ( or undefined references) to PNG_WHATEVER...
Am I missing an #include somewhere or I tried adding lpng as a linker and as lib in the sconstruct and received the same error.
Title: Re: Linux install instructions
Post by: Flying Jester on March 12, 2014, 01:50:03 pm
Are using my copy of Corona? What is the exact PNG name that is undefined?
Title: Re: Linux install instructions
Post by: pancakes4ever on March 12, 2014, 07:15:19 pm
Yeah I did use your version of corona
Keep in mind, I'm definitely took a few stabs in the dark to get this far so I may have screwed some things up...
I had to comment out an if-statement in the headers of Corona/Src/Openpng.cpp in order to get it to compile and I'm starting to think that was a bad idea. I also tinkered with the Sconstruct, try to include libpng to see if that was it.
Oh, I'm also on (LUBUNTU) 12.04. I apologize for the train-wreck in advance. :p

Code: [Select]

g++ -o source/engine/engine -lpng -lz -lz -lpng source/engine/SpritesetServer.o source/engine/benchmark.o source/engine/engine.o source/engine/log.o source/engine/map_engine.o source/engine/render.o source/engine/rendersort.o source/engine/parameters.o source/engine/script.o source/engine/sfont.o source/engine/sfxr.o source/engine/simage.o source/engine/smap.o source/engine/sphere.o source/engine/ssfxr.o source/engine/sspriteset.o source/engine/swindowstyle.o source/engine/PlayerConfig.o -Lsource/common -Lsource/particle_engine -L/usr/lib/x86_64-linux-gnu -Lsource/engine/unix -lcommon -laudiere -lcorona -lmng -ljpeg -lz -lparticle_engine -lSDL -lunix -ldl -ljs
/usr/local/lib/libcorona.so: undefined reference to `png_set_error_fn'
/usr/local/lib/libcorona.so: undefined reference to `png_create_info_struct'
/usr/local/lib/libcorona.so: undefined reference to `png_sig_cmp'
/usr/local/lib/libcorona.so: undefined reference to `png_read_png'
/usr/local/lib/libcorona.so: undefined reference to `png_malloc'
/usr/local/lib/libcorona.so: undefined reference to `png_get_io_ptr'
/usr/local/lib/libcorona.so: undefined reference to `png_set_read_fn'
/usr/local/lib/libcorona.so: undefined reference to `png_destroy_read_struct'
/usr/local/lib/libcorona.so: undefined reference to `png_set_IHDR'
/usr/local/lib/libcorona.so: undefined reference to `png_set_rows'
/usr/local/lib/libcorona.so: undefined reference to `png_destroy_write_struct'
/usr/local/lib/libcorona.so: undefined reference to `png_get_bit_depth'
/usr/local/lib/libcorona.so: undefined reference to `png_create_read_struct'
/usr/local/lib/libcorona.so: undefined reference to `png_set_sig_bytes'
/usr/local/lib/libcorona.so: undefined reference to `png_get_channels'
/usr/local/lib/libcorona.so: undefined reference to `png_get_tRNS'
/usr/local/lib/libcorona.so: undefined reference to `png_get_image_height'
/usr/local/lib/libcorona.so: undefined reference to `png_write_png'
/usr/local/lib/libcorona.so: undefined reference to `png_get_rows'
/usr/local/lib/libcorona.so: undefined reference to `png_set_write_fn'
/usr/local/lib/libcorona.so: undefined reference to `png_get_image_width'
/usr/local/lib/libcorona.so: undefined reference to `png_get_PLTE'
/usr/local/lib/libcorona.so: undefined reference to `png_create_write_struct'
/usr/local/lib/libcorona.so: undefined reference to `png_error'
/usr/local/lib/libcorona.so: undefined reference to `png_free'
/usr/local/lib/libcorona.so: undefined reference to `png_set_PLTE'
Title: Re: Linux install instructions
Post by: pancakes4ever on March 12, 2014, 07:20:52 pm
Libpng-related pkgs installed:
libpng12-0
libpng12-dev
libpnglite-dev
libpng3
libpng++-dev
libpng12-0:i386
Title: Re: Linux install instructions
Post by: Flying Jester on March 12, 2014, 08:03:15 pm
You're going to need those if statements.

Near the top of the file OpenPNG.cpp, you should see this:
Code: [Select]
#if (PNG_LIBPNG_VER < 12000)


The quick fix is to change it from < to >. You have one of the versions of LibPNG that land on the wrong side of my assumptions about the API.

The real fix for this is to find out when png_struct was removed, and what the PNG_LIBPNG_VER definition was for that version, and check against that. I tried to figure it out, but in the I just took a guess, which is clearly not really correct.
Title: Re: Linux install instructions
Post by: pancakes4ever on March 12, 2014, 08:36:13 pm

You're going to need those if statements.

Near the top of the file OpenPNG.cpp, you should see this:
Code: [Select]
#if (PNG_LIBPNG_VER < 12000)


The quick fix is to change it from < to >. You have one of the versions of LibPNG that land on the wrong side of my assumptions about the API.

The real fix for this is to find out when png_struct was removed, and what the PNG_LIBPNG_VER definition was for that version, and check against that. I tried to figure it out, but in the I just took a guess, which is clearly not really correct.


Gah, I knew that commenting was come back to get me.
This reminded of an thread I found while I was doing some internet digging while at work. It looks like the people were having a similar issue and inserted range of png_libpng_version rather than a single </> statement. I don't know if it applies here but I'll link it when I find it again.
Title: Re: Linux install instructions
Post by: Flying Jester on March 12, 2014, 09:03:07 pm
It's the same kind of issue, but unless they were dealing with png's setjump and the guts of png_struct being laid bare, it wouldn't help much. That change was made all at once, sometime between libpng 1.0 and libpng 1.4. I just don't know exactly when.
Title: Re: Linux install instructions
Post by: pancakes4ever on March 13, 2014, 02:34:49 am
Ok, so I got it to make it past scons it ended up being due to the fact that I didn't include the jpg,png,and zlib with corona in the Sconstruct...

but now (so close yet so far) have met with another error

Code: [Select]

./engine: error while loading shared libraries: libunix.so: cannot open shared object file: No such file or directory


libunix.so shows up the in the source/engine/unix/folder but where is the engine looking?
Title: Re: Linux install instructions
Post by: pancakes4ever on March 13, 2014, 02:51:35 am
Whoops I got it. Moved libunix.so to usr/lib
now getting this error
Code: [Select]
engine: source/common/Map.cpp:141: LAYER_HEADER_AssertStructSize__::LAYER_HEADER_AssertStructSize__(): Assertion `sizeof(LAYER_HEADER) == 30' failed.
Aborted (core dumped)


also noticing that i dont see the wxeditor anywhere... is that normal?
Title: Re: Linux install instructions
Post by: Flying Jester on March 13, 2014, 02:56:31 am
The editor does not work on Linux. Or if it does, you'd need to hack the sconstruct files and get an ancient version of WxWidgets (back when it was called WxWindows...and maybe didn't even exist for Linux).

I've seen that error before. I'll post the solution in a bit, I need to dig it out.

EDIT: I hate to ask, but are you using my branch of Sphere? The fix for that (https://github.com/FlyingJester/sphere/blob/master/sphere/source/common/Map.cpp#L105) is already in the source. Or at least, the change that fixed it for me. The bitfield declarations are supposed to align and compact the struct to make it exactly 30 bytes.

If you are using my branch, what version of the GCC are you using?
Title: Re: Linux install instructions
Post by: pancakes4ever on March 13, 2014, 03:25:00 pm
I figured it out. I had added in #include <cstring> instead of replacing <string> earlier
now getting this error. I remember hearing something about startup not working anyway. so I'm wondering if this is normal.

Code: [Select]
Game: "startup"
Parameters: ""
Segmentation fault (core dumped)


And I totally forgot about the no editor thing. I'm dabbling with the idea of writing one, now. But that may just be lack-of-sleep-crazy thoughts. Thanks for the help so far, I hope I haven't been too annoying.
Title: Re: Linux install instructions
Post by: Flying Jester on March 13, 2014, 03:27:17 pm
Try this, and tell me what the output is:
Code: [Select]
ldd ./sphere


Also, you may need to run config and select SDL32 as the graphics backend. The Sphere GL backend is a little shaky on Linux. If it's the GL backend that is causing this, I have an idea of how to fix it.

And if you don't have it, this might be a good time to install valgrind.
Title: Re: Linux install instructions
Post by: pancakes4ever on March 13, 2014, 08:49:20 pm
Code: [Select]

ldd ./engine
linux-vdso.so.1 =>  (0x00007fff533fe000)
libaudiere-1.9.4.so => /usr/local/lib/libaudiere-1.9.4.so (0x00007f69643f9000)
libcorona-1.0.2.so => /usr/local/lib/libcorona-1.0.2.so (0x00007f69641e7000)
libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f6963f96000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f6963d6e000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6963b57000)
libmng.so.1 => /usr/lib/x86_64-linux-gnu/libmng.so.1 (0x00007f69638ce000)
libunix.so => /usr/local/lib/libunix.so (0x00007f69636a4000)
libjs.so => /usr/local/lib/libjs.so (0x00007f69633d0000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f69630cf000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6962dd3000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6962bbd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f69627fc000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f69625df000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f69623d7000)
liblcms.so.1 => /usr/lib/x86_64-linux-gnu/liblcms.so.1 (0x00007f696219f000)
libSDL-1.2.so.0 => /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0 (0x00007f6961f06000)
/lib64/ld-linux-x86-64.so.2 (0x00007f696465b000)
libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007f6961c18000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6961a14000)
libpulse-simple.so.0 => /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0 (0x00007f6961810000)
libpulse.so.0 => /usr/lib/x86_64-linux-gnu/libpulse.so.0 (0x00007f69615c7000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f6961292000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f6961081000)
libcaca.so.0 => /usr/lib/x86_64-linux-gnu/libcaca.so.0 (0x00007f6960db5000)
libpulsecommon-1.1.so => /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so (0x00007f6960b57000)
libjson.so.0 => /usr/lib/x86_64-linux-gnu/libjson.so.0 (0x00007f696094e000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f696070a000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f69604ec000)
libslang.so.2 => /lib/x86_64-linux-gnu/libslang.so.2 (0x00007f696017a000)
libncursesw.so.5 => /lib/x86_64-linux-gnu/libncursesw.so.5 (0x00007f695ff4d000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f695fd26000)
libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007f695fb1c000)
libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007f695f8b5000)
libasyncns.so.0 => /usr/lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007f695f6af000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f695f4ab000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f695f2a5000)
libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f695f08b000)
libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007f695ee40000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007f695e971000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007f695e745000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007f695e53d000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f695e321000)
Title: Re: Linux install instructions
Post by: Flying Jester on March 13, 2014, 09:58:25 pm
OK, that all looks good.

Did you try changing the graphics backend using config?

Could you install Valgrind, and then what does
Code: [Select]
valgrind ./sphere
look like? It should generate a stacktrace on segfaults.
Title: Re: Linux install instructions
Post by: pancakes4ever on March 14, 2014, 02:34:05 pm
I'm not at my computer and this may be a stupid observation. But I don't remember seeing a sphere executable in the biuld.
Title: Re: Linux install instructions
Post by: Flying Jester on March 14, 2014, 03:46:23 pm
You're right, it's called engine. My mistake!
Title: Re: Linux install instructions
Post by: pancakes4ever on March 27, 2014, 08:31:07 pm
What flavor is everyone using btw? I gonna test out fedora this weekend for fun?
Title: Re: Linux install instructions
Post by: Flying Jester on March 27, 2014, 09:13:23 pm
I'm using Gentoo right now, but I have Arch on this machine and another computer with Debian, Fedora, and Lubuntu.

I've successfully compiled Sphere with Fedora, Gentoo, and Arch so far. I've never tried it on a Debian or Ubuntu based distro.

Did you try using Valgrind? That would help tell us where and why the engine is crashing. I'd hope this is the same problem DaVince is having (looks the same so far), so we could finally fix all known Linux-specific issues with Sphere.
Title: Re: Linux install instructions
Post by: pancakes4ever on April 01, 2014, 05:06:12 pm
Right will do. Sorry for the lag, I deleted my windows 8.1 partition to install fedora and found the bios/uefi thing no longer likes my hd. Windows has somehow found a way terrorize me even after I've wiped the os. Anyway once I deal with that I'll copy the valgrind output.
Title: Re: Linux install instructions
Post by: Radnen on April 01, 2014, 06:44:59 pm

Windows has somehow found a way terrorize me even after I've wiped the os.


Hahahahaha, omg I died laughing. :P
Title: Re: Linux install instructions
Post by: Fat Cerberus on April 01, 2014, 07:15:56 pm

Right will do. Sorry for the lag, I deleted my windows 8.1 partition to install fedora and found the bios/uefi thing no longer likes my hd. Windows has somehow found a way terrorize me even after I've wiped the os. Anyway once I deal with that I'll copy the valgrind output.


If you're not going to use Win8+ at all, you'll have to go into the BIOS settings and enable legacy BIOS.  The setting has different names on different boards but the gist is that you have to disable UEFI.
Title: Re: Linux install instructions
Post by: Flying Jester on April 01, 2014, 09:28:32 pm
It doesn't disable UEFI. It just makes UEFI pretend to be BIOS.
Title: Re: Linux install instructions
Post by: Fat Cerberus on April 01, 2014, 10:58:08 pm

It doesn't disable UEFI. It just makes UEFI pretend to be BIOS.


Well if you want to get technical about it, yeah.  In practice the effect is the same.
Title: Re: Linux install instructions
Post by: pancakes4ever on April 04, 2014, 01:12:31 pm
Update: so apparently when in rains it pours. The os issues kept piling up to a point at which writing zeroes became too desirable of an option. From there I'll reinstall lubuntu(although for the most part I'm going to move on to fedora), and recreate what I had before.