본문 바로가기

TroubleShooting/Linux

64 bit linux macine 에서 32 bit compile

728x90

64 bit 리눅스 macine 에서 32 bit  를 컴파일할 때, gcc 툴체인에서 다음과 같이 옵션만 추가하면 된다.


# gcc -print-multi-lib

.;

32;@m32


# gcc -m32 hello.c


그런데, 다음과 같은 에러가 발생한다면 패키지를 설치해야 한다.

In file included from /usr/include/features.h:352,

                 from /usr/include/stdio.h:28,

                 from gsp_demo.c:1:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory


# yum search glibc-devel

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: ftp.daum.net

 * extras: ftp.daum.net

 * updates: ftp.daum.net

================================================== Matched: glibc-devel ==================================================

glibc-devel.i386 : 표준 C 라이브러리를 사용한 개발에 사용되는 객체 파일.

glibc-devel.x86_64 : 표준 C 라이브러리를 사용한 개발에 사용되는 객체 파일.


# yum install glibc-devel.i386


출처 :

http://www.cyberciti.biz/faq/x86_64-linux-error-gnustub-32h-missing-error-and-solution/