Pandora Pandora Sdk Installer With Opkg


Hitnrun

Member
Joined
Mar 1, 2008
Messages
427
This installer is totally based on the tutorial created by Cpasjuste (http://www.gp32x.de/board/index.php?/topic/52343-pandora-sdk-installer/), but I wanted to use opkg to automatically install and upgrade the packages from angstrom, so this is what I did:

It uses 3 files:

toolchain.sh : will download and install codesourcery arm toolchain ( arm-2009q3-67 ) and set the PNDSDK path variable ( /usr/local/pandora/arm-2009q3 ). It can be used alone to install the basic toolchain. (THIS FILE IS MADE BY CPASJUSTE)

pnd_opkg_base.sh : will call opkg to install the basic packages

pnd_lib_fix.sh : will fix the paths from the download packages, this is based on Cpasjuste's pnd_lib.sh, with some of my own changes. This is designed to be run everytime you install a new package, it should not mess with packages already "fixed".



Instructions:

- Run toolchain.sh to install the basic toolchain and environment variables
# sudo ./toolchain.sh


- Download and install opkg:
# apt-get install libcurl4-openssl-dev libgpgme11-dev
# wget http://opkg.googlecode.com/files/opkg-0.1.8.tar.gz
# tar xzvf opkg-0.1.8.tar.gz
# cd opkg-0.1.8
# ./configure --prefix=$PNDSDK
# make
# sudo make install


- Copy the opkg config files from your Pandora:
# sudo mkdir /etc/opkg
# sudo scp <your-pandora-user-name>@<your-pandora-ip>:/etc/opkg/* /etc/opkg


- Edit the file /etc/opkg/opkg.conf and change the line:
* dest root /usr/local/pandora/arm-2009q3


- run the pnd_opkg_base.sh script to fetch the base packages from angstrom (since you got the opkg files from your pandora, it will already fetch the correct architecture).
# sudo ./pnd_opkg_base.sh



- run pnd_lib_fix.sh, it will fix the paths of the installed packages, and install a custom pkg-config with the correct pack (the same as in cpasjuste's script).
# sudo ./pnd_lib_fix.sh




That's it, now you should be able to install any package using "opkg-cl install <package>", and upgrade using "opkg-cl update; opkg-cl upgrade". The command is "opkg-cl" instead of "opkg", I don't know why.

Remember to always run "pnd_lib_fix.sh" after installing a package, as it may contain paths to the root filesystem instead of $PNDSDK.



One problem I noticed is that compiling some programs I got a strange error, that looks like is a bug on the gcc used on angstrom, I solved it by setting this CXXFLAGS before compiling:

CFLAGS="-g -O"

there seems to be a problem with -O2 with some C++ constructs.




Feedback is always welcome, use this at your own risk, this has worked for me, but if it ruins your system, I don't have anything to do with it!




toolchain.sh

pnd_opkg_base.sh

pnd_lib_fix.sh
 
Last edited by a moderator:
Hitnrun said:
One problem I noticed is that compiling some programs I got a strange error, that looks like is a bug on the gcc used on angstrom, I solved it by setting this CXXFLAGS before compiling:

CFLAGS="-g -O"

there seems to be a problem with -O2 with some C++ constructs.
could you elaborate there, please?
 
Last edited by a moderator:
darkblu said:
Hitnrun said:
One problem I noticed is that compiling some programs I got a strange error, that looks like is a bug on the gcc used on angstrom, I solved it by setting this CXXFLAGS before compiling:

CFLAGS="-g -O"

there seems to be a problem with -O2 with some C++ constructs.
could you elaborate there, please?

I was having this problem:

http://mandriva.598463.n5.nabble.com/Bug-49433-gcc4-4-NEW-gcc4-4-misses-std-endl-implementation-at-O2-td669229.html

If you compile a simple program that uses std::endl, at -O2 or above,
link step fails with this message:

# g++4.4 -O2 h.cc -o h
/tmp/magallon/ccADTQh6.o: In function `main':
h.cc:(.text+0x84): undefined reference to `std::ctype<char>::_M_widen_init() const'
collect2: ld returned 1 exit status

If you lower optmization to -O, or add -fno-inline, it works.

Looks like this problem happens with the default compiler that comes with argstrom, I got this on one of the source codes of my program, I had to set the CFLAGS to -O to make it compile.
 
Last edited by a moderator:
thanks, Hitnrun. that's good to know.

i'd suggest you actually use the -fno-inline option, as dropping optimisations to -O1 is a tad harsh.

apropos, apparently inlining was promoted to O2 in 4.4.x, as in 4.3.x it occurs only at O3.
 
Why don't you stick the installation of opkg in the toolchain script? ;)

Also, it might be an idea to make a wrapper script for opkg that does all of the necessary "library fixes" automatically.
 
Can someone post some code that compiles with this?

I am getting:

checking bzlib.h usability... no
checking bzlib.h presence... no
checking for bzlib.h... no
checking zlib.h usability... no
checking zlib.h presence... no

and it does not compile.

unzip.c:11: fatal error: zlib.h: No such file or directory
compilation terminated.

I tried "--with-zlib=$PNDSDK/usr"
and
export PKG_CONFIG_PATH="$PNDSDK/usr/lib/pkgconfig" in .bashrc

and it still does not work.
 
dgame said:
I tried "--with-zlib=$PNDSDK/usr"
and
export PKG_CONFIG_PATH="$PNDSDK/usr/lib/pkgconfig" in .bashrc
Check is that does work for you :
Code:
$ pkg-config --libs zlib
-L/usr/local/pandora/arm-2009q3/usr/lib -lz  
$ pkg-config --cflags zlib
-I/usr/local/pandora/arm-2009q3/usr/include
 
Last edited by a moderator:
sebt3 said:
dgame said:
I tried "--with-zlib=$PNDSDK/usr"
and
export PKG_CONFIG_PATH="$PNDSDK/usr/lib/pkgconfig" in .bashrc
Check is that does work for you :
Code:
$ pkg-config --libs zlib
-L/usr/local/pandora/arm-2009q3/usr/lib -lz  
$ pkg-config --cflags zlib
-I/usr/local/pandora/arm-2009q3/usr/include

Same results. Same problem. No zlib.

Does this work for you? Does the original Cpasjuste method work?

Cpasjuste said:
Hi, i did re-write my little pandora toolchain/sdk scripts for an easier and better installation.
This stuff is writed/tested for deb based distributions ( debian, ubuntu ... ), 32 and 64 bits.

It comes in 3 files :

toolchain.sh : will download and install codesourcery arm toolchain ( arm-2009q3-67 ) and set the PNDSDK path variable ( /usr/local/pandora/arm-2009q3 ). It can be used alone to install the basic toolchain.

pnd_libs.sh : will download and install some libraries from the angstrom repository, based on the third file list. It need the "libraries.list" file.

libraries.list : a list of libraries URL from angstrom repo. So if pnd_libs.sh script isn't too crappy, we (you) should only need to update this list to update.


I encourage you to report me libraries that may miss you ( i just added a very few one for gles, x11 and sdl ), if they are part of the actual pandora base image, i'll add them to the "libraries.list" file.
The "toolchain.sh" script and "pnd_libs.sh" scripts will leave a "tmp" directory where it was launched with downloaded stuff, you can safely delete it.


toolchain.sh
pnd_libs.sh
libraries.list

Where is there a working Pandora Cross Compiler toolchain with sample source code like "Hello World" and such?

I have previously installed the Cross Compiler toolchain for the Dingoo (in Ubuntu and Cygwin) and it works.

The Pandora Wiki points to the Cpasjuste thread quoted above and that thread leads to this one?

So which one is it? How do I get this to work.
 
Last edited by a moderator:
dgame said:
Same results. Same problem. No zlib.
Weird. My I ask which package you're working on ?
Many not saying most, have a weird beaviour when cross-compilling.

dgame said:
Does this work for you? Does the original Cpasjuste method work?

Where is there a working Pandora Cross Compiler toolchain with sample source code like "Hello World" and such?
I have previously installed the Cross Compiler toolchain for the Dingoo (in Ubuntu and Cygwin) and it works.
The Pandora Wiki points to the Cpasjuste thread quoted above and that thread leads to this one?
So which one is it? How do I get this to work.
The best I have done so far to explain is here.
I do have my trouble with the toolchain, but zlib never fail on me.
 
Last edited by a moderator:
Hitnrun said:
I have now installed DJwillis's toolchain, and it is MUCH easier and work much better, and it also includes opkg package installing.

Check it out here:
http://blogs.distant-earth.com/wp/?p=109
Agree :)
I got qt 4.7 compiled and completly working with this toolchain. Except kde-games within a few days/weeks :) yeahhhh
 
Last edited by a moderator:
Just some scripts like sdl-config returns the wrong path, is there any standard fix for this? I adapted the cpasjuste's scripts for this toolchain, but I have to run it each time I install something, pkg-config already does the fixing automatically...
 
I got past the sdl-config error by doing this:
sudo apt-get install libsdl1.2-dev

Then I got a "can't find bzlil on your system" error.

So I did this:
./configure --host=arm-angstrom-linux-gnueabi --prefix=$SDK_PATH

Then the code compiled!
 
Hitnrun said:
Just some scripts like sdl-config returns the wrong path, is there any standard fix for this? I adapted the cpasjuste's scripts for this toolchain, but I have to run it each time I install something, pkg-config already does the fixing automatically...

I've used this (modified from pnd_libs.sh) on DJwillis's toolchain ti fix the *config scripts and the libtools files :
Code:
#!/bin/bash
. /usr/local/angstrom/arm/environment-setup

# update library/include paths
ln -sf $SDK_PATH/$TARGET_SYS/usr/bin/sdl-config $SDK_PATH/$TARGET_SYS/usr/bin/arm-angstrom-linux-gnueabi-sdl-config
ln -sf $SDK_PATH/$TARGET_SYS/usr/bin/libpng-config $SDK_PATH/$TARGET_SYS/usr/bin/arm-angstrom-linux-gnueabi-libpng-config
ln -sf $SDK_PATH/$TARGET_SYS/usr/bin/freetype-config $SDK_PATH/$TARGET_SYS/usr/bin/arm-angstrom-linux-gnueabi-freetype-config 


SEDCMD="s#prefix=.*#prefix=$SDK_PATH/$TARGET_SYS/usr#g;s#includedir=.*#includedir=$SDK_PATH/$TARGET_SYS/usr/include#g;s#libdir=.*#libdir='$SDK_PATH/$TARGET_SYS/usr/lib'#;s# /usr/lib/lib([A-Z0-9a-z.-]*).la# $SDK_PATH/$TARGET_SYS/usr/lib/lib\1.la#g;s# /usr/lib# $SDK_PATH/$TARGET_SYS/usr/lib#g;s#-L/usr/lib#-L$SDK_PATH/$TARGET_SYS/usr/lib#g;s#-R/usr/lib#-R$SDK_PATH/$TARGET_SYS/usr/lib#g;s#-I/usr/include#-I$SDK_PATH/$TARGET_SYS/usr/include#g"
for i in $(find $SDK_PATH/$TARGET_SYS/usr/lib -name '*la'; find $SDK_PATH/$TARGET_SYS/usr/lib/pkgconfig -name '*pc');do 
        if [ ! -d $i ];then
                sed -i "$SEDCMD" $i
        fi
done
SEDCMD="s#^prefix=.*#prefix=$SDK_PATH/$TARGET_SYS/usr#;s#^exec_prefix=.*#exec_prefix=$SDK_PATH/$TARGET_SYS/usr#;s#^includedir=.*#includedir=$SDK_PATH/$TARGET_SYS/usr/include#;s#^libdir=.*#libdir=$SDK_PATH/$TARGET_SYS/lib#"
for i in $(find $SDK_PATH/$TARGET_SYS/usr/bin -type f -name "*-config");do 
        if [ ! -d $i ];then
                sed -i "$SEDCMD" $i
        fi
done

dgame said:
I got past the sdl-config error by doing this:
sudo apt-get install libsdl1.2-dev
Wrong way :(
purge this package (unless you plan on compiling for your machin)
and try my script fix instead.
 
Last edited by a moderator:
sebt3 said:
Hitnrun said:
Just some scripts like sdl-config returns the wrong path, is there any standard fix for this? I adapted the cpasjuste's scripts for this toolchain, but I have to run it each time I install something, pkg-config already does the fixing automatically...

I've used this (modified from pnd_libs.sh) on DJwillis's toolchain ti fix the *config scripts and the libtools files :


dgame said:
I got past the sdl-config error by doing this:
sudo apt-get install libsdl1.2-dev
Wrong way :(
purge this package (unless you plan on compiling for your machin)
and try my script fix instead.

sebt3 said:
Wrong way :(
purge this package (unless you plan on compiling for your machin)
and try my script fix instead.

Thanks!

I did a apt-get remove --purge libsdl1.2-dev and the sdl-config error returns.

Put the your script in a file and executed it and it did not fix the error.

Reinstalled with sudo apt-get install libsdl1.2-dev and the sdl-config error went away.

Then ./configure --host=arm-angstrom-linux-gnueabi --prefix=$SDK_PATH
works again.


EDIT: How do you run the script above. I sudo chmod 777 filename and sudo ./filename

Can you put something in it to let me know its running?

I am getting :
arm-angstrom-linux-gnueabi/bin/ld: cannot find -lSDL
collect2: ld returned 1 exit status
 
Last edited by a moderator:
I did a clean install of Ubuntu 10.4, and installed the DJWillis toolchain from http://blogs.distant-earth.com/wp/?p=109 .
I then put some echoes in the sebt3 script above to confirm that it does run on my system.

However, when I do: ./configure --host=arm-angstrom-linux-gnueabi --prefix=$SDK_PATH I still get:
checking for sdl-config... no
configure: error: can't find sdl-config on your system

apt-get install libsdl1.2-dev got past the error and allowed some things to compile but as sebt3 suggested it does not fix the SDL problem with the toolchain.

Has anyone got a fix for the sdl-config error in the DJWillis toolchain?

I was able to get gngb (Game Boy Color emulator) to compile and it works fast and sounds great on the Pandora. The sound is better than some GBC emulators in my opinion. Gnuboy sometimes crackles and VBA goes nuts at 44100 and has weird sound levels. The problem I am having with gngb is that it uses YUV overlay to scale the screen. This results in some ghosting of the image and the picture is not as clear as VBA in 3x mode.

I was experimenting with some SDL scaling code and realized that indeed the SDL in the toolchain was not being used.

I also tried to compile Basilisk II (68K mac emulator) and got stuck at SDL as the linker can't use the native (incorrect for Pandora) one.

I know at least one person seems to get pissed about SDK/toolchain requests but please understand that there are those of us with some programming skills (or desires) who are not Linux cross compiling gurus.

Thus I am requesting help in locating and/or setting up a fully working cross compiling toolchain for the Pandora.


Thanks.


PS: I can download and install whatever Linux distro you prefer if there are better options for cross-compiling than Ubuntu.
 
dgame said:
I did a clean install of Ubuntu 10.4, and installed the DJWillis toolchain from http://blogs.distant-earth.com/wp/?p=109 .
I then put some echoes in the sebt3 script above to confirm that it does run on my system.

However, when I do: ./configure --host=arm-angstrom-linux-gnueabi --prefix=$SDK_PATH I still get:
checking for sdl-config... no
configure: error: can't find sdl-config on your system

apt-get install libsdl1.2-dev got past the error and allowed some things to compile but as sebt3 suggested it does not fix the SDL problem with the toolchain.

Has anyone got a fix for the sdl-config error in the DJWillis toolchain?

I was able to get gngb (Game Boy Color emulator) to compile and it works fast and sounds great on the Pandora. The sound is better than some GBC emulators in my opinion. Gnuboy sometimes crackles and VBA goes nuts at 44100 and has weird sound levels. The problem I am having with gngb is that it uses YUV overlay to scale the screen. This results in some ghosting of the image and the picture is not as clear as VBA in 3x mode.

I was experimenting with some SDL scaling code and realized that indeed the SDL in the toolchain was not being used.

I also tried to compile Basilisk II (68K mac emulator) and got stuck at SDL as the linker can't use the native (incorrect for Pandora) one.

I know at least one person seems to get pissed about SDK/toolchain requests but please understand that there are those of us with some programming skills (or desires) who are not Linux cross compiling gurus.

Thus I am requesting help in locating and/or setting up a fully working cross compiling toolchain for the Pandora.


Thanks.


PS: I can download and install whatever Linux distro you prefer if there are better options for cross-compiling than Ubuntu.

sdl-config needs to be patched, use the sebt3 script above.


I use configure like this:

# source /usr/local/angstrom/arm/environment-setup
# ./configure --host=$TARGET_SYS --prefix=$SDK_PATH/$TARGET_SYS/usr
 
Last edited by a moderator:
Thanks Hitnrun & sebt3.

It still does not work for me. Sdl-config / no SDL errors. I ran the sebt3 fix above. Still does not link to SDL in toolchain even with a manual Makefile explicitly pointing to the SDL library and include paths in the toolchain. I am getting a bit cross-eyed trying to figure this out. I am going to just quit for now and wait until DJWillis or Open Pandora releases an updated toolchain or something. I guess some have the knowledge and some don't. I will try again later.

Thanks again.
 
Back
Top