Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-08

fpc on Armel issues

24 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Nataraj S Narayan

Hi

At revision 13589.

Got a full build of FPC with :-

/usr/local/lib/fpc/2.5.1/ppcrossarm -MObjFPC -TLinux -Parmv5 -gl -Xd -Xs -l -XP/armbin/arm-none-linux-gnueabi- -CfSOFT -CaEABI -darm -gl -O- -CpARMV5 ./$1 -uUSE_LOCALIZE
-Fu/usr/local/lib/fpc/2.5.1/units/arm-linux/ -Fl/software/arm-lib

/software/fpc]# ls -l /usr/local/lib/fpc/2.5.1/ppcrossarm -rwxr-xr-x 1 root wheel 9491748 Aug 25 14:20
/usr/local/lib/fpc/2.5.1/ppcrossarm.

Tried compiling examples in fpc/packages/ncurses/examples using :-

gmake examples OS_TARGET=linux CPU_TARGET=arm OPT="-gl -Fl/software/arm-lib -Xr/usr/lib -FL/software/arm-lib/ld-linux.so.3 -XLAc=c,dl,g -Fu/usr/local/lib/fpc/2.5.1/units/arm-linux/ -Xd -XP/armbin/arm-none-linux-gnueabi- -dFPC_ARMEL -CfSOFT -CaEABI -darm -gl -O- -CpARMV5 " FPC=/usr/local/lib/fpc/2.5.1/ppcrossarm

after copying the arm-linux libs to /software/arm-lib.

the resulting binaries (firework etc) are not executing on the arm-linux board as well as qemu.

sh firework
firework: firework: 1: Syntax error: word unexpected (expecting ")")

$file firework
firework: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

while another non-fpc app shows:-

file formshow
formshow: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs), not stripped

could it be that I am building on FreeBSD is a probelms?

regards

Nataraj

Jonas Maebe
to Nataraj S Narayan
Nataraj S Narayan wrote 5 lines
the resulting binaries (firework etc) are not executing on the arm-linux board as well as qemu. sh firework firework: firework: 1: Syntax error: word unexpected (expecting ")")

You are trying to execute the program as a shell script. It's normal that this doesn't work. Try "./firework" instead.

Jonas

Nataraj S Narayan
to Jonas Maebe

Hi Jonas

Tried all the tricks.

chmod +x firework

sh firework
firework: firework: 1: Syntax error: word unexpect

./firework
-sh: ./firework: not found
ed (expecting ")")

regards

Jonas Maebe wrote 18 lines
On 25 Aug 2009, at 13:35, Nataraj S Narayan wrote: > the resulting binaries (firework etc) are not executing on the > arm-linux board as well as qemu. > > sh firework > firework: firework: 1: Syntax error: word unexpected (expecting ")") You are trying to execute the program as a shell script. It's normal that this doesn't work. Try "./firework" instead. Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Marco van de Voort
to Nataraj S Narayan: Hi At revision 13589. Got a full build of FPC with :- /usr/local/lib/fpc/2.5.1/ppcrossarm…

In our previous episode, Nataraj S Narayan said:

Show quoted text 9 lines
dynamically linked (uses shared libs), not stripped while another non-fpc app shows:- file formshow formshow: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs), not stripped could it be that I am building on FreeBSD is a probelms?

Yes and no. Crosslinking sometimes doesn't add an ELF identifier. Linux didn't use to need one, but apparantly this one does.

So best is to try to find out how to add a elf ident section under Linux.

Or try to "brandelf -T linux" the result under FreeBSD and hope for the best :-)

Jonas Maebe
to Nataraj S Narayan: Hi Jonas Tried all the tricks. chmod +x firework sh firework firework: firework: 1:…
Nataraj S Narayan wrote 6 lines
Tried all the tricks. chmod +x firework sh firework firework: firework: 1: Syntax error: word unexpect

That is normal, because as mentioned before firework is not a shell script. The above command tells sh to try to read the compiled program as a shell script. That can never work.

./firework -sh: ./firework: not found ed (expecting ")")

Which version of binutils are you using for cross-compiling and how were they compiled?

Can you also show the output of "readelf -h" for both an FPC-compiled binary and another one?

Jonas

Nataraj S Narayan
to Jonas Maebe

Hi

Fpc compiled binary:-
readelf -h firework
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32
Data: 2's complement, little endian Version: 1 (current)
OS/ABI: UNIX - System V ABI Version: 0
Type: EXEC (Executable file) Machine: ARM
Version: 0x1
Entry point address: 0x8f1c
Start of program headers: 52 (bytes into file) Start of section headers: 257344 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 34
Section header string table index: 31

Other Binary:-
readelf -h formshow
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32
Data: 2's complement, little endian Version: 1 (current)
OS/ABI: UNIX - System V ABI Version: 0
Type: EXEC (Executable file) Machine: ARM
Version: 0x1
Entry point address: 0xab64
Start of program headers: 52 (bytes into file) Start of section headers: 21324 (bytes into file) Flags: 0x4000002, has entry point, Version4 EABI Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 37
Section header string table index: 34

Could it be that arm-linux is not ready for Version5 EABI?

regards

Nataraj

Jonas Maebe wrote 30 lines
On 25 Aug 2009, at 13:44, Nataraj S Narayan wrote: > Tried all the tricks. > > chmod +x firework > > sh firework > firework: firework: 1: Syntax error: word unexpect That is normal, because as mentioned before firework is not a shell script. The above command tells sh to try to read the compiled program as a shell script. That can never work. > ./firework > -sh: ./firework: not found > ed (expecting ")") Which version of binutils are you using for cross-compiling and how were they compiled? Can you also show the output of "readelf -h" for both an FPC-compiled binary and another one? Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Florian Klaempfl
to Nataraj S Narayan
Show quoted text 49 lines
Hi Fpc compiled binary:- readelf -h firework ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x8f1c Start of program headers: 52 (bytes into file) Start of section headers: 257344 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 6 Size of section headers: 40 (bytes) Number of section headers: 34 Section header string table index: 31 Other Binary:- readelf -h formshow ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0xab64 Start of program headers: 52 (bytes into file) Start of section headers: 21324 (bytes into file) Flags: 0x4000002, has entry point, Version4 EABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 8 Size of section headers: 40 (bytes) Number of section headers: 37 Section header string table index: 34 Could it be that arm-linux is not ready for Version5 EABI?

Possible, but the eabi version is written by the binutils you used.

Jonas Maebe
to Nataraj S Narayan: Hi Fpc compiled binary:- readelf -h firework ELF Header: Magic: 7f 45 4c 46 01 01 01 00…
Nataraj S Narayan wrote 13 lines
Fpc compiled binary:- readelf -h firework ELF Header: Flags: 0x5000002, has entry point, Version5 EABI Other Binary:- readelf -h formshow ELF Header: Flags: 0x4000002, has entry point, Version4 EABI Could it be that arm-linux is not ready for Version5 EABI?

You arm-linux system is indeed apparently EABI version 4, while you generated an EABI version 5 binary. The default version is determined by the assembler that you use. It's possible to pass an option to the assembler to generate EABI version 4 object files (-meabi=4), but FPC does not have provisions to let you pass options to the assembler.

What you can however do is replace your assembler with a shell script that contains basically

#!/bin/sh
/path/to/original/as -meabi=4 $@

Even better would be to upgrade your Linux system to one based on version 5 of the EABI, because version 4 was only a prerelease and only meant for testing use.

Jonas

Nataraj S Narayan
to Florian Klaempfl: Possible, but the eabi version is written by the binutils you used.

Hi

using arm-2009q1/arm-none-linux-gnueabi/bin/. from Codesourcery.

Should i try out older version, maybe 2008?

Are you prsently logged onto Freenode?

regards

Nataraj

Florian Klaempfl wrote 56 lines
Nataraj S Narayan schrieb: > Hi > > Fpc compiled binary:- > readelf -h firework > ELF Header: > Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 > Class: ELF32 > Data: 2's complement, little endian > Version: 1 (current) > OS/ABI: UNIX - System V > ABI Version: 0 > Type: EXEC (Executable file) > Machine: ARM > Version: 0x1 > Entry point address: 0x8f1c > Start of program headers: 52 (bytes into file) > Start of section headers: 257344 (bytes into file) > Flags: 0x5000002, has entry point, Version5 EABI > Size of this header: 52 (bytes) > Size of program headers: 32 (bytes) > Number of program headers: 6 > Size of section headers: 40 (bytes) > Number of section headers: 34 > Section header string table index: 31 > > Other Binary:- > readelf -h formshow > ELF Header: > Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 > Class: ELF32 > Data: 2's complement, little endian > Version: 1 (current) > OS/ABI: UNIX - System V > ABI Version: 0 > Type: EXEC (Executable file) > Machine: ARM > Version: 0x1 > Entry point address: 0xab64 > Start of program headers: 52 (bytes into file) > Start of section headers: 21324 (bytes into file) > Flags: 0x4000002, has entry point, Version4 EABI > Size of this header: 52 (bytes) > Size of program headers: 32 (bytes) > Number of program headers: 8 > Size of section headers: 40 (bytes) > Number of section headers: 37 > Section header string table index: 34 > > Could it be that arm-linux is not ready for Version5 EABI? Possible, but the eabi version is written by the binutils you used. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Henry Vermaak
to Nataraj S Narayan

2009/8/25 Nataraj S Narayan :

Hi using  arm-2009q1/arm-none-linux-gnueabi/bin/. from Codesourcery.

Why don't you use the toolchain with which your system was compiled in the first place?

Henry

Nataraj S Narayan
to Henry Vermaak

Hi Henry

You mean both fpc and app ?

I compile kernel with codesourcery. But the Distro is Angstrom which has its own arm-angstrom-linux-gnueabi-*

regards

Nataraj

Henry Vermaak wrote 13 lines
2009/8/25 Nataraj S Narayan : > Hi > > using arm-2009q1/arm-none-linux-gnueabi/bin/. from Codesourcery. Why don't you use the toolchain with which your system was compiled in the first place? Henry _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Henry Vermaak
to Nataraj S Narayan

2009/8/25 Nataraj S Narayan :

Hi Henry You mean both fpc and app ?

No, I mean everything.

I compile kernel with codesourcery. But the Distro is Angstrom which has its own arm-angstrom-linux-gnueabi-*

Is there a reason why you don't use the distro toolchain for everything?

Henry

Nataraj S Narayan
to Henry Vermaak

Hi Henry

Not any particular reason for that. Company policy was to get rid of Angtrom and go for Debian.

Well seems debian-armel is also EABI 4. Would you suggest me a RFS with EABI 5?

regards

Nataraj

Henry Vermaak wrote 18 lines
2009/8/25 Nataraj S Narayan : > Hi Henry > > You mean both fpc and app ? No, I mean everything. > > I compile kernel with codesourcery. But the Distro is Angstrom which has > its own arm-angstrom-linux-gnueabi-* Is there a reason why you don't use the distro toolchain for everything? Henry _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Henry Vermaak
to Nataraj S Narayan

2009/8/25 Nataraj S Narayan :

Show quoted text 6 lines
Hi Henry Not any particular reason for that. Company policy was to get rid of Angtrom and go for Debian. Well seems debian-armel is also EABI 4. Would you suggest me a RFS with EABI 5?

I'm just saying that you won't have these problems if you stick to the same toolchain. There may still be issues with the fpc armel port, but that's a different matter.

Henry

Nataraj S Narayan
to Henry Vermaak

Hi

My problem still persists.

Here are the details of 2 binaries - first compiled using fpc-arm and second qt4 for arm. The second one is working,

1.

debian-armel:~# readelf -h firework
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32
Data: 2's complement, little endian Version: 1 (current)
OS/ABI: UNIX - System V ABI Version: 0
Type: EXEC (Executable file) Machine: ARM
Version: 0x1
Entry point address: 0x8f1c
Start of program headers: 52 (bytes into file) Start of section headers: 260800 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 34
Section header string table index: 31

2.

debian-armel:~# readelf -h framebuffer
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32
Data: 2's complement, little endian Version: 1 (current)
OS/ABI: UNIX - System V ABI Version: 0
Type: EXEC (Executable file) Machine: ARM
Version: 0x1
Entry point address: 0x8874
Start of program headers: 52 (bytes into file) Start of section headers: 10272 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 27
Section header string table index: 26

Class: ELF32
Data: 2's complement, little endian Version: 1 (current)
OS/ABI: UNIX - System V ABI Version: 0
Type: EXEC (Executable file) Machine: ARM
Version: 0x1
Entry point address: 0x8f1c
Start of program headers: 52 (bytes into file) Start of section headers: 260800 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 34
Section header string table index: 31

2.

debian-armel:~#ldd firework
/usr/bin/ldd: line 116: ./firework: No such file or directory

debian-armel:~# ldd framebuffer
libdl.so.2 => /lib/libdl.so.2 (0x4002d000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40038000) libm.so.6 => /lib/libm.so.6 (0x40113000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x401c0000)
libc.so.6 => /lib/libc.so.6 (0x401d4000)
/lib/ld-linux.so.3 (0x40000000)

Henry Vermaak wrote 17 lines
2009/8/25 Nataraj S Narayan : > Hi Henry > > Not any particular reason for that. Company policy was to get rid of > Angtrom and go for Debian. > > Well seems debian-armel is also EABI 4. Would you suggest me a RFS with EABI 5? I'm just saying that you won't have these problems if you stick to the same toolchain. There may still be issues with the fpc armel port, but that's a different matter. Henry _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jonas Maebe
to Nataraj S Narayan
Nataraj S Narayan wrote
Here are the details of 2 binaries - first compiled using fpc-arm and second qt4 for arm. The second one is working,

Are both assembled/linked now with the same toolchain?

Jonas

Nataraj S Narayan
to Jonas Maebe

Yes

Using Codesourcery :- arm-none-lnux-gnueab-

regards

Nataraj

Jonas Maebe wrote 14 lines
On 28 Aug 2009, at 07:19, Nataraj S Narayan wrote: > Here are the details of 2 binaries - first compiled using fpc-arm and > second qt4 for arm. The second one is working, Are both assembled/linked now with the same toolchain? Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jonas Maebe
to Nataraj S Narayan
Nataraj S Narayan wrote 13 lines
On Fri, Aug 28, 2009 at 1:47 PM, Jonas Maebe wrote: > > On 28 Aug 2009, at 07:19, Nataraj S Narayan wrote: > >> Here are the details of 2 binaries - first compiled using fpc-arm >> and >> second qt4 for arm. The second one is working, > > Are both assembled/linked now with the same toolchain? Yes Using Codesourcery :- arm-none-lnux-gnueab-

If you run

strings fireworks|grep "ld\.so"

what does it print? (for both versions)

Jonas

Nataraj S Narayan
to Jonas Maebe

HI

# strings firework |grep ld
/software/arm-lib/ld-linux.so.3

#strings framebuffer |grep ld
/lib/ld-linux.so.3

I have put the contents of # strings firework in pastebin http://pastebin.com/m10d2cc6f

Some of the contents are :-

6This binary has no unicodestrings support compiled in. SRecompile the application with a unicodestrings-manager in the program uses clause.
Runtime error

Jonas Maebe wrote 30 lines
On 28 Aug 2009, at 10:29, Nataraj S Narayan wrote: > On Fri, Aug 28, 2009 at 1:47 PM, Jonas Maebe > wrote: >> >> On 28 Aug 2009, at 07:19, Nataraj S Narayan wrote: >> >>> Here are the details of 2 binaries - first compiled using fpc-arm and >>> second qt4 for arm. The second one is working, >> >> Are both assembled/linked now with the same toolchain? > > Yes > > Using Codesourcery :- arm-none-lnux-gnueab- If you run strings fireworks|grep "ld\.so" what does it print? (for both versions) Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jonas Maebe
to Nataraj S Narayan
Nataraj S Narayan wrote
# strings firework |grep ld /software/arm-lib/ld-linux.so.3

That's probably the problem. This means that to start the program, the kernel will look for /software/arm-lib/ld-linux.so.3 on your ARM system, and it obviously won't find it. That's where the "No such file or directory" error comes from. As a temporary hack, you could try to create the "/software/arm-lib" directory on your ARM system and a put a symlink there to /lib/ld-linux.so.3

Please compile the program with -Cn and post the contents of the generated ppas.sh file. Please also mention with FPC revision you are using to compile the program.

Jonas

Nataraj S Narayan
to Jonas Maebe

Hi Jonas

That was it! Now its working fine. Where did i miss while compiling?

regards & thanks

Nataraj

Jonas Maebe wrote 23 lines
On 28 Aug 2009, at 11:17, Nataraj S Narayan wrote: > # strings firework |grep ld > /software/arm-lib/ld-linux.so.3 That's probably the problem. This means that to start the program, the kernel will look for /software/arm-lib/ld-linux.so.3 on your ARM system, and it obviously won't find it. That's where the "No such file or directory" error comes from. As a temporary hack, you could try to create the "/software/arm-lib" directory on your ARM system and a put a symlink there to /lib/ld-linux.so.3 Please compile the program with -Cn and post the contents of the generated ppas.sh file. Please also mention with FPC revision you are using to compile the program. Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jonas Maebe
to Nataraj S Narayan: Hi Jonas That was it! Now its working fine. Where did i miss while compiling? regards &…
Nataraj S Narayan wrote 27 lines
On Fri, Aug 28, 2009 at 3:06 PM, Jonas Maebe wrote: > > On 28 Aug 2009, at 11:17, Nataraj S Narayan wrote: > >> # strings firework |grep ld >> /software/arm-lib/ld-linux.so.3 > > That's probably the problem. This means that to start the program, > the > kernel will look for /software/arm-lib/ld-linux.so.3 on your ARM > system, and > it obviously won't find it. That's where the "No such file or > directory" > error comes from. As a temporary hack, you could try to create the > "/software/arm-lib" directory on your ARM system and a put a > symlink there > to /lib/ld-linux.so.3 > > Please compile the program with -Cn and post the contents of the > generated > ppas.sh file. Please also mention with FPC revision you are using > to compile > the program. > That was it! Now its working fine. Where did i miss while compiling?

Nothing, it looks like a bug in the compiler. That's why I asked for the above information. Please post it.

Jonas

Nataraj S Narayan
to Jonas Maebe

Yikes!

Gtk2 apps are working on Arm-linux SBC.

Now I need to get qt-embededed to work with fpc and then lazarus.

Kudos for the team!

regards

Nataraj

Jonas Maebe wrote 38 lines
On 28 Aug 2009, at 11:40, Nataraj S Narayan wrote: > On Fri, Aug 28, 2009 at 3:06 PM, Jonas Maebe > wrote: >> >> On 28 Aug 2009, at 11:17, Nataraj S Narayan wrote: >> >>> # strings firework |grep ld >>> /software/arm-lib/ld-linux.so.3 >> >> That's probably the problem. This means that to start the program, the >> kernel will look for /software/arm-lib/ld-linux.so.3 on your ARM system, >> and >> it obviously won't find it. That's where the "No such file or directory" >> error comes from. As a temporary hack, you could try to create the >> "/software/arm-lib" directory on your ARM system and a put a symlink >> there >> to /lib/ld-linux.so.3 >> >> Please compile the program with -Cn and post the contents of the >> generated >> ppas.sh file. Please also mention with FPC revision you are using to >> compile >> the program. >> > > That was it! Now its working fine. Where did i miss while compiling? Nothing, it looks like a bug in the compiler. That's why I asked for the above information. Please post it. Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal