Code Sourcery, Symlinks


Rockthesmurf

Advanced Member
Joined
Jul 18, 2003
Messages
1,115
Age
40
Location
Manchester, UK
Website
Visit site
Hi there,

In an attempt to compile apkenv from my Windows box, it seemed my best bet was to use the cygwin environment (along with my existing CodeSourcery tool chain, and Pandora SDK). Initially things were looking pretty good:


$ make DEBUG=1
CC apkenv.o
CC linker/dlfcn.o
CC linker/strlcpy.o
CC linker/linker.o
CC linker/linker_environ.o
CC linker/rt.o
CC compat/hooks.o
CC compat/liblog_wrappers.o
CC compat/gles_wrappers.o
compat/gles_wrappers.c: In function 'my_glGetTexStreamDeviceNameIMG':
compat/gles_wrappers.c:1548: warning: control reaches end of non-void function
compat/gles_wrappers.c: In function 'my_glUnmapBufferOES':
compat/gles_wrappers.c:1524: warning: control reaches end of non-void function
compat/gles_wrappers.c: In function 'my_glMapBufferOES':
compat/gles_wrappers.c:1518: warning: control reaches end of non-void function
compat/gles_wrappers.c: In function 'my_glQueryMatrixxOES':
compat/gles_wrappers.c:1410: warning: control reaches end of non-void function
CC compat/libc_wrappers.o
CC compat/pthread_wrappers.o
CC compat/gles2_wrappers.o
CC apklib/ioapi.o
CC apklib/ioapi_mem.o
CC apklib/unzip.o
CC apklib/apklib.o
apklib/apklib.c: In function 'apk_get_shared_libraries':
apklib/apklib.c:83: warning: implicit declaration of function 'recursive_mkdir'
CC jni/jnienv.o
CC jni/shlib.o
CC imagelib/loadpng.o
CC imagelib/loadjpeg.o
CC debug/debug.o
CC pandora/platform.o


But then it tries to link:


LINK apkenv
C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\lib/libz.so: file not recognized: File format
not recognized
collect2: ld returned 1 exit status
makefile:90: recipe for target `apkenv' failed
make: *** [apkenv] Error 1


The problem it is having is that libz.so is a symbolic link, cygwin knows this:


$ file "C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\lib/libz.so"
C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\lib/libz.so: symbolic link to `libz.so.1.2.3'



But the Code Sourcery tool chain seems to struggle, a simple example:


$ arm-none-linux-gnueabi-nm.exe C:/Users/scraft/Pandora/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib/libz.so
arm-none-linux-gnueabi-nm.exe: C:/Users/scraft/Pandora/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib/libz.so: File format not recognized




The version I am running:


gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202)




Perhaps I should try a later version of Code Soucery (on one of my other machines I actually have a later version set up)?

For what it is worth I have tried putting CYGPATH=cygpath in my environment, but it doesn't help.

Has anyone experienced this? Feels like there must be a solution?!
 
To get something going, I deleted all the symlinked libraries required for apkenv, and simply copied the real library multiple times (to each of the symlinks) this obviously wastes disk space (and has to be done for every library), but it does indeed get around it:


$ make DEBUG=1
CC apkenv.o
CC linker/dlfcn.o
CC linker/strlcpy.o
CC linker/linker.o
CC linker/linker_environ.o
CC linker/rt.o
CC compat/hooks.o
CC compat/liblog_wrappers.o
CC compat/gles_wrappers.o
compat/gles_wrappers.c: In function 'my_glGetTexStreamDeviceNameIMG':
compat/gles_wrappers.c:1548: warning: control reaches end of non-void function
compat/gles_wrappers.c: In function 'my_glUnmapBufferOES':
compat/gles_wrappers.c:1524: warning: control reaches end of non-void function
compat/gles_wrappers.c: In function 'my_glMapBufferOES':
compat/gles_wrappers.c:1518: warning: control reaches end of non-void function
compat/gles_wrappers.c: In function 'my_glQueryMatrixxOES':
compat/gles_wrappers.c:1410: warning: control reaches end of non-void function
CC compat/libc_wrappers.o
CC compat/pthread_wrappers.o
CC compat/gles2_wrappers.o
CC apklib/ioapi.o
CC apklib/ioapi_mem.o
CC apklib/unzip.o
CC apklib/apklib.o
apklib/apklib.c: In function 'apk_get_shared_libraries':
apklib/apklib.c:83: warning: implicit declaration of function 'recursive_mkdir'
CC jni/jnienv.o
CC jni/shlib.o
CC imagelib/loadpng.o
CC imagelib/loadjpeg.o
CC debug/debug.o
CC pandora/platform.o
LINK apkenv
MOD fruitninja.apkenv.so
MOD angrybirds.apkenv.so
MOD trg2.apkenv.so
MOD cuttherope.apkenv.so
In file included from C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\include/SDL/SDL_stdinc.h
:30,
from C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\include/SDL/SDL_main.h:2
6,
from C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\include/SDL/SDL.h:30,
from modules/cuttherope.c:42:
C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\include/SDL/SDL_config.h:67: warning: "HAVE_ST
DLIB_H" redefined
C:\Users\scraft\Pandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\usr\include/jconfig.h:12: note: this is the locati
on of the previous definition
MOD generic.apkenv.so
MOD unity.apkenv.so
MOD openframeworks.apkenv.so
MOD marmalade.apkenv.so
MOD worldofgoo.apkenv.so


Some sort of progress (I guess?) would obviously be a hole lot nicer if symlinks worked correctly.
 
Because Steven is obviously a windows user (he uses cygwin ATM). Not everyone has or the has the room for, spare machines to run Linux on.
 
The idea of a Linux VM has certainly come up, I'm not a big fan of having to run a VM to compile something, and I'm not really much of a fan of Linux, but perhaps it is an option (at the moment I think I'd prefer to manually duplicate all the symlinked libraries as and when I get a link error for them). I am running Windows 7, so I reckon I should be able to write a script to find all symlinks (with Cygwin) and then delete them and set up junction points instead. I reckon the junction points would then work for anything (native windows, cygwin). I am trying to avoid getting too side tracked though, I actually wanted to try writing a module for apkenv..
 
Just dual boot into real Linux.  That should be more straightforward than to have to work around silly issues like having an OS that doesn't understand symlinks.
 
No need to use Linux. (Also no need to use cygwin)

For me the following process has always worked so far (have not encountered any trouble with symlinks yet). I am using the 2011.09-70 version of the toolchain (linked below)

Install this toolchain: https://sourcery.mentor.com/GNUToolchain/package9731/public/arm-none-linux-gnueabi/arm-2011.09-70-arm-none-linux-gnueabi.exe (Don't use versions newer than that since they are incompatible with the outdated libraries on the Pandora - this should change with .next)

(A list of all available versions of the CodeSourcery toolchain: https://docs.google.com/document/d/1xAaPRafox5XPy_TtXdYwPb9_ocMyOrKGmsq4eXRWAsc/ )

Then install these libraries (if you need anything besides the standard C++ libs, like SDL, OpenGLES, etc.): http://foxblock.pirategames.co.uk/dropbox/Pandora_libraries.zip (copy on top of the toolchain so lib and include folders are merged)

And you are pretty much good to go as soon as you have set up your compiler.

I have not touched Linux in a while and build all my PNDs on Windows only.

For reference here is an example compiler call:


arm-none-linux-gnueabi-g++.exe -fno-exceptions -fno-rtti -O3 -mcpu=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp -ffast-math -fsingle-precision-constant -I<<PATH TO YOUR PERSONAL CODE/LIBS HERE>> -ID:\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_GNU_Linux\include  -c <<FILE TO COMPILE>> -o <<PATH OUTPUT OBJECT>>
and linker call:


arm-none-linux-gnueabi-g++.exe -LD:\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_GNU_Linux\lib  -o <<LIST OF OBJECT FILES HERE>> -static-libstdc++ <<LIBRARY LINKS HERE>>
my Toolchain is installed in "D:\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_GNU_Linux"

Don't forget the "-static-libstdc++" if you make use of the stl, since the C++ libs included with the CodeSourcery compiler are newer than the ones available on the Pandora. This will bake the new libraries into the binary and it should run fine on the Pandora. (Else you can also use an even older version of the Sourcery toolchain)

I am using CodeBlocks to manage my projects, so I don't have to call g++ manually, but setting up make and a makefile should work just as well

Note: The library package is something I carry around for a while now, parts of it might be outdated, but it still works for me so I never bothered to update it.
 
Last edited by a moderator:
@foxblock: thanks, I have actually built all my PNDs so far purely from Windows, using the Code Sourcery tool chain - my issue now is I want to build a few projects from the *nix world that use make/configure/etc. so it felt like Cygwin was going to be the starting point. My typical build process is actually very similar to you, only I use some random 'SDK' 20100611-i686-linux-armv7a-linux-gnueabi-toolchain-openpandora.tar that I grabbed from somewhere for headers/libs. Perhaps this 'SDK' has the symlinks set up weird, I might give yours a try!

Just dual boot into real Linux.  That should be more straightforward than to have to work around silly issues like having an OS that doesn't understand symlinks.
Linux, straight forwards? LOL...
 
@foxblock: thanks, I have actually built all my PNDs so far purely from Windows, using the Code Sourcery tool chain - my issue now is I want to build a few projects from the *nix world that use make/configure/etc. so it felt like Cygwin was going to be the starting point. My typical build process is actually very similar to you, only I use some random 'SDK' 20100611-i686-linux-armv7a-linux-gnueabi-toolchain-openpandora.tar that I grabbed from somewhere for headers/libs. Perhaps this 'SDK' has the symlinks set up weird, I might give yours a try!

Just dual boot into real Linux. That should be more straightforward than to have to work around silly issues like having an OS that doesn't understand symlinks.
Linux, straight forwards? LOL...
I find Linux/Unix to be substantially more straight forward than Windows.. But that's because I have abandoned windows for almost a decade..


Going back to Windows I find I can't do anything.. you start off with such a limited collection of programs to do anything with.. Also having to go to the computer manufacturers website and download a slew of windows drivers to get simple things like the chipset, USB, Wifi, SATA drivers working is just moronic, I shouldn't need to do this on my 4 year old Desktop.. Most Linux distributions now generally everything works right out of the box with in a month of a device coming to market..


But I suppose straight forward is a matter of the opinion.
 
Last edited by a moderator:
Going back to Windows I find I can't do anything.. you start off with such a limited collection of programs to do anything with.. Also having to go to the computer manufacturers website and download a slew of windows drivers to get simple things like the chipset, USB, Wifi, SATA drivers working is just moronic, I shouldn't need to do this on my 4 year old Desktop.. Most Linux distributions now generally everything works right out of the box with in a month of a device coming to market..


But I suppose straight forward is a matter of the opinion.
Have not had a driver problem since I started using Windows 7 and I installed that on 4-5 year old PCs, too - it always worked out of the box. Some people have weird problems with Windows, others got the same problems with Linux.

Anyway, every OS sucks and it's all a matter of preference to me.
 
Last edited by a moderator:
Just dual boot into real Linux.  That should be more straightforward than to have to work around silly issues like having an OS that doesn't understand symlinks.
I've thought about doing this a few times, but TBH, I've dismissed the idea, generally because it seems such a ballache to reboot your computer just to compile + package something.

I certainly find the VM method the best method. You can boot it up, whilst still leaving all your browser/email/video/development IDE/etc. open. SebT3's VM saved me a lot of time even trying to figure out where to start building the toolchain
 
To be fair, the last time I installed Linux (on anything except my PS2 Linux kit) was probably around 10 years ago now. Back then simple things like having dual hardware accelerated displays was complex enough that I never succeeded in it (and going by the huge threads about people in the same boat as me, I don't think I was alone). Prior to that, 'dependency hell' was the best description I had of Linux, it seemed I had to manually build the software I wanted to run, but the libraries different software required didn't match up, so nothing seemed to work right. My previous (and first) dabble in Linux (even further back) resulted in a severe difficult getting a graphical display (many lines needed to be entered into the shell to fix enough problems to get a graphical environment).

So, due to Linux being rubbish (the times I have tried it) I have instead invested my time learning Windows and Windows application. Once you have done that, it gets increasingly hard to switch to anything else. I am forced to use a Mac running OSX from time to time (typically to debug problems on iOS/OSX) which initially was a nightmare, but now is sufferable, but I am still hugely less productive ambling around in OSX than I am in Windows 7.

I guess developing for the Pandora does give me a good excuse to play around with Linux again (in a VM), my main issue is I have such limited time to play around on the Pandora as it is, I kind of feel I'd rather spend the time actually doing development, rather than spending time learning OS's etc.

EDIT: Oh, very recently I installed Slackware Linux on my Pandora, even with a guide that didn't work right. It required help from Linux-SWAT and involved using the command line to rewrite partition tables to an SD card. For me personally, it was just my 'typical' experiences with Linux. Now that I have Slackware on my Pandora, it is nice I must say!
 
Last edited by a moderator:
Oh, if you're a dev, then use Linux as main OS.

BTW my guide is ok:

  • Format a 8G or more SD card with the Ext2 filesystem. To make explanations clear, name it SLACK.
  • If you don't know how to format a drive, use GParted under Linux, or run their Live-CD. Here's the manual.
  • It's highly recommended to have a second partition formated as a swap. 256M or more is a good choice. 512M is wiser is you plan to compile some stuff, or for server use.
You just didn't formatted properly the SD card, so without a doubt, having a dual-screen setup should have been an impossible mission for ya :p .
 
Last edited by a moderator:
Oh, if you're a dev, then use Linux as main OS.
I have been a developer for the largest games software houses in the UK and can confirm neither of them use Linux for anything other than servers in the IT department. I can also confirm that this is typical across all other games developer software houses I have had any commications with. I can also confirm that the amount of software developers at any of the studios I have worked at that run Linux as their main OS at home are < 5% (to be honest, <1% is probably correct too).

BTW my guide is ok:
Sure, your guide is good, we appreciate you taking the time to make it, but ultimately after following to the best of my ability, it didn't work. It then took some messing around on the command line to fix it. Sure you can blame user error on my part, and I don't want to appear ungrateful for your help in resolving the issue. But the idea that 'Linux is straightforwards' based on this is not exactly true, at least not true for anyone of my technical abilities and below. For what it is worth, SSH wasn't working when I did get into Slackware, after some Google searches, I found out there is a script that controls it, attempting to access this script it turns out it didn't have the execute bit set, so a chmod operation was required to fix it. I don't know why this happened, possibly another error on my part somewhere along the lines? Sure can just blame the end user for everything (it typically is their fault) but it does highlight some 'difficulties'.
 
Gaming was the last windows fortress so i'm not surprised about the tools you used.

Be happy the free OSes let you the choice of your partitioning and filesytem ! Btw, you had to "mess" with the command line because of your own bad partitions, and fortunately it worked ;^).

The "chmod fix" for sshd to work, my friend, was a plain, simple and straightforward service activation (also documented: http://pandorawiki.org/Software_projects/OS/Slackware/Advanced_usage/SSH).

I don't know if you're a windows fanboy or just a lazy guy, but you should take yourself by the hand and learn some *NIX, because not only it's the future, but it's also the present and the bigger part of the IT past.

But we all are lazy. For instance, i should have already switched a pair of my machines under some *BSD, and at least one Plan 9.
 
LOL..! If there is any fanboy on this forum it is clearly you! It even says it in your name! ;o)

As to having 'bad' partitions, fine, blame the user (that is the typical Linux user stand point), but it is just another clear example for me of the unfriendliness. If you are trying to promote Linux, rather than trolling on threads (threads which aren't actually to do with Linux, they are really a Windows user asking Windows advise) and trying to belittle people who don't agree with your Linux philosophy (saying I'm not a real dev, and that I'm lazy), surely a better use of your time would be to update your instructions to they cater for people, like me, who didn't want to buy a new SD card just to try Linux, and instead wanted to use 8GB of a 16GB card. Surely I am not in the minority here? A new user, wanting to try it out, already own an SD card, tried my best to partition it as per your tutorial and it didn't work out. In the gparted program, it showed my partitions in the order your tutorial required them, I followed a tutorial to set them up like that. If they ended up set up wrong it is a bit rich to blame me. Sure you can always blame the user, but if you want to get more people on board you need to try and make it to users either can't make mistakes, or if they do make them it is clear how to fix them.

The fact I am even trying Slackware indicates I am at least giving Linux a go on some level surely?
 
Last edited by a moderator:
I'm fan of good technology, that makes a _valid_ reason for being a fan.

There's a difference in trolling and trying to provide an answer. You asked for help, the most obvious and best response was "install Linux".

So here comes the typical windows/mac guy's rant: it's complicated (with examples).

I'll stop there.
 
Back
Top