Raspberry Pi

Trying to build your own version of Vega Strike and having problems? Unix users, paste your config.log here (stderr output alone is not helpful).
Post Reply
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Raspberry Pi

Post by shenle »

I'm documenting here if/not I can compile VS for the Raspberry Pi and the steps taken. I use a Raspberry Pi zero, which likely doesn't have enough oomph to run VS after it's compiled, but the process should be applicable to more powerful versions of it.

1. Using Raspberry Pi zero with Ubuntu 16.04 (latest build as of now 2016-02-26

2. checkout VS as with svn

3. Set correct compiler flags; for RPI zero:

Code: Select all

export CCFLAGS="-march=armv6zk -mcpu=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp"
export CXXFLAGS="-march=armv6zk -mcpu=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp"
For RPi 2 would be

Code: Select all

export CCFLAGS="-Ofast -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
export CXXFLAGS="-Ofast -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
and for RPi3:

Code: Select all

export CCFLAGS="-Ofast -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard"
export CXXFLAGS="-Ofast -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard"


4. Missing python development libraries

Code: Select all

sudo apt-get install python-dev
this makes cmake happy for now

5. RPI doesn't use regular OpenGL but OpenGL-ES. This is a problem as there is no glut for OGLES. Trying glshim

Code: Select all

git clone https://github.com/lunixbochs/glshim
cd glshim
cmake . -DBCMHOST=1
make GL
(edit) scratch that, trying freeglut

Code: Select all

sudo apt-get install freeglut3-dev
Seems to work

6. OpenAL

Code: Select all

sudo apt-get install libopenal-dev
7. gtk+-2.0

Code: Select all

sudo apt-get install libgtk2.0-dev
8. libavcodec

Code: Select all

sudo apt-get install libavcodec-dev
9. swscale

Code: Select all

sudo apt-get install libswscale-dev
...but for some reason cmake still can't find it
skipping for now, may need LD_LIBRARY_PATH

10.Xmu

Code: Select all

sudo apt-get install libxmu-dev
11. Seems all dependencies are met now, trying to compile. Will take a long time, 10% after 30 minutes.
(edit) the first compile attempt failed at 11% with a gcc internal error, but that may be because I was trying to multitask on the device at the same time; probably too much for a puny 1-core ARM. Trying again.


more to come...
Last edited by shenle on Mon Mar 14, 2016 5:45 pm, edited 1 time in total.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Re: Raspberry Pi

Post by loki1950 »

The shaders will need to be redone as OpenGL-ES uses a different primitives so even if it compiles there's still lots of code that would need changed for OpenGL-ES.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Raspberry Pi

Post by shenle »

loki1950 wrote:The shaders will need to be redone as OpenGL-ES uses a different primitives so even if it compiles there's still lots of code that would need changed for OpenGL-ES.

Enjoy the Choice :)
Would a wrapper like glshim help?

BTW, still compiling. Now at 15%. :)
make me a sandwich
make: *** No rule to make target 'me'. Stop.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Re: Raspberry Pi

Post by loki1950 »

Do not know,an other project that I follow 0AD has an Android port so it might give some insights there are a few threads on their forums about the process of the conversion from OpenGL to OpenGL-ES.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Raspberry Pi

Post by shenle »

Well anyway, the compilation failed because the Pi zero doesn't have enough memory. Guess 512MB isn't enough for the task (and no, I don't have space on the SD card it boots from for a swap partition). Will try again when I get one of its bigger brothers.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Raspberry Pi

Post by shenle »

New attempt using one of Raspberry Pi's bigger brothers, and Odroid-C2 http://www.hardkernel.com/main/products ... 5457216438 (4-core ARM Cortex-a53 at 2GHz, 2GB RAM, Mali-450 GPU etc). Should have enough resources to at least compile, if not even run VS. Using Ubuntu-16.04-ARM64 alpha. Or maybe I should be using a 32-bit ARM version to save heartaches.

Flags for the compiler (gcc(Ubuntu/Linaro 5.3.1-11ubuntu1) 5.3.1 20160311)

Code: Select all

-march=armv8-a+crc -mtune=cortex-a53
(in progress)


Aand... that failed. Cannot install libsdl2-dev because it depends on the mesa libraries, which fail to install because they conflict with the mali 3d libraries specific to this distribution. Will try again with a plain Debian Jessie install, once a 32-bit version of it will be available. I was told that it'll be soon, and the mali driver will be fixed to avoid this conflict since it affects many other packages (Qt5 for instance)
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Raspberry Pi

Post by shenle »

Attempting again, using a Debian Jessie version that has corrected mali drivers. All dependencies installed, cmake done...
Make returns POSH error: " POSH cannot determine target CPU"
Solved by adding to src/posh.h:

Code: Select all

#if defined __aarch64__
#  define POSH_CPU_AARCH64 1
#  define POSH_CPU_STRING "AArch64"
#endif 
Still compiling

(edit) Wow, takes a lot of memory to compile VS. Even with 2GB it failed at 39%. Trying again without using all 4 cores at once.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Raspberry Pi

Post by shenle »

Fails at:

Code: Select all

[ 59%] Building CXX object CMakeFiles/vegastrike.dir/src/gfx/vid_file.cpp.o
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp: In destructor ‘VidFileImpl::~VidFileImpl()’:
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:204:45: error: ‘av_close_input_file’ was not declared in this scope
             av_close_input_file( pFormatCtx );
                                             ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp: In member function ‘void VidFileImpl::open(const string&)’:
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:217:54: error: ‘av_find_stream_info’ was not declared in this scope
             || ( 0 > av_find_stream_info( pFormatCtx ) ) ) throw VidFile::FileOpenException( errbase+" (wrong format or)" );
                                                      ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:244:45: error: ‘avcodec_open’ was not declared in this scope
         if (avcodec_open( pCodecCtx, pCodec ) < 0) throw VidFile::UnsupportedCodecException( errbase+" (unsupported codec)" );
                                             ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:245:25: warning: ‘AVFrame* avcodec_alloc_frame()’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3211) [-Wdeprecated-declarations]
         pFrameYUV     = avcodec_alloc_frame();
                         ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:245:45: warning: ‘AVFrame* avcodec_alloc_frame()’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3211) [-Wdeprecated-declarations]
         pFrameYUV     = avcodec_alloc_frame();
                                             ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:246:25: warning: ‘AVFrame* avcodec_alloc_frame()’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3211) [-Wdeprecated-declarations]
         pNextFrameYUV = avcodec_alloc_frame();
                         ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:246:45: warning: ‘AVFrame* avcodec_alloc_frame()’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3211) [-Wdeprecated-declarations]
         pNextFrameYUV = avcodec_alloc_frame();
                                             ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:250:36: error: ‘AVStream’ has no member named ‘r_frame_rate’
         frameRate = float(pStream->r_frame_rate.num)/float(pStream->r_frame_rate.den);
                                    ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:250:69: error: ‘AVStream’ has no member named ‘r_frame_rate’
         frameRate = float(pStream->r_frame_rate.num)/float(pStream->r_frame_rate.den);
                                                                     ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:252:70: error: ‘AVStream’ has no member named ‘r_frame_rate’
         VSFileSystem::vs_dprintf(3, "  Framerate: %d/%d\n", pStream->r_frame_rate.num, pStream->r_frame_rate.den);
                                                                      ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:252:97: error: ‘AVStream’ has no member named ‘r_frame_rate’
         VSFileSystem::vs_dprintf(3, "  Framerate: %d/%d\n", pStream->r_frame_rate.num, pStream->r_frame_rate.den);
                                                                                                 ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:258:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while (width < pCodecCtx->width && width <= (fbDimensionLimit/2)) width *= 2;
                          ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:259:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while (height < pCodecCtx->height && height <= (fbDimensionLimit/2)) height *= 2;
                           ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:271:29: warning: ‘AVFrame* avcodec_alloc_frame()’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3211) [-Wdeprecated-declarations]
         pFrameRGB         = avcodec_alloc_frame();
                             ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:271:49: warning: ‘AVFrame* avcodec_alloc_frame()’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3211) [-Wdeprecated-declarations]
         pFrameRGB         = avcodec_alloc_frame();
                                                 ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp: In member function ‘bool VidFileImpl::seek(float)’:
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:301:51: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if ( (targetPTS >= prevPTS) && (targetPTS < pNextFrameYUV->pts) ) {
                                                   ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:331:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (pNextFrameYUV->pts < targetPTS) {
                                        ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:337:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 while (packet.dts < targetPTS) {
                                   ^
/home/silviu/vegastrike/vegastrike/src/gfx/vid_file.cpp:343:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 while (pNextFrameYUV->pts < targetPTS) {
                                           ^
CMakeFiles/vegastrike.dir/build.make:2423: recipe for target 'CMakeFiles/vegastrike.dir/src/gfx/vid_file.cpp.o' failed
make[2]: *** [CMakeFiles/vegastrike.dir/src/gfx/vid_file.cpp.o] Error 1
CMakeFiles/Makefile2:245: recipe for target 'CMakeFiles/vegastrike.dir/all' failed
make[1]: *** [CMakeFiles/vegastrike.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
Trying again with ffmpeg disabled. This seems to be the same issue I have ran into on Funtoo (see my other thread http://forums.vega-strike.org/viewtopic.php?f=5&t=26549 )
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Raspberry Pi

Post by shenle »

Compiled successfully.
Vssetup runs through redirected X (I don't have the device attached to a display currently).
Vegaserver runs.
Vegastrike gives me

Code: Select all

silviu@odroid-jessie64:~/vegastrike/data$ ./vegastrike
Registering codec ogg.
 In path /home/silviu/vegastrike/data
Vega Strike  
See http://www.gnu.org/copyleft/gpl.html for license details.

GOT SUBDIR ARG = 
Found data in /home/silviu/vegastrike/data
Using /home/silviu/vegastrike/data as data directory
Using .vegastrike as the home directory
Found MODDIR = /home/silviu/vegastrike/data/mods
USING HOMEDIR : /home/silviu/.vegastrike As the home directory 
CONFIGFILE - No config found in home : /home/silviu/.vegastrike/vegastrike.config
CONFIGFILE - No home config file found, using datadir config file : /home/silviu/vegastrike/data/vegastrike.config
DATADIR - No datadir specified in config file, using ; /home/silviu/vegastrike/data
SIMULATION_ATOM: 0.01
MISSION_NAME is empty using : main_menu.mission
running import sys
print(sys.path)
sys.path = ["",r"/home/silviu/vegastrike/data/modules/builtin",r"/home/silviu/vegastrike/data/modules/quests",r"/home/silviu/vegastrike/data/modules/missions",r"/home/silviu/vegastrike/data/modules/ai",r"/home/silviu/vegastrike/data/modules",r"/home/silviu/vegastrike/data/bases"] + sys.path
['/usr/lib/python2.7/', '/usr/lib/python2.7/plat-aarch64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload']
testing VS randomrunning import sys
print(sys.path)
['', '/home/silviu/vegastrike/data/modules/builtin', '/home/silviu/vegastrike/data/modules/quests', '/home/silviu/vegastrike/data/modules/missions', '/home/silviu/vegastrike/data/modules/ai', '/home/silviu/vegastrike/data/modules', '/home/silviu/vegastrike/data/bases', '/usr/lib/python2.7/', '/usr/lib/python2.7/plat-aarch64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload']
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
AL lib: (EE) alsa_open_playback: Could not open playback device 'default': No such file or directory
Creating scene manager...
Creating template manager...
  Initializing renderer...
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Vertex Program Error: Failed to compile lite
Vertex Program Error: Failed to compile default
0 joysticks were found.

The names of the joysticks are:
Segmentation fault
I have a generic CM108 USB sound card attached to it.

Code: Select all

sudo lsusb
Bus 001 Device 003: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
The usb sound module is loaded

Code: Select all

lsmod
Module                  Size  Used by
spidev                  5801  0 
spi_gpio                6034  0 
snd_usb_audio         119386  0 
snd_hwdep               7165  1 snd_usb_audio
snd_usbmidi_lib        20407  1 snd_usb_audio
snd_rawmidi            20215  1 snd_usbmidi_lib
spi_bitbang             3637  1 spi_gpio
snd_seq_device          5418  1 snd_rawmidi
w1_gpio                 3230  0 
wire                   21719  1 w1_gpio
autofs4                24837  2 
but of course that doesn't matter because sound should be redirected also.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
Post Reply