Re: compile and run 32bit programs on aarch64eb

Christian Groessler <[email protected]> Tue, 25 Nov 2025 22:17:54 +0100
Newsgroups gmane.os.netbsd.ports.arm
Message-ID <[email protected]>
On 11/24/25 11:49 AM, Michael van Elst wrote:
> [email protected] (Christian Groessler) writes:
> 
>> Is there a way to tell the system to load 32bit binaries from somewhere
>> else? I remember in former times one could setup a tree under /usr/emul
>> (or so) for example to run iBCS2 or Solaris programs.
> 
> The 32bit compat code looks for files with /emul/netbsd32 prefixed.
> 
> E.g.:
> 
> arnold% uname -mp
> evbarm aarch64
> 
> arnold% find /emul/netbsd32/ -ls
>    42937      2 drwxr-xr-x    4 root              wheel                   512 Nov 24 11:45 /emul/netbsd32/
>    42938      2 drwxr-xr-x    2 root              wheel                   512 Nov 24 11:44 /emul/netbsd32/libexec
>    42939    172 -rwxr-xr-x    1 root              wheel                 87240 Nov 24 11:44 /emul/netbsd32/libexec/ld.elf_so
>    42940      2 drwxr-xr-x    2 root              wheel                   512 Nov 24 11:46 /emul/netbsd32/lib
>    42941   4160 -rw-r--r--    1 root              wheel               2116080 Nov 24 11:46 /emul/netbsd32/lib/libc.so.12
> 
> arnoldl% file ./hostname32
>   file ./hostname32
> ./hostname32: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /libexec/ld.elf_so, for NetBSD 10.1, compiled for: earmv6hf, not stripped
> 
> arnold% ./hostname32
> arnold
> 
> 
> An alternative is to just set up a 32bit chroot.
> 


It works for me now, thanks! I don't want to use chroot.


compat_netbsd32(8), which I've read before reading your mail Michael, 
could be improved a bit.

I couldn't make much sense out of

      Since NetBSD 5.0 the base system has directly included support for 
32-bit
      compatibility by installing 32-bit libraries and dynamic linker into
      /usr.  This includes compiler support for compiling 32-bit 
applications
      on platforms where this is supported.


Where under /usr would I put the 32bit dynamic libraries?

Also this sentence

      Before NetBSD 5.0 all of these files needed to be placed under
      /emul/netbsd32.

irritated me.

After NetBSD 5.0 (means: _now_) I've needed to place them under 
/emul/netbsd32 (specifically I've copied 32bit versions of /lib /libexec 
/usr/lib /usr/libexec there). If they can live elsewhere under /usr it's 
not obvious to me where, and I didn't want to drop them into the host's 
64bit /lib /libexec /usr/lib /usr/libexec directories, fearing that I'd 
mess up my system.

regards,
chris