1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice

Pandora Crosscompiler Toolchain Based On Openpandora.org Ipks

Discussion in 'General Discussions' started by ivanovic, Feb 14, 2012.

  1. ivanovic

    ivanovic Member

    Joined:
    Aug 17, 2006
    Messages:
    381
    This is basically meant to continue the thread from the other board. It is based on "EDIT9" (introducing "Sourcery CodeBench Lite 2011.09-70 for ARM GNU/Linux") from the old thread in case any questions regarding the version arise.


    Hi everybody!


    Todays post is about yet another try on getting a nicely working toolchain setup that allows crosscompilation of pandora binaries on x86 based Linux systems. Here a short summary what this is meant to be (and later on what it is *not* meant to be!):

    • Rather easy to setup toolchain that allows compiling binaries for the pandora on a linux host.
    • Should support x86 as well as amd64 with multilib support.
    • Installable inside a users $HOME without root priviledges.
    • Completely based upon the packages that are also used on the pandora. It should use exactly the versions as shipped with the pandora and just those.
    • Includes all libs and headers that are also found on the pandora (even some useless progs) but only a small number of binaries that can't be run on the host architecture.
    • Should be rather easy to keep in sync with upsteam (aka openpandora.org) version changes.


    What it is not meant to be:

    • An sdk that is able to build the official firmware image. For those you still need an OpenEmbedded based setup so that you can make use of the recipes directly.
    • It likely won't work on "pure" 64bit systems because the toolchain, things are based on (codesourcery), is plain x86.
    • It will not automatically get all the dependencies that you need to make things work for your distribution. You will have to make your system able to compile things (for itself) before you can start with this toolchain.
    • Some things like eg the gettext tools (for generation of translations used in the programs you compile with your toolchain) will have to be provided by your system. Stuff like msgfmt is *not* included!
    • This sdk is not meant to be installed systemwide with root priviledges. In my early tests I could have destroyed my whole system if I were using root privs. Those problems have likely be fixed, but better save than sorry, so: don't install with root privs (either logged in as root or using su -c or sudo)!!!


    This toolchain is built upon the efforts and scripts provided by Cpasjuste as well as Hitnrun. Some of the scripts are (or were once) 1:1 copies of their scripts. What I mainly changed is removing stuff like sudo. The scripts should be 100% distribution independent.


    Pre start dependencies:

    • wget
    • bash
    • sed
    • md5sum
    • working compile env for host system


    In case of a gentoo system all dependencies should already be met, on an Ubuntu system this command should install the required compile env, though I have no way to test this and can't be sure:



    Code:
    sudo apt-get install libcurl4-openssl-dev libgpgme11-dev libtool build-essential


    Some notes regarding the scripts:
    • Make sure to change the variable PNDSDK_DIR at the top of the script to match your system. Make sure that your current user has permissions to write into this folder.
    • After installation the SDK itself requires about 2.1GB on your harddrive. During installation about 700MB are downloaded into a tmp/ folder created where you call the scripts from. Those files can be removed after the script completed.
    • After installation is done and everything works you can remove the following files/folders:
      the installation script itself
    • the folder "tmp/" (all downloaded files should have been stored here, as well as some folders used for temporary compilation)





    Now to the most important part, the sdk itself:

    1. Download the script

      Download the script openpandora_toolchain.sh. The installer script is still a single file but now available directly from the openpandora.org git repositories. To check the history of the file, please head over to git.openpandora.org/pandora-misc.git/sdk_installer.
    2. Fix line endings using "dos2unix"

      After downloading the script in the step before you should run "dos2unix" on the file to make sure that they work nicely for you.


      Code:
      dos2unix openpandora_toolchain.sh
    3. Make the script executable


      Code:
      chmod +x openpandora_toolchain.sh
    4. Check that everything is correctly setup

      Have a look into the script using a texteditor. If you want your toolchain installed somewhere else (aka "not in $HOME/pandora-dev") you have to change the variable PNDSDK_DIR in line 100. You should also read through the comments at the top since they might include some useful information.
    5. Execute the script

      Once everything else is done (and you got the dependencies installed!) execute the script:


      Code:
      ./openpandora_toolchain.sh
    6. In case of errors
      If you get an error message, you should try to fix those problems. They are likely related to you missing some dependencies for compiling opkg or pkg-config. Once you got the deps, rerun the step above.
    7. (optional) Remove temporary folder
      Now that the script has completed running you can remove the temporary folder. Have a look at the last output from the script, it should name the folder.


    Once the script is done, enjoy the crosscompiler toolchain. This new version does directly ship helper files to use with cmake, qmake as well as configure. Using autotools based configure is still problematic though since there are no fixed settings to be used and every script can behave differently, so the wrapper might not work for you... If you encounter any problems, please tell me. If you have suggested improvements or patches for this script I do highly welcome them!


    That should be it for the moment. I hope this toolchain works for you as well as it seems to for me. If you alter on want to update the libs you have available, just rerun the script installer and it should fetch the latest versions currently available for OpenPandora (possibly libs that are only available in a beta firmware!).
     
    Last edited by a moderator: Jan 2, 2016
    Tags:
  2. emilio

    emilio Member

    Joined:
    Sep 18, 2010
    Messages:
    61
    Sorry, I'm no Linux-Pro, but I tried to install the toolchain in Ubuntu 10.04 and receive this error:



    Code:
    checking for CURL... configure: error: Package requirements (libcurl) were not met:
    
    
    No package 'libcurl' found
    
    
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    
    installed software in a non-standard prefix.
    
    
    Alternatively, you may set the environment variables CURL_CFLAGS
    
    and CURL_LIBS to avoid the need to call pkg-config.
    
    See the pkg-config man page for more details.
    
    
    ERROR: Configure for opkg failed, please check the output above


    So I tried to install using this command from script:



    Code:
    sudo apt-get install libcurl4-openssl-dev
    
    Paketlisten werden gelesen... Fertig
    
    Abhaengigkeitsbaum wird aufgebaut      
    
    Status-Informationen einlesen... Fertig
    
    libcurl4-openssl-dev ist schon die neueste Version. 

    --> Newest Version is installed


    So whats wrong?
     
  3. ivanovic

    ivanovic Member

    Joined:
    Aug 17, 2006
    Messages:
    381
    The configure script does not detect that you have all the latest versions. mcobit reported the same problems and this fixed it for him:



    Code:
    sudo apt-get install libcurl4-openssl-dev libgpgme11-dev libtool build-essential
     
  4. ZXDunny

    ZXDunny Deep avatar

    Joined:
    Oct 12, 2010
    Messages:
    2,458
    Awww, no love for Windows users? A toolchain in WIndows would rock.


    D.
     
  5. skeezix

    skeezix Certified Guru

    Joined:
    Mar 11, 2003
    Messages:
    8,058
    Use a VM :)


    jeff
     
  6. ZXDunny

    ZXDunny Deep avatar

    Joined:
    Oct 12, 2010
    Messages:
    2,458
    That's what I do currently - Debian under Virtualbox on Win7 :)


    I have both Lazarus and Yactfeau set up to build ARM binaries.


    D.
     
  7. skeezix

    skeezix Certified Guru

    Joined:
    Mar 11, 2003
    Messages:
    8,058
    Code Sourcery supports Windows, right?


    So why not try an old trick..


    1) Install Code Sourcery (on Windows)


    2) Copy /usr/lib/* from your pandora (or a firmware download)


    3) Use /usr/include/* from some linux distro (ie: copy it from your VM)


    .... good to go!


    ie: I have a couple year old blog post somewhere abotu setting up CSL on Linux and building a pandora app in like 10 minutes (not including download time); CSL, firmware extract libs, and use my lcoal linux /usr/include. Works _fine_, except for kernel modules and such. You coudl use the same approach for CS for Windows (or any other ARM crosscompiler build of gcc or the like.)


    Has no one pre-assembled one of these yet? ITs really not too bad to do.. someone should throw a Windows gcc build like this up, even if it gets stale.. I mean, it could be 3 years old and sitll work fine, just not be optimal.


    jeff


    yeup, there it is:


    IA32 Windows: Microsoft Windows 2000 or later, running on 32- or 64-bit CPUs. Cygwin not required, however Sourcery CodeBench can be used from Cygwin and resolve Cygwin filenames, including symbolic links.
     
    Last edited by a moderator: Feb 23, 2012
  8. foxblock

    foxblock Asleep

    Joined:
    Jun 17, 2009
    Messages:
    1,365
    Location:
    Germany
    Yeah, I am using my own Windows toolchain (mainly because I grew tired of firing up the VM every time) and as other have also expressed interest in this I will be writing a short guide and maybe a tool to automatically gather the libraries when I find the time (aka after exams, some time in March).


    I would mostly go after Ivanovic's script downloading the libraries from the official Pandora repos (as not all devs have a Pandora yet copying might not be an option), installing CodeSourcery (which itself would be a huge time-saver as searching the goddamn Mentor Graphics site for a download link can cost you an hour or two) and providing some set-up help for CodeBlocks (which is what I use to build).


    Additionally one could add PNDTools for packaging and have the full functionality of the Linux toolchains...


    Anyway, this will happen in March if nobody beats me to it. :)
     
    Last edited by a moderator: Feb 23, 2012
  9. emilio

    emilio Member

    Joined:
    Sep 18, 2010
    Messages:
    61
    That fixed the error not for me, when I try to run this I get the described message that I have still the latest version installed.
     
  10. Linux-SWAT

    Linux-SWAT Hardcore Member

    Joined:
    Feb 13, 2010
    Messages:
    8,031
    Great piece of work ^^.
     
  11. ivanovic

    ivanovic Member

    Joined:
    Aug 17, 2006
    Messages:
    381
    Sorry, but since I don't use one of those *buntu (or even debian based) systems I can't help you there to find the correct package names to install. Though it might make sense to check the build.log file for opkg if you find any more information about what it is actually trying to build and where it fails.
     
  12. Letalis Sonus

    Letalis Sonus Very Active Member

    Joined:
    Mar 5, 2009
    Messages:
    973
    The required pkg-config files are in those packages, maybe you are just missing pkg-config itself?
     
  13. bzar

    bzar A Commando

    Joined:
    Sep 22, 2008
    Messages:
    4,433
    Location:
    Finland
    Would adding correct version (4.6) Qt compile tools (qmake, moc, rcc...) be possible? You need those to compile Qt stuff (at least moc and rcc, qmake would be nice) and not many distributions still offer the old version of Qt pandora has.
     
  14. mcobit

    mcobit Advanced Member

    Joined:
    Jul 28, 2008
    Messages:
    6,755
    I compiled advanceMAME with version 2011.3 of your toolchain and it had messed up osd graphics and crashed a lot more.


    Doesn't have these problems in yactfeau
     
    Last edited by a moderator: Feb 29, 2012
  15. ivanovic

    ivanovic Member

    Joined:
    Aug 17, 2006
    Messages:
    381
    Does not make sense since this toolchain is supposed to offer exactly what you also get on the pandora, which is *not* this more recent Qt version but still the ancient one.

    Retry with 2011.9. ;) Okay, I guess the problem here might be different and possibly more aggressive compiler optimizations which can of course lead to problems. Please try to make sure to use the same CFLAGS and CXXFLAGS as you used for yactfeau, too.
     
  16. mcobit

    mcobit Advanced Member

    Joined:
    Jul 28, 2008
    Messages:
    6,755
    Your toolchain has -Os, what I am not sure of, what it means...


    Yactfeau uses -O3 as standard
     
  17. bzar

    bzar A Commando

    Joined:
    Sep 22, 2008
    Messages:
    4,433
    Location:
    Finland
    Exactly for that reason the toolchain should provide Qt tools for the version pandora has. I have the tools for recent versions, but not the ancient one I need to use this toolchain.
     
    dimag0g likes this.
  18. Linux-SWAT

    Linux-SWAT Hardcore Member

    Joined:
    Feb 13, 2010
    Messages:
    8,031
    -Os is size optimization.


    -O3 sucks.


    I think -O3 are now obsolete with newer gcc.
     
    Last edited by a moderator: Mar 1, 2012
  19. Ziz

    Ziz Advanced Member

    Joined:
    Sep 10, 2006
    Messages:
    1,584
    o_O


    Even on my gp2x with just 16 KB Cache O3 is MUCH faster than Os...
     
  20. Pickle

    Pickle Mega GP Mania

    Joined:
    May 30, 2006
    Messages:
    5,387
    Location:
    Detroit, Michigan
    i think for gp2x it was the -fomit-frame-pointer that was the actual performance gainer (which should be included with -O3)
     

Share This Page

Loading...