compiling on Pandora with Code::Blocks -> PND


b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,437
Hi,

I am still a devoted Pandora user and plan to keep using it for another couple of years :)
I recently noticed a bug in the ScummVM software and I lack the skills to compile something and create a PND. I am glad that Farox is still around and wanted to help with that.
That said, I am a Linux user and familiar with ./configure - make - make install and fixing straightforward dependencies on Ubuntu or Slackware. I also like to give it a try myself before asking for help, but from experiences in the past dependency hell and undescriptive errors is usually something I cannot fix.

I don't know what the best approach is to start but I just installed Code::Blocks on a EXT-2 formatted SD card and use it on a spare 1GHz Pandora. Started the command line interface and as a test I am now trying to compile emacs 28.1 from source.

./configure succeeded without error (ended with a comment about movemail but that didn't look like an error but a suggestion)

Then started make and after a few minutes the first error appears. after line with CC floatfns.0
floatfns.c:56:3: error "Emacs cannot be built with -ffinite-math-only"

So now I've reached a point already that I usually give up. No clear message or suggestion like "try configure without --xxxx or with --xxxx" or needs library xxxx
Now trying to configure with --with-pop because that was a suggestion from configure that I initially ignored. Maybe that fixes it, we'll see but I am not very optimistic.

Will update this post with new details along the way. It would be great if I could manage to compile it and create a PND myself - I chose Emacs to avoid difficulties with SDL and because I love org mode.
Is using Code::Blocks like this a good approach? Any other suggestions?
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
9,175
Age
49
Location
France, near Lyon
codeblocks command line define some default CFLAGS that use -Ofast, that is "-O3 -ffast-math", adn -ffast-math enabled, among other thing "-ffinite-math-only"... So you'll need to export a new CFLAGS without "-Ofast" or "--fast-math", launch configure again, and then it should works.
 

b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,437
codeblocks command line define some default CFLAGS that use -Ofast, that is "-O3 -ffast-math", adn -ffast-math enabled, among other thing "-ffinite-math-only"... So you'll need to export a new CFLAGS without "-Ofast" or "--fast-math", launch configure again, and then it should works.

Where can I find the default CFLAGS settings code::blocks use?

I've been experimenting with "export CFLAGS=" and pretty sure I messed it up and probably will miss some optimizations if I continue.
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
9,175
Age
49
Location
France, near Lyon
Where can I find the default CFLAGS settings code::blocks use?

I've been experimenting with "export CFLAGS=" and pretty sure I messed it up and probably will miss some optimizations if I continue.
Just use
Code:
echo $CFLAGS
To see the original value before doing your new export
 

b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,437
Thanks! I've copied the whole list and placed it between quotation marks (without it it gave errors) and removed -Ofast (the first one on the list).

export CFLAGS="-pipe -mcpu=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp -fsingle-precision-constant -fdiagnostics-color=auto -fuse-ld=gold -fuse-linker-plugin -fsigned-char -mneon-for-64bits -mvectorize-with-neon-double" (example I found on the forum, not copied from code::blocks)

Configured and it is now compiling again :)
 
  • Like
Reactions: rSl

b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,437
Another error unfortunately. It did pass the CC float fns.o line so came a bit further, but fails after CC lastfile.o

some error messages eg:
" alloc.o:alloc.c:function Fmalloc_info: error"
and a bunch of undefined reference to malloc_info / png_get_io_ptr / png_error etc.

Searched the forum and google for similar messages but nothing comes up (at least not something that makes sense to me).
 

b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,437
the function malloc_info was added in glibc 2.10 (see https://man7.org/linux/man-pages/man3/malloc_info.3.html ) so it's not available on the Pandora (using glibc 2.9). The png error are mostly due to incorrect libpng header used (png12 vs png16).
(you know there is a version of emacs in codeblocks already built right?)


Okay that is very helpful to understand how to read the error messages myself. I was expecting configure to check the libraries and provide a warning if it is not correct.
I am totally aware emacs is already available via codeblocks. As mentioned this is just a test for myself to learn how to compile on the pandora and I thought why not try to compile something useful.

On Slackware I already have emacs 27.2 and I don't really need a more recent version. On Saxxon the current 24.5 verion also is fine because I only use it as file manager there (Dired)
Codeblocks has 25.1.2

So wondering what to do next. This looks like dependency hell to me and I don't want to waste your time. There might be other libraries that need a more recent version. Apparently emacs uses a lot of libraries and later versions.

I could try to get the source of glibc and compile that as well, but it is pretty old so I assume it is not easy to add a more recent version (or else you would have probably added it to codeblocks already)
And then there is also libpng https://sourceforge.net/projects/libpng/files/ that probably needs to be fixed.

I can try something else that might be easier to compile. I also want to create a PND so maybe emacs is not the best choice for learning this.
 

ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
9,175
Age
49
Location
France, near Lyon
you cannot use a different glibc than the one from your system (unless you use some static libs, but I don't recommend it). The png stuff is fixable with some trickery on the command line probably. But for malloc_info, it's easier to check in the code how it's use and if there is some workaround there (for other system for example) and try to activate them...
 

b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,437
you cannot use a different glibc than the one from your system (unless you use some static libs, but I don't recommend it). The png stuff is fixable with some trickery on the command line probably. But for malloc_info, it's easier to check in the code how it's use and if there is some workaround there (for other system for example) and try to activate them...

Okay, lets skip Emacs then - learning C/C++ is not on my to-do list yet ;)

I will look for something else to compile that is hopefully a bit easier. Thanks for the help.
 

b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,437
Tried to compile another program today http://o2em.sourceforge.net/ used source 1.18 file. We already have a version but it lacks savestates and the version from ED doesn't work at all so seems like a good candidate to try it out. I'd rather spend some time learning while compiling something useful as well :)

It doesn't have a configure file so I just tried make without configure. That resulted in a " no rule to make target audio.c" error. Noticed it had a Makefile.linux file so used make -f Makefile.linux (-f should force to use that make file)

Same result. So already stuck here. Looked in the makefile for some clues, but nothing that made sense. I am not giving up yet though https://www.tutorialspoint.com/unix_commands/make.htm

-B, --always-make Unconditionally make all targets.

Will try that later today, no Pandora in my hands right now to try it out.
If anyone has any suggestions feel free to jump in. Just sharing my journey.

[edit]

Tried -B and also added -d (for debug) to the make instruction. Didn't really help but at least I know there are lines before it breaks.
If fails due to " no rule to make target 'audio.c'. Needed by audio.o

So checked audio.c file (O2 audio emulation) if there was anything remotely helping in there, but sadly no. So I guess I am out of ideas.
[edit 1]
Tried it on my Linux PC to see if the issue was device related or lacking of libraries. Exactly the same issue.
Then I searched for o2em118src on google and found:


Will give that a try and report back.

[edit 2]

Success! However, not quite there yet...

First got the following error during compilation
gcc: error: allegro-config --libs: No such file or directory

That's an error message that I can understand. Part of the makefile that I adjusted so checked if I typed anything wrong and indeed I ignored the warning " Beware of antiquotes (AltGr 7) " and used ' instead of `
Subtle mistake and easily fixed.

So another make -f makefile.linux and it finalized it immediately. I thought it would re-start compiling but apparently it just continues.

Now I have two executables:

dis48
o2em

Next thing is testing. So created two directories - bios and roms as the tutorial mentions. Copied a bios file in the bios directory and a few roms in the rom directory.

Then did ./o2em roms/game.bin (from codeblocks terminal)

O2EM game back with
Starting emulation ...
Bus error
Bus error seems to be quite common and not very helpful to find what is wrong.
So as mentioned not there yet. But at least I've got through the compilation process.

If this fails I can also try o2em2


[Edit 3]

Bus error was probably caused by removal of SD card. Reboot fixed it :)

220426-211758.png



Now testing if this version has working savestates. If so I want to create a PND for it as well.

[edit 4]

Savestate is also in the binary I've created an issue. Noticed that not all key inputs are accepted by o2em (even standard keys like 'A' are not registered).
Next thing I am going to try is finalize compiling the source on my PC to see if the savestates are working there - if they do then it is probably Pandora related. It worked on the GP2X and I have the GP2X o2em source to compare so should be possible to get the savestates working.

[edit 5]

After compiling I am continuously getting " dir 'bios/' without BIOS !" message on my Ubuntu PC. Luckily someone commented on the emulvideopac site with the same issue so I know it is not something I missed or did incorrectly. It is very old code so that it can cause some problems can be expected.
No solution for this source, but o2em2 seems to work with a patch. Oh well... lets give that a try too. At least the explanation on that site is excellent and never compiled something with a patch before so good to have some experience with that as well.
If that also fixes the savestate issue that would be even better.

[edit 6]

The patch for o2em2 is protected behind a google drive wall - I've requested the file yesterday but didn't hear anything back. In the mean time I found out o2em from hitnrun does have savestate support but it needs to be activated by command line.
Running it from Pandafe and add -savefile=file e.g. -savefile=killerbees.sav activates savestate saving with F2 and loading with F3
I now only need to pass the romname to the -savefile option. Tried to use something like -savefile="$@" but that didn't work and default -savefile=file will save 'file'. So I need the variable of a filename via the pandafe bootscript to o2em.
In the mean time I am still thinking about compiling o2em2, but might try something else if receiving the patch takes too long.

[edit 7]

I found out why the version in the repo of o2em isn't working with savestates. It has its own fileselector and that doesn't pass the -savefile instruction o2em needs to use savestates.
By using Pandafe I am able to bypass the zenith fileselector and execute o2em directly with the -savefile instruction

Most important part (got some help from Farox) I added in the custom bashscript from Pandafe:

export FILE=$(basename "${1}")
o2em -fullscreen -savefile="$FILE" -s2=0 "$@"

So that means o2em works in Pandafe with savestates :) \o/
For me that is good enough for now and will think about a new compiling project.
 
Last edited:
Top