Subject: Re: compat_netbsd32 problems
To: None <port-sparc64@NetBSD.ORG>
From: None <sigsegv@rambler.ru>
List: port-sparc64
Date: 01/09/2005 12:46:07
Greg Earle wrote:
> On Jan 8, 2005, at 9:51 PM, sigsegv@rambler.ru wrote:
>
>> Greetings, I'm struggling to get 32-bit binaries working with 64-bit
>> netbsd-2.0 kernel. I unpacked 32-bit base.tgz set and copied lib,
>> libexec into /emul/netbsd32, usr/lib usr/libexec into /emul/netbsd32/usr
>>
>> From base.tgz 32-bit binaries under bin work fine, but almost any
>> binary under usr/bin gives:
>>
>> Syntax error: "(" unexpected
>>
>> Am I missing something?
>
>
> They are not being recognized as binary executables - the
> system thinks they are shell scripts.
>
> I would say to use "ldd" and "ktrace" to see what's happening,
> but you do not say whether you are talking about binaries in
> /usr/bin or /emul/netbsd32/usr/bin. If the latter, then
> use "/usr/bin/ldd" and "/usr/bin/ktrace" to see what the
> system thinks those binaries are (ldd), and where it goes to
> look for things (shared libraries, etc.) when it runs (ktrace).
>
> - Greg
>
>
Well just to make sure I wasn't missing any shared libs, i copied the
entire distribution for sparc into /usr/pkg/emul/netbsd32 and set up
/emul to be a symlink to /usr/pkg/emul
Still, I hit the same problem, binaries under /emul/netbsd32/bin execute
OK, but the ones under /emul/netbsd32/usr/bin don't. Below are the
traces for two sample executables (both are 32-bit dynamically linked
sparc executables), seems to be that for one executable the OS knows how
to use 32-bit emulation, but for the other one it doesn't. I don't
really know what's going on the kernel level, so any help/suggestions
would be much appreciated :-)
This is what I get from executing /emul/netbsd32/bin/date:
Sun Jan 9 12:19:58 UTC 2005
360 ktruss emul(netbsd)
360 ktruss fktrace = 0
360 date emul(netbsd32)
360 date netbsd32_execve("/emul/netbsd32/bin/date",
0xffffffffffffd9e0, 0xffffffffffffd9f0) JUSTRETURN
360 date netbsd32_mmap(0, 0x8000, 0x3, 0x1002, 0, 0, 0, 0) =
0x40026000
360 date netbsd32_open("/emul/netbsd32/etc/ld.so.conf", 0, 0) = 3
360 date netbsd32___fstat13(0x3, 0xffffd930) = 0, 4294957360
360 date netbsd32_mmap(0, 0x58, 0x1, 0x1, 0, 0, 0, 0) = 0x40050000
360 date netbsd32_close(0x3)
...
360 date netbsd32_close(0x3) = 0, 8589914480
360 date netbsd32___fstat13(0x1, 0xffffd320) = 0, 4294955808
360 date netbsd32_break(0x2a000) = 0
360 date netbsd32_write(0x1, 0x28000, 0x1d) = 29, 163840
"Sun Jan 9 12:19:58 UTC 2005\n"
360 date netbsd32_exit(0)
This is what I get from executing /emul/netbsd32/usr/bin/id:
754 ktruss emul(netbsd)
754 ktruss fktrace = 0
754 ktruss execve("/emul/netbsd32/usr/bin/id", 0xffffffffffffd9e0,
0xffffffffffffd9f0) Err#8 ENOEXEC
754 sh emul(netbsd)
754 sh execve("/bin/sh", 0xffffffffffffd3a0,
0xffffffffffffd9f0) JUSTRETURN
754 sh mmap(0, 0x8000, 0x3, 0x1002, 0xffffffffffffffff, 0, 0)
= 0x40222000
754 sh open("/etc/ld.so.conf", 0, 0x7f7f7f7f7f7f7f7f) Err#2 ENOENT
754 sh open("/lib/libedit.so.2", 0, 0x7f7f7f7f7f7f7f7f) = 3
...
754 sh break(0x22c000) = 0, 1171456
754 sh write(0x2, 0x22a000, 0x1e) = 30, 2269184
"/emul/netbsd32/usr/bin/id: 1: "
754 sh write(0x2, 0x22a000, 0x1d) = 29, 2269184
"Syntax error: "(" unexpected\n"
754 sh exit(0x2)