Echo

run and compile 32bit apps on 64bit ubuntu

ksg97031 2015. 10. 20. 10:03

<install>
$ cat /etc/issue

Ubuntu 14.04.3 LTS \n \l

sudo dpkg --add-architecture i386

sudo apt-get update

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

sudo apt-get install gcc-multilib


<test> 

ksg@ubuntu:~/test$ uname -a

Linux ubuntu 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

ksg@ubuntu:~/test$ gcc -m32 -o test test.c

ksg@ubuntu:~/test$ file test

test: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=8c9e101b1711ffbb957adc92902b9a5d04ae869a, not stripped

ksg@ubuntu:~/test$ ./test

it is 32bit operating system!