제임스딘딘의
Tech & Life

개발자의 기록 노트/Linux

[우분투 16.04] 32bit library를 64 bit 우분투 16.04에 설치하는 방법

제임스-딘딘 2017. 12. 13. 21:03

개요

우분투라는 운영체제는 32 bit CPU용 버전과 64 bit CPU용 버전이 제공된다.

그런데 종종, 32bit 용으로 빌드 된 실행파일을 64 bit 용 우분투에서 실행시켜야 하는 경우가 있다.

그리고 우분투 12.04 LTS의 64bit 버전에서는 꼼수로써, ia32-libs 라는 패키지를 제공해서, 32bit용 실행파일을 실행 시킬 수 있도록 했었다.


그러나 우분투 16.04 에서는 ia32-libs 패키지가 deprecated 처리가 되었다.

그 이유는 MultiArch를 사용하도록 유도하기 위해서 인 듯 싶다.


하지만 방법이 있다.

아래와 같은 순서로 MultiArch를 설치하고, 32 bit 용 실행파일을 우분투 16.04 의 64bit 버전 에서 실행되도록 할 수 있다.



i386 아키텍쳐 활성화 하기


root 권한으로 아래 명령을 통해 i386 아키텍쳐를 활성화 시킨다.


$ sudo dpkg --add-architecture i386
$ sudo apt-get update



32-bit 라이브러리 설치하기


root 권한으로 아래 명령을 통해 32-bit 라이브러리를 설치한다.


$ apt-get install libc6:i386 libstdc++6:i386


설치 과정의 console 로그

아래와 같이 설치가 진행된다.

참고 바란다.


$ sudo apt-get install libc6:i386 libstdc++6:i386
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  cpp-5 g++-5 gcc-5 gcc-5-base gcc-5-base:i386 gcc-6-base:i386 libasan2 libatomic1 libc-dev-bin libc6 libc6-dbg libc6-dev libcc1-0 libcilkrts5 libgcc-5-dev libgcc1:i386 libgomp1 libitm1 liblsan0 libmpx0 libquadmath0 libstdc++-5-dev
  libstdc++6 libtsan0 libubsan0
Suggested packages:
  gcc-5-locales g++-5-multilib gcc-5-doc libstdc++6-5-dbg gcc-5-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan2-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx0-dbg libquadmath0-dbg
  glibc-doc glibc-doc:i386 locales:i386 libstdc++-5-doc
The following NEW packages will be installed:
  gcc-5-base:i386 gcc-6-base:i386 libc6:i386 libgcc1:i386 libstdc++6:i386
The following packages will be upgraded:
  cpp-5 g++-5 gcc-5 gcc-5-base libasan2 libatomic1 libc-dev-bin libc6 libc6-dbg libc6-dev libcc1-0 libcilkrts5 libgcc-5-dev libgomp1 libitm1 liblsan0 libmpx0 libquadmath0 libstdc++-5-dev libstdc++6 libtsan0 libubsan0
22 upgraded, 5 newly installed, 0 to remove and 424 not upgraded.
Need to get 41.1 MB of archives.
After this operation, 12.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc6-dbg amd64 2.23-0ubuntu9 [3,683 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc6-dev amd64 2.23-0ubuntu9 [2,082 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc-dev-bin amd64 2.23-0ubuntu9 [68.6 kB]
Get:4 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc6 amd64 2.23-0ubuntu9 [2,586 kB]
Get:5 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcc1-0 amd64 5.4.0-6ubuntu1~16.04.5 [38.8 kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgomp1 amd64 5.4.0-6ubuntu1~16.04.5 [55.1 kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libitm1 amd64 5.4.0-6ubuntu1~16.04.5 [27.4 kB]
Get:8 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libatomic1 amd64 5.4.0-6ubuntu1~16.04.5 [8,920 B]
Get:9 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libasan2 amd64 5.4.0-6ubuntu1~16.04.5 [264 kB]
Get:10 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 liblsan0 amd64 5.4.0-6ubuntu1~16.04.5 [105 kB]
Get:11 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libtsan0 amd64 5.4.0-6ubuntu1~16.04.5 [244 kB]
Get:12 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libubsan0 amd64 5.4.0-6ubuntu1~16.04.5 [95.3 kB]
Get:13 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcilkrts5 amd64 5.4.0-6ubuntu1~16.04.5 [40.1 kB]
Get:14 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libmpx0 amd64 5.4.0-6ubuntu1~16.04.5 [9,786 B]
Get:15 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libquadmath0 amd64 5.4.0-6ubuntu1~16.04.5 [131 kB]
Get:16 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 g++-5 amd64 5.4.0-6ubuntu1~16.04.5 [8,435 kB]
Get:17 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libstdc++-5-dev amd64 5.4.0-6ubuntu1~16.04.5 [1,430 kB]
Get:18 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgcc-5-dev amd64 5.4.0-6ubuntu1~16.04.5 [2,226 kB]
Get:19 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 gcc-5 amd64 5.4.0-6ubuntu1~16.04.5 [8,638 kB]
Get:20 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 cpp-5 amd64 5.4.0-6ubuntu1~16.04.5 [7,786 kB]
Get:21 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 gcc-5-base amd64 5.4.0-6ubuntu1~16.04.5 [17.1 kB]
Get:22 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libstdc++6 amd64 5.4.0-6ubuntu1~16.04.5 [393 kB]
Get:23 http://kr.archive.ubuntu.com/ubuntu xenial/main i386 gcc-6-base i386 6.0.1-0ubuntu1 [14.3 kB]
Get:24 http://kr.archive.ubuntu.com/ubuntu xenial/main i386 libgcc1 i386 1:6.0.1-0ubuntu1 [46.8 kB]
Get:25 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main i386 libc6 i386 2.23-0ubuntu9 [2,269 kB]
Get:26 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main i386 gcc-5-base i386 5.4.0-6ubuntu1~16.04.5 [17.1 kB]                                                                                                                   
Get:27 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main i386 libstdc++6 i386 5.4.0-6ubuntu1~16.04.5 [418 kB]                                                                                                                    
Fetched 41.1 MB in 6s (6,517 kB/s)                                                                                                                                                                                                     
Preconfiguring packages ...
(Reading database ... 195047 files and directories currently installed.)
Preparing to unpack .../libc6-dbg_2.23-0ubuntu9_amd64.deb ...
Unpacking libc6-dbg:amd64 (2.23-0ubuntu9) over (2.23-0ubuntu5) ...
Preparing to unpack .../libc6-dev_2.23-0ubuntu9_amd64.deb ...
Unpacking libc6-dev:amd64 (2.23-0ubuntu9) over (2.23-0ubuntu5) ...
Preparing to unpack .../libc-dev-bin_2.23-0ubuntu9_amd64.deb ...
Unpacking libc-dev-bin (2.23-0ubuntu9) over (2.23-0ubuntu5) ...
Preparing to unpack .../libc6_2.23-0ubuntu9_amd64.deb ...
Unpacking libc6:amd64 (2.23-0ubuntu9) over (2.23-0ubuntu5) ...
Selecting previously unselected package libc6:i386.
Preparing to unpack .../libc6_2.23-0ubuntu9_i386.deb ...
Unpacking libc6:i386 (2.23-0ubuntu9) ...
Setting up libc6:amd64 (2.23-0ubuntu9) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...
Selecting previously unselected package libgcc1:i386.
(Reading database ... 195351 files and directories currently installed.)
Preparing to unpack .../libgcc1_1%3a6.0.1-0ubuntu1_i386.deb ...
Unpacking libgcc1:i386 (1:6.0.1-0ubuntu1) ...
Selecting previously unselected package gcc-6-base:i386.
Preparing to unpack .../gcc-6-base_6.0.1-0ubuntu1_i386.deb ...
Unpacking gcc-6-base:i386 (6.0.1-0ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Setting up gcc-6-base:i386 (6.0.1-0ubuntu1) ...
Setting up libgcc1:i386 (1:6.0.1-0ubuntu1) ...
Setting up libc6:i386 (2.23-0ubuntu9) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
(Reading database ... 195356 files and directories currently installed.)
Preparing to unpack .../libcc1-0_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libcc1-0:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libgomp1_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libgomp1:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libitm1_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libitm1:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libatomic1_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libatomic1:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libasan2_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libasan2:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../liblsan0_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking liblsan0:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libtsan0_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libtsan0:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libubsan0_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libubsan0:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libcilkrts5_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libcilkrts5:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libmpx0_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libmpx0:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libquadmath0_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libquadmath0:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../g++-5_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking g++-5 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libstdc++-5-dev_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libstdc++-5-dev:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../libgcc-5-dev_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libgcc-5-dev:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../gcc-5_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking gcc-5 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../cpp-5_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking cpp-5 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Preparing to unpack .../gcc-5-base_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking gcc-5-base:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Selecting previously unselected package gcc-5-base:i386.
Preparing to unpack .../gcc-5-base_5.4.0-6ubuntu1~16.04.5_i386.deb ...
Unpacking gcc-5-base:i386 (5.4.0-6ubuntu1~16.04.5) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up gcc-5-base:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up gcc-5-base:i386 (5.4.0-6ubuntu1~16.04.5) ...
(Reading database ... 195359 files and directories currently installed.)
Preparing to unpack .../libstdc++6_5.4.0-6ubuntu1~16.04.5_amd64.deb ...
Unpacking libstdc++6:amd64 (5.4.0-6ubuntu1~16.04.5) over (5.4.0-6ubuntu1~16.04.4) ...
Selecting previously unselected package libstdc++6:i386.
Preparing to unpack .../libstdc++6_5.4.0-6ubuntu1~16.04.5_i386.deb ...
Unpacking libstdc++6:i386 (5.4.0-6ubuntu1~16.04.5) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Setting up libstdc++6:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libstdc++6:i386 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libc6-dbg:amd64 (2.23-0ubuntu9) ...
Setting up libc-dev-bin (2.23-0ubuntu9) ...
Setting up libc6-dev:amd64 (2.23-0ubuntu9) ...
Setting up libcc1-0:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libgomp1:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libitm1:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libatomic1:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libasan2:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up liblsan0:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libtsan0:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libubsan0:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libcilkrts5:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libmpx0:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libquadmath0:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up cpp-5 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libgcc-5-dev:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up gcc-5 (5.4.0-6ubuntu1~16.04.5) ...
Setting up libstdc++-5-dev:amd64 (5.4.0-6ubuntu1~16.04.5) ...
Setting up g++-5 (5.4.0-6ubuntu1~16.04.5) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...


결론

64bit 버전의 우분투 16.04(Ubuntu 16.04) 에서 32bit executable file을 실행하고자 하는 경우가 있는데,

기존 우분투 12.04(Ubuntu 12.04)에서 사용하던 패키지인 ia32-libs 를 설치하기는 어렵다.

대신 libc6:i386libstdc++6:i386, 이렇게 두개의 패키지를 설치함으로써 원하는 바를 달성할 수 있다.