Problem Compilating D:


waltercool

Still Fresh
Joined
Sep 6, 2010
Messages
18
Hi there

Im using the official toolchain for Linux and DGE, but my binaries doesnt works (if i compile for 32bits, works fine)

That im using for compile:

/opt/caanoo/bin/arm-gph-linux-gnueabi-g++ test.cpp -I/opt/caanoo/arm-gph-linux-gnueabi/sys-root/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -L/opt/caanoo/arm-gph-linux-gnueabi/sys-root/usr/lib -lSDL -I/opt/caanoo/DGE/include -L/opt/caanoo/DGE/lib -lQtGui -I/opt/caanoo/arm-gph-linux-gnueabi/sys-root/usr/include/QtGui -lSDL_image -lSDL_mixer -lpthread -lopengles_lite -lpng -lglport -lpthread -lz -lts -lm -lc -lfreetype -lopenalut11 -lopenal11 -ldgx20 -ldge20 -ldgt20 -lQtGui -Wall -O2

Where is the problem?

Thanks
 
Sorry, but i'm also have a question about compiling example by toolchain. I've got a strange(for me) error when it comes to linker - ld can't recognize symbolic link in .so files:
/usr/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/host/libSDL_image.so: file format not recognized; treating as linker script
/usr/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/host/libSDL_image.so:1: syntax error
collect2: ld returned 1 exit status

Is it because i'm run it with user privileges mode, or miss some of ld's commands? I'm not an advanced Linux user.
 
Aion said:
Sorry, but i'm also have a question about compiling example by toolchain. I've got a strange(for me) error when it comes to linker - ld can't recognize symbolic link in .so files:
/usr/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/host/libSDL_image.so: file format not recognized; treating as linker script
/usr/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/host/libSDL_image.so:1: syntax error
collect2: ld returned 1 exit status

Is it because i'm run it with user privileges mode, or miss some of ld's commands? I'm not an advanced Linux user.

try linking to the libs in DGE/lib/target
 
Last edited by a moderator:
Pickle said:
try linking to the libs in DGE/lib/target
How it can help since i trying to make a host based bin?
When i set build target as a "target" result it's the same:
arm-gph-linux-gnueabi-g++ -Os -Wall -Wall -g -fPIC -fno-common -march=armv5te -mtune=arm9tdmi -mapcs -D_CAANOO_ -I/home/user/Develop/gphsdk1008/GPH_SDK/DGE/include -I/home/user/Develop/gphsdk1008/GPH_SDK/DGE/include/SDL -I/home/user/Develop/gphsdk1008/GPH_SDK/DGE/include/qtype4 -I/home/user/Develop/gphsdk1008/GPH_SDK/include -c main.cpp -o .target/main.o
arm-gph-linux-gnueabi-g++ -L/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target -L/home/user/Develop/gphsdk1008/GPH_SDK/lib/target -o .target/ModPlayer.gpe .target/main.o -s -lDGE -lopengles_lite -lglport -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf -lpng -lz -lpthread -lts -lsmpeg -lfreetype -s
/home/user/Develop/gphsdk1008/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/bin/../lib/gcc/arm-gph-linux-gnueabi/4.2.4/../../../../arm-gph-linux-gnueabi/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so: file format not recognized; treating as linker script
/home/user/Develop/gphsdk1008/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/bin/../lib/gcc/arm-gph-linux-gnueabi/4.2.4/../../../../arm-gph-linux-gnueabi/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so:1: syntax error
collect2: ld returned 1 exit status

Any ideas? (
 
Last edited by a moderator:
Aion said:
Pickle said:
try linking to the libs in DGE/lib/target
How it can help since i trying to make a host based bin?
When i set build target as a "target" result it's the same:
arm-gph-linux-gnueabi-g++ -Os -Wall -Wall -g -fPIC -fno-common -march=armv5te -mtune=arm9tdmi -mapcs -D_CAANOO_ -I/home/user/Develop/gphsdk1008/GPH_SDK/DGE/include -I/home/user/Develop/gphsdk1008/GPH_SDK/DGE/include/SDL -I/home/user/Develop/gphsdk1008/GPH_SDK/DGE/include/qtype4 -I/home/user/Develop/gphsdk1008/GPH_SDK/include -c main.cpp -o .target/main.o
arm-gph-linux-gnueabi-g++ -L/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target -L/home/user/Develop/gphsdk1008/GPH_SDK/lib/target -o .target/ModPlayer.gpe .target/main.o -s -lDGE -lopengles_lite -lglport -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf -lpng -lz -lpthread -lts -lsmpeg -lfreetype -s
/home/user/Develop/gphsdk1008/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/bin/../lib/gcc/arm-gph-linux-gnueabi/4.2.4/../../../../arm-gph-linux-gnueabi/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so: file format not recognized; treating as linker script
/home/user/Develop/gphsdk1008/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/bin/../lib/gcc/arm-gph-linux-gnueabi/4.2.4/../../../../arm-gph-linux-gnueabi/bin/ld:/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so:1: syntax error
collect2: ld returned 1 exit status

Any ideas? (

if by host you mean x86 then why are you using arm-gph-linux-gnueabi-g++?
you can try and remove libglport
 
Last edited by a moderator:
Pickle said:
if by host you mean x86 then why are you using arm-gph-linux-gnueabi-g++?
you can try and remove libglport
No no. Host is Ubuntu 10.04 x86 and the target is Caanoo itself. The second log was just to show that gcc-4.2.4-glibc-2.7-eabi also got a problem with this kind of .so. So nor GCC's ld, nor gcc-4.2.4-glibc-2.7-eabi's ld can't recognize .so. By .so i mean files contains string like this(libSDL.so for example):
libSDL-1.2.so.0.11.2
 
Last edited by a moderator:
Try using the toolchain + DGE instead Caanoo SDK, is a bit easier (and you dont need to play with target and hosts)
 
@Aion: If this would be a file permission problem, the error message would be different. It seems the files themselves may not be right.

Run the command "file /home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so". It should output something like:
Code:
/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so: symbolic link to `libglport.so.0.0.0'
Then run the command "file /home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so.0.0.0". It should then output something like:
Code:
/home/user/Develop/gphsdk1008/GPH_SDK/DGE/lib/target/libglport.so.0.0.0: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped
 
Ok. Finally i've got SDK to work!(by SDK i mean gphsdk1008.7z) At least to run 2DTutorial both on host and target devices.
There're a few tricky steps:
1) First, unzip SDK where've you want. I use /home/user/ dir.
2) Manually get rid of all(!!!in_all_/lib/_dirs_of_SDK!!!) small(12~19B) .so files that contains simple string.
This should be symbolic link files, with the same names, linked to main .so file. For example:
Code:
libdrmcode.so		19B  - file containing a string
libdrmcode.so.0		19B  - file containing a string
libdrmcode.so.0.0.0	15Kb - main shared library object file(of this scope)
Create symbolic links of "libdrmcode.so.0.0.0" with filenames "libdrmcode.so.0" and "libdrmcode.so" replacing old ones.
Alot of work here. Doh...
3) Download and unzip near SDK dir "Caanoo DGE 2.0 SDK Update/Examples" and "Caanoo/Wiz SDK/Toolchain Version 10.08 Linux".
4) Copy include and library files from 20100818dge20caanoo to SDK/DGE/include and /lib/target. May be useful. Someday.
5) All other steps described in GPH_SDK-10.08_en.pdf(/SDK/docs/en) exept this one -
for target build !_DO_NOT_USE_! SDK's gcc-4.2.4-glibc-2.7-eabi compiler! Use it from downloaded "Caanoo/Wiz SDK/Toolchain Version 10.08 Linux"
otherwise you will get error messages like this:
Code:
/home/user/Develop/gphsdk1008/GPH_SDK/tools/gcc-4.2.4-glibc-2.7-eabi/bin/../arm-gph-linux-gnueabi/sys-root/usr/lib/crt1.o: In function `_start':
init.c:(.text+0x2c): undefined reference to `__libc_csu_fini'
init.c:(.text+0x34): undefined reference to `__libc_csu_init'
collect2: ld returned 1 exit status
make: *** [g] Error 1
I think it's something wrong with this toolchain build.(libc related)

I also use CodeBlocks IDE like manual says.
 
How can i debug on Caanoo?? Im tired of black screens of dead D:

Idk why this code http://www.lazyfoo.net/SDL_tutorials/lesson17/index.php is not working D:
 
1) gdb directly. you need to have some terminal connection for this, otherwise it's not useful. first you need to get gdb (http://www.gnu.org/software/gdb/) for arm-eabi (probably need to compile your own, if so, upload it to the archive :)). this is what i do mostly on the wiz, it's easy and gives you enough hints where to look :)

2) gdbserver on the caanoo and debug from your host machine. again, you need some connection to the caanoo (may it be usbserial or usbnet) and you need gdbserver for arm-eabi. then you can launch the app using gdbserver on the caanoo and connect with codeblocks to the app (somewhat). i've tried that only once, but it was quite cumbersome to get everything running and debugging was way too slow for my taste. so i sticked on method 1.
 
WalterCool said:
Idk why this code http://www.lazyfoo.net/SDL_tutorials/lesson17/index.php is not working D:

2 seconds of looking at the code:

Code:
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;

you need to change that to 320, 240, 16. thats why you probably dont see anything. taking code from the web, compile and run will not work in 99.99% of the cases. even, a simple "hello world" will likely only show you a blackscreen on the caanoo ... :)
 
Last edited by a moderator:
crow_riot said:
1) gdb directly. you need to have some terminal connection for this, otherwise it's not useful. first you need to get gdb (http://www.gnu.org/software/gdb/) for arm-eabi (probably need to compile your own, if so, upload it to the archive :) ). this is what i do mostly on the wiz, it's easy and gives you enough hints where to look :)

2) gdbserver on the caanoo and debug from your host machine. again, you need some connection to the caanoo (may it be usbserial or usbnet) and you need gdbserver for arm-eabi. then you can launch the app using gdbserver on the caanoo and connect with codeblocks to the app (somewhat). i've tried that only once, but it was quite cumbersome to get everything running and debugging was way too slow for my taste. so i sticked on method 1.

3) I use usbnet and a lot of cout :) I still haven't gotten a debugger running (well, i haven't really looked into it yet)

Let us know how it goes if you get a debugger running.
 
Last edited by a moderator:
With GDB i just get a "/opt/caanoo/bin/arm-gph-linux-gnueabi-gdb: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory" D:
 
I have had the same problem as the thread-starter, because I repacked the SDK into a .zip. After I used the original container-format I had no problems installing it on my linux-netbook.
 
WalterCool said:
With GDB i just get a "/opt/caanoo/bin/arm-gph-linux-gnueabi-gdb: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory" D:
I had this problem as well (with the Wiz SDK). It seems that libtinfo typically does not exist any more on recent Linux distros, since it was merged into libncurses. I ended up compiling
arm-linux-gdb myself. The only other option is to find (or build) a package/version of ncurses that still has the separate libs and then write a wrapper script around to start gdb with
said libs in LD_LIBRARY_PATH. Or you could try to find another pre-built arm-gdb package...
 
Last edited by a moderator:
hmn said:
WalterCool said:
With GDB i just get a "/opt/caanoo/bin/arm-gph-linux-gnueabi-gdb: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory" D:
I had this problem as well (with the Wiz SDK). It seems that libtinfo typically does not exist any more on recent Linux distros, since it was merged into libncurses. I ended up compiling
arm-linux-gdb myself. The only other option is to find (or build) a package/version of ncurses that still has the separate libs and then write a wrapper script around to start gdb with
said libs in LD_LIBRARY_PATH. Or you could try to find another pre-built arm-gdb package...

Seems like gdb was compiled with gdb-tui, a Ncurses version of gdb..., just doing a link of libtermcap.so or libncurses.so to libtinfo.so.5 works

Anyways, i cant make an app works... thats happens:

GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i386-build_redhat-linux-gnu --target=arm-gph-linux-gnueabi"...
(gdb) run
Starting program: /home/waltercool/Code/cpp/sdl/a.out
Don't know how to run. Try "help target".
(gdb)

:/ idk what can be wrong...

PD: Thats the "example" code :/ http://pastebin.com/rryqnZKE
 
Last edited by a moderator:
um, are you trying to debug on your host? that's not going to work. you need to copy your "a.out" to caanoo and start it there.
 
you could also try ethernet gadget. or like everybody else without working wifi and nonworking gadget, work with logfiles to find the point where you app crashes (i created audiorace with that method).

*edit*
to answer your question: you cant seriously debug without having a connection to the caanoo from your pc may it serial gadget, ethernet gadget, or wifi.
 
Last edited by a moderator:
Back
Top