Exec format error

Do I have to compile a program differently when adding it the the
downloaded image? I wrote a simple test program and added it to the
image (I’m using the GUI).

When I try to run the program I get the message:

Exec format error

I’m using QNX 6.3 and running it on a MPC8245 system.

Jay Greig wrote:

Hey John,

One thing I can think of is that the binary wasn’t compiled for PPC.

-Jay.

That was my first guess too, but I checked and its set to PPC (release)
using GCC 2.95.3. Here is the output from the C-Build window:

make -k CPULIST=ppc EXCLUDE_VARIANTLIST=g/ VARIANTLIST=be/ clean all
make -j 1 -Cppc -fMakefile clean
make[1]: Entering directory C:/QNX630/workspace/test_prog/ppc' make -j 1 -Co-be -fMakefile clean make[2]: Entering directory C:/QNX630/workspace/test_prog/ppc/o-be’
C:/QNX630/host/win32/x86/usr/bin/rm -f test_prog *.pinfo *.o *.err
*.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/test_prog/ppc/o-be' make[1]: Leaving directory C:/QNX630/workspace/test_prog/ppc’
make -j 1 -Cppc -fMakefile all
make[1]: Entering directory C:/QNX630/workspace/test_prog/ppc' make -j 1 -Co-be -fMakefile all make[2]: Entering directory C:/QNX630/workspace/test_prog/ppc/o-be’
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntoppc -c -O
-Wc,-mno-fp-moves -Wc,-Wall -Wc,-Wno-parentheses -DNDEBUG
-I. -IC:/QNX630/workspace/test_prog/ppc/o-be
-IC:/QNX630/workspace/test_prog/ppc -IC:/QNX630/workspace/test_prog
-IC:/QNX630/target/qnx6/usr/include -EB -DVARIANT_be
C:/QNX630/workspace/test_prog/test_prog.c
C:/QNX630/host/win32/x86/usr/bin/rm -f
C:/QNX630/workspace/test_prog/ppc/o-be/test_prog
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntoppc -Wl,–no-keep-memory
-oC:/QNX630/workspace/test_prog/ppc/o-be/test_prog test_prog.o
-L. -LC:/QNX630/target/qnx6/ppcbe/lib
-LC:/QNX630/target/qnx6/ppcbe/usr/lib -EB
make[2]: Leaving directory C:/QNX630/workspace/test_prog/ppc/o-be' make[1]: Leaving directory C:/QNX630/workspace/test_prog/ppc’

Hey John,

One thing I can think of is that the binary wasn’t compiled for PPC.

-Jay.

John Kiernan wrote:

Do I have to compile a program differently when adding it the the
downloaded image? I wrote a simple test program and added it to the
image (I’m using the GUI).

When I try to run the program I get the message:

Exec format error

I’m using QNX 6.3 and running it on a MPC8245 system.

John Kiernan wrote:

Do I have to compile a program differently when adding it the the
downloaded image? I wrote a simple test program and added it to the
image (I’m using the GUI).

When I try to run the program I get the message:

Exec format error

I’m using QNX 6.3 and running it on a MPC8245 system.

Okay, something is really weird here. I added another binary to the
image just to test (echo)…

echo crashes with a SIGILL, however, the test program now works?!

So I added another binary (which)…

which crashes with SIGILL, however, the test program and echo now work?!

I added another binary (vi) …

vi crashes with SIGILL, … test program, echo, and which all work!

Always the last program in the image doesn’t run properly in some way or
another.
vi is the last program in the image see attached ‘System Builder Console’.

That is interesting. I’ve never seen that before. Could it be that the
tail of your image is getting corrupt on the way over? Can you put
‘cksum’ in your image (and hopefully have it not be at the tail!) and
verify that your binaries make it over safely? (You will have to put a
[+raw] before each binary in your .bsh file (so that mkifs doesn’t strip
them).

John Kiernan wrote:

John Kiernan wrote:

Do I have to compile a program differently when adding it the the
downloaded image? I wrote a simple test program and added it to the
image (I’m using the GUI).

When I try to run the program I get the message:

Exec format error

I’m using QNX 6.3 and running it on a MPC8245 system.


Okay, something is really weird here. I added another binary to the
image just to test (echo)…

echo crashes with a SIGILL, however, the test program now works?!

So I added another binary (which)…

which crashes with SIGILL, however, the test program and echo now work?!

I added another binary (vi) …

vi crashes with SIGILL, … test program, echo, and which all work!

Always the last program in the image doesn’t run properly in some way or
another.
vi is the last program in the image see attached ‘System Builder Console’.




\

Building Image: bsp-qnx-rtmio
Offset Size Entry Ramoff Target=Host
1f0000 100 ---- — Startup-header
1f0100 d008 1f1c50 — .\s32o.3
1fd108 5c ---- — Image-header
1fd164 4a8 ---- — Image-directory
---- — ---- — tmp=/dev/shmem
---- — ---- — dev/console=/dev/ser1
---- — ---- — bin/sh=/proc/boot/esh
1fd60c 1a4 ---- — proc/boot/.script=.\s32o.2
1fe000 5d000 220964 — proc/boot/procnto-600=.\s32o.4
25b000 73000 3a724 — proc/boot/libc.so.2=C:\QNX630\target\qnx6\ppcbe\lib\libc.so
---- — ---- — proc/boot/libc.so=libc.so.2
2ce000 afac 480414c8 — proc/boot/devc-ser8250=C:/QNX630/workspace/qnx-rtmio_devc-ser8250/ser8250/ppc/be/devc-ser8250
2d9000 51cf 48040b7c — proc/boot/ls=C:\QNX630\target\qnx6\ppcbe\bin\ls
2df000 4431 48040e90 — proc/boot/esh=C:\QNX630\target\qnx6\ppcbe\bin\esh
2e4000 4d84 480410f0 — proc/boot/pipe=C:\QNX630\target\qnx6\ppcbe\sbin\pipe
2e9000 e6fd 48040f4c — proc/boot/pidin=C:\QNX630\target\qnx6\ppcbe\bin\pidin
2f8000 1f5e 4804050c — proc/boot/uname=C:\QNX630\target\qnx6\ppcbe\bin\uname
2fa000 34fa 48040bb0 — proc/boot/slogger=C:\QNX630\target\qnx6\ppcbe\usr\sbin\slogger
2fe000 2800 48040918 — proc/boot/sloginfo=C:\QNX630\target\qnx6\ppcbe\bin\sloginfo
301000 3aaa 48040b34 — proc/boot/slay=C:\QNX630\target\qnx6\ppcbe\bin\slay
305000 5f7d 48040aec — proc/boot/ps=C:\QNX630\target\qnx6\ppcbe\bin\ps
30b000 2131 48040554 — proc/boot/cat=C:\QNX630\target\qnx6\ppcbe\bin\cat
30e000 1914 480404d8 — usr/bin/blink_ledtest=C:/QNX630/workspace/blink_ledtest/ppc/o-be/blink_ledtest
310000 1668 480403bc — usr/bin/test_prog=C:/QNX630/workspace/test_prog/ppc/o-be/test_prog
312000 1f3e 48040478 — proc/boot/echo=C:/QNX630/target/qnx6/ppcbe/bin/echo
314000 2918 480408ac — proc/boot/which=C:/QNX630/target/qnx6/ppcbe/usr/bin/which
317000 23243 48040ed4 — proc/boot/vi=C:/QNX630/target/qnx6/ppcbe/bin/vi
33a244 4 ---- — Image-trailer
Build Complete.

Jay Greig wrote:

That is interesting. I’ve never seen that before. Could it be that the
tail of your image is getting corrupt on the way over? Can you put
‘cksum’ in your image (and hopefully have it not be at the tail!) and
verify that your binaries make it over safely? (You will have to put a
[+raw] before each binary in your .bsh file (so that mkifs doesn’t strip
them).

Hmm, I added ‘chksum’ and ‘less’ (I didn’t want chksum to be last > :wink: > )

I’m using the IDE, so I set the properties (in the project.bld) to not
strip the files for both ‘less’ and ‘which’.

On Windows:

C:\QNX630\target\qnx6\ppcbe\usr\bin>cksum which
2676093045 7536 which

C:\QNX630\target\qnx6\ppcbe\usr\bin>cksum less
4051530548 138100 less


On QNX:

cksum which

1266420219 7536 which

Process 36870 (cksum) exited status=0.

cksum less

3603936577 138100 less

Process 40966 (cksum) exited status=0.

The checksums are different on both, but the file sizes are correct…

‘which’ ended up to be the last binary in the image and as expected does
not work, and less does work (at least it runs):

less

WARNING: terminal is not fully functional
Missing filename (“less -?” for help)

Process 53254 (less) exited status=0.

which

Exec format error



Should the checksums match? I noticed in the properties page for the
binaries (in project.bld), they say:
“Code Segment” = “Use In Place”, and
“Data Segment” = “Copy”
Would these parameters have an effect on the checksum?



John Kiernan wrote:

John Kiernan wrote:

Do I have to compile a program differently when adding it the the
downloaded image? I wrote a simple test program and added it to the
image (I’m using the GUI).

When I try to run the program I get the message:

Exec format error

I’m using QNX 6.3 and running it on a MPC8245 system.



Okay, something is really weird here. I added another binary to the
image just to test (echo)…

echo crashes with a SIGILL, however, the test program now works?!

So I added another binary (which)…

which crashes with SIGILL, however, the test program and echo now
work?!

I added another binary (vi) …

vi crashes with SIGILL, … test program, echo, and which all work!

Always the last program in the image doesn’t run properly in some way
or another.
vi is the last program in the image see attached ‘System Builder
Console’.