Multiarch working
2005-02-02
2 minutes read

After about a week of gcc compiles, I have multiarch working now. Mostly, at least:

(hoary-clean)root@shonap:/tmp# cat hello.c
#include <stdio.h>

int main(int argc, char **argv) {
  fprintf(stderr, "hello multiarched world\n");
}
(hoary-clean)root@shonap:/tmp#

A trivial hello.c. Then, we have a multiarched libc6 and libc6-dev:

(hoary-clean)root@shonap:/tmp# ls /usr/include/stdio.h
ls: /usr/include/stdio.h: No such file or directory
(hoary-clean)root@shonap:/tmp# ls /usr/include/i386-linux/stdio.h
/usr/include/i386-linux/stdio.h
(hoary-clean)root@shonap:/tmp#

Matching libraries:

(hoary-clean)root@shonap:/tmp# ls /usr/lib/libc.so /lib/libc.so.6
ls: /usr/lib/libc.so: No such file or directory
ls: /lib/libc.so.6: No such file or directory
(hoary-clean)root@shonap:/tmp# ls -1 /usr/lib/i386-linux/libc.so /lib/i386-linux/libc.so.6
/lib/i386-linux/libc.so.6
/usr/lib/i386-linux/libc.so
(hoary-clean)root@shonap:/tmp#

Then, compile, check, run:

(hoary-clean)root@shonap:/tmp# gcc-3.4 hello.c -o hello
(hoary-clean)root@shonap:/tmp# file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped
(hoary-clean)root@shonap:/tmp# ldd hello
                libc.so.6 => /lib/i386-linux/libc.so.6 (0xb7eb1000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7fea000)
(hoary-clean)root@shonap:/tmp#
(hoary-clean)root@shonap:/tmp# ./hello
hello multiarched world
(hoary-clean)root@shonap:/tmp#

Yay!

Of course, there are minor problems left, like gcc thinking that it installs the 64 bit libraries into /usr/lib/i486-linux/x86_64-linux, that it currently can’t compile for 64 bit due to the symlink from libgcc_s_64.so being missing and other minor stuff like that. It seems glibc also needs a minor adjustment (just a missing symlink from i486-linux to i386-linux in /usr/include).

As a final test, I scp-ed the 64 bit binary I built (after having created the libgcc_s_64 symlink by hand) to an AMD64, and it works beautifully there.

Back to posts