Previous Next Contents

4. ½ÃÇè»ï¾Æ ¼³Ä¡Çϱâ

Glibc 2¸¦ ½ÃÇè»ï¾Æ ¼³Ä¡Çϸé, ÄÄÆÄÀÏ ÇÒ ¶§¿¡ Ưº°ÇÑ º¯¼ö¸¦ »ç¿ëÇÏ¿© glibc 2¿¡ ¸µÅ·½ÃÅ°Áö ¾Ê´ÂÇÑ ÀÌ¹Ì ¼³Ä¡µÇ¾î ÀÖ´Â ±âÁ¸ÀÇ ¶óÀ̺귯¸®¿¡ ¸µÅ·ÀÌ µÈ´Ù. ¼³Ä¡ µð·ºÅ丮 À§Ä¡(path)°¡ ¸î ÆÄÀÏ¿¡ Æ÷ÇԵǾî ÄÄÆÄÀϵǹǷΠ, ¼Ò½º·Î ºÎÅÍ ¶óÀ̺귯¸®¸¦ ¼³Ä¡Çؾ߸¸ ÇÑ´Ù.

4.1 ÄÄÆÄÀÏÇϱâ¿Í ¼³Ä¡Çϱâ

ÀüÁ¦ Á¶°Ç

RAM 64 MBÀÎ i586@133 ÄÄÇ»ÅÍ¿¡¼­ Ãß°¡ ¶óÀ̺귯¸®(add-ons)Æ÷ÇÔÇÑ Àüü ¶óÀ̺귯¸® ¸¦ ÄÄÆÄÀÏÇϴµ¥ ¼Ò¿ä ½Ã°£Àº ¾à 3½Ã°£À̸ç, i686@2¿¡ ÄÄÇ»ÅÍÀÇ °æ¿ì´Â ¾à 1½Ã°£ 30ºÐ Á¤µµ °É·È´Ù.

¼Ò½º¸¦ ÃßÃâÇϱâ

¼Ò½º ÆÄÀÏÀ» ÄÄÆÄÀÏÇϱâ À§Çؼ­´Â Archives¿¡¼­ ¼Ò½º ÆÄÀÏÀ» ÃßÃâÇؾ߸¸ ÇÑ´Ù. ¾Æ·¡¿Í °°ÀÌ ÇÏ¸é µÈ´Ù:

 tar xzf glibc-2.0.5.tar.gz
 cd glibc-2.0.5
 cat ../glibc-2.0.5-2.0.5c.diff.gz | gzip -d | patch -p0
 tar xzf ../glibc-linuxthreads-2.0.5.tar.gz
 tar xzf ../glibc-crypt-2.0.5.tar.gz
 tar xzf ../glibc-localedata-2.0.5.tar.gz
 
À§ÀÇ ¹æ¹ýó·³ Çϸé, glibc-2.0.5 µð·ºÅ丮¿¡ linuxthreads, crypt, localeddata µð·ºÅ丮°¡ »ý¼ºµÈ´Ù. ÀÌ·¸°Ô ÇؾßÁö¸¸ configure°¡ Ãß°¡µÈ ¶óÀ̺귯¸® µð·ºÅ丮¸¦ ãÀ» ¼ö ÀÖ´Ù.

Configure¸¦ ½ÇÇàÇϱâ

glibc-2.0.5 µð·ºÅ丮¿¡¼­ "compile"À̶õ µð·ºÅ丮¸¦ ¸¸µé°í, cd·Î 'compile' µð·ºÅ丮·Î ¿Â´Ù. ¸ðµç ÀÛ¾÷Àº ÀÌ compile µð·ºÅ丮¿¡¼­ ÀÌ·ç¾îÁø´Ù.

 mkdir compile
 cd compile
 

À§ÀÇ °úÁ¤À» ¸¶ÃÆÀ¸¸é, '../configure'À» ½ÇÇà½ÃÅ°¸é µÈ´Ù. Ãß°¡ ÆÐÅ°Áö¸¦ »ç¿ëÇÏ°í ½ÍÀ¸¸é, Ãß°¡ ÆÐÅ°Áö¿¡ ´ëÇÑ ¿É¼Ç(--enable-add-ons <¿¹> --enable-add-ons=linuxthreads,crypt,localedata)À» Æ÷ÇÔ½ÃÄÑ¾ß ÇÑ´Ù. ¶Ç ¼³Ä¡ÇÏ°í ½ÍÀº µð·ºÅ丮¸¦ ¼±ÅÃÇØ¾ß ÇÑ´Ù. º¸Åë ¼³Ä¡ µð·ºÅ丮·Î '/usr/i486-linuxglibc2'À» »ç¿ëÇÑ´Ù. ´ÙÀ½Àº configure lineÀÇ ¿¹ÀÌ´Ù:

 ../configure --enable-add-ons=linuxthreads,crypt,localedata --prefix=/usr/i486-linuxglibc2
 

ÄÄÆÄÀÏÇϱâ¿Í ¼³Ä¡Çϱâ

ÄÄÆÄÀÏÇÏ°í Á¦´ë·Î µÇ¾ú´ÂÁö È®ÀÎÇÏ´Â ÀýÂ÷´Â ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù:

 make
 make check
 

'make check'°¡ ¼º°øÀûÀ¸·Î ³¡³µÀ¸¸é, ¶óÀ̺귯¸®¸¦ ¼³Ä¡ÇÑ´Ù:

 make install
 

4.2 µ¿Àû·Î´õ(dynamic loader)¸¦ ¾÷±×·¹À̵åÇÏÀÚ.

  1. ¸¸µé¾îÁø ld.so¸¦ /lib/ld-linux.so.2·Î ¸µÅ·½ÃŲ´Ù:
     ln -s /usr/i486-linuxglibc2/lib/ld-linux.so.2 /lib/ld-linux.so.2
     
    
    This is the only library where the location is fixed once a program is linked, and using a link in /lib will ease upgrading to glibc as your primary C library when the stable version is released.
  2. /etc/ld.so.conf ÆÄÀÏÀ» ÆíÁýÇÑ´Ù. ÆÄÀÏÀÇ ¸¶Áö¸· ¶óÀο¡ »õ·Ó°Ô ¸¸µé¾îÁø ¶óÀ̺귯¸® µð·ºÅ丮ÀÇ °æ·Î¸í(path)¸¦ ÀûÀ¸¸é µÈ´Ù. Áï ¿ì¸®°¡ ¼³Ä¡Çß´ø °æ¿ì¿¡´Â '/usr/i486-linuxglibc2/lib'À» ÀûÀ¸¸é µÈ´Ù. (ÁÖÀÇ »çÇ× : 'Àº Àû´Â °ÍÀÌ ¾Æ´Ô.^^) /etc/ld.so.conf ÆÄÀÏÀ» º¯°æÇßÀ¸¸é, ´ÙÀ½°ú °°ÀÌ ½ÇÇàÇØ º¸¶ó.
     ldconfig -v
     
    

4.3 gcc¸¦ configureÇϱâ

¼³Ä¡ÀÇ ¸¶Áö¸· ´Ü°è°¡ /usr/lib/gcc-lib¸¦ ¾÷µ¥ÀÌÆ®(update)ÇÏ´Â °ÍÀÌ´Ù. ÀÌ°ÍÀ» ÇؾßÁö¸¸ gcc°¡ ¾î¶»°Ô »õ·Î¿î ¶óÀ̺귯¸®¸¦ »ç¿ëÇÒÁö¸¦ ¾Ë ¼ö ÀÖ´Ù. ¿ì¼± ÀÖ´Â configurationÆÄÀÏÀ» º¹»çÇÑ´Ù. ÇöÀç configurationÀÇ ³»¿ëÀ» ¾Ë±â À§Çؼ­´Â ´ÙÀ½°ú °°ÀÌ ÇÏ¸é µÈ´Ù:

 % gcc -v
 Reading specs from /usr/lib/gcc-lib/i486-unknown-linux/2.7.2.2/specs
 gcc version 2.7.2.2
 
ÀÌ °æ¿ì´Â ½Ã½ºÅÛÀÌ i486-unknown-linux, 2.7.2.2°¡ ¹öÀüÀÌ´Ù. ´ç½ÅÀÌ ÇؾßÇÒ ÀÏÀº /usr/lib/gcc-lib/<system> À» »õ·Î¿î Å×½ºÆ® ½Ã½ºÅÛ µð·ºÅ丮·Î º¹»çÇÏ´Â °ÍÀÌ´Ù: º¹»çÇÏ´Â °ÍÀÌ´Ù.:
 cd /usr/lib/gcc-lib/
 cp -r i486-unknown-linux i486-linuxglibc2
 
±× ´ÙÀ½ ´ÙÀ½°ú °°ÀÌ Ç϶ó.
 cd /usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2
 
ÀÌ µð·ºÅ丮¿¡¼­ 'specs'ÆÄÀÏÀ» ÆíÁýÇÑ´Ù. Áï specs ÆÄÀϳ»¿¡ /lib/ld-linux.so.1À» /lib/ld-linux.so.2·Î ¹Ù²Û´Ù. ¶Ç %{...:-lgmon} °¡ µé¾î°£ ¸ðµç ¹®ÀåÀ» Áö¿ö¶ó. ¿Ö³Ä¸é glibc´Â profileÇϱâ À§Çؼ­ gmon ¶óÀ̺귯¸®¸¦ »ç¿ëÇÏÁö ¾Ê±â ¶§¹®ÀÌ´Ù. »ùÇà specs ÆÄÀÏÀº »ùÇà specs ÆÄÀÏ´Ü¿ø ¿¡¼­ ãÀ» ¼ö ÀÖ´Ù.

4.4 Çì´õ ÆÄÀÏ ¸µÅ©¸¦ ¾÷µ¥ÀÌÆ®Çϱâ.

Çì´õ ÆÄÀÏ ¸µÅ©´Â ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù:

 cd /usr/i486-linuxglibc2/include
 ln -s /usr/src/linux/include/linux
 ln -s /usr/src/linux/include/asm
 ln -s /usr/X11R6/include/X11
 
You might also have other libraries such as ncurses which need their header files put in this directory. You should copy or link the files from /usr/include. (Some libraries may need to be recompiled with glibc2 in order to work with it. In these cases, just compile and install the package to /usr/i486-linuxglibc2.)

4.5 ¼³Ä¡µÈ°ÍÀ» Å×½ºÆ®Çϱâ

¿ì¼± ´ÙÀ½°ú °°Àº ÆÄÀÏ(glibc.c)¸¦ ¸¸µç´Ù:

 #include <stdio.h>

 main()
 {
     printf("hello world!\n");
 }
 
±×¸®°í ¿É¼Ç"-b <base install directory> -nostdinc -I<install directory>/include -I/usr/lib/gcc-lib/<new system dir>/<gcc version>/include" À» °¡Áö°í ÄÄÆÄÀÏ ÇÑ´Ù.
 % gcc -b i486-linuxglibc2 -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include glibc.c -o glibc
 
ldd¸¦ ÀÌ¿ëÇÏ¿©¼­ ÇÁ·Î±×·¥ÀÌ glibc2¿¡ ¸µÅ©µÇ¾ú´ÂÁö È®ÀÎÇغ»´Ù:
 % ldd glibc
 libc.so.6 => /usr/i486-linuxglibc2/lib/libc-2.0.5.so (0x4000d000)
 /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
 
ÄÄÆÄÀÏÀÌ µÇ°í, ¸µÅ© °úÁ¤µµ Á¤»óÀ̸ç, ½ÇÇà½Ã "hello world!" °¡ Ãâ·ÂÀÌ µÈ´Ù¸é, ¼³Ä¡´Â ¼º°øÀûÀ¸·Î ³¡³­ °ÍÀÌ´Ù. (ÃàÇÏ....^^)


Previous Next Contents