Previous Next Contents

6. non-primary libc·Î ÄÄÆÄÀÏÇϱâ

ÇÁ·Î±×·¥À» ÄÄÆÄÀÏ ÇÏ´Ù º¸¸é, ´Ù¸¥ ¶óÀ̺귯¸®¸¦ »ç¿ëÇÏ°í ½ÍÀº ¶§°¡ ÀÖÀ» °ÍÀÌ´Ù. ÀÌ ´Ü¿ø¿¡¼­´Â ¾î¶»°Ô ÇÏ¸é ´Ù¸¥ ¶óÀ̺귯¸®¸¦ »ç¿ëÇÒ ¼ö Àִ°¡¸¦ ¼³¸íÇÑ´Ù. ¿ì¼± ±â¾ïÇØ¾ß ÇÒ °ÍÀº ¾ÕÀÇ µÎ ´Ü¿ø¿¡¼­ ¿¹·Î »ç¿ëµÇ¾ú´ø µð·ºÅ丮 À̸§°ú ¼³Ä¡ À̸§À» »ç¿ëÇÑ´Ù´Â °ÍÀÌ´Ù. Remember to change the names to fit your setup.

6.1 non-primary libcs »ç¿ëÇÒ ¶§ °æ°í

½Ã½ºÅÛ ºÎÆà °úÁ¤¿¡ »ç¿ëµÇ´Â ÇÁ·Î±×·¥À» ÄÄÆÄÀÏ ÇÒ ¶§ ±â¾ïÇÒ °ÍÀº, ±× ÇÁ·Î±×·¥À» µ¿ÀûÀ¸·Î ¸µÅ©ÇÏ°í non-root ÆÄƼ¼ÇÀÌ ¸¶¿îÆ®µÇ±â ÀÌÀü¿¡ »ç¿ëÇÑ´Ù¸é, ¸ðµç ¸µÅ©µÇ´Â ¶óÀ̺귯¸®´Â root ÆÄƼ¼Ç¿¡ ÀÖ¾î¾ß¸¸ ÇÑ´Ù´Â °ÍÀÌ´Ù. glibc¸¦ ÁÖ C ¶óÀ̺귯¸®·Î ¼³Ä¡ÇÏ´Â °úÁ¤(¾Õ ´Ü¿ø)À» Çß´Ù¸é, ±¸ libc´Â /lib¿¡ ÀÖ´Ù. /lib´Â root ÆÄƼ¼Ç¿¡ ÀÖ¾î¾ßÇÑ´Ù. ÀÌ°ÍÀº ¾ÆÁ÷µµ ¸ðµç ´ç½Å ÇÁ·Î±×·¥ÀÌ ºÎÆÃÇÏ´Â µ¿¾È¿¡´Â ÀÛµ¿ÇÑ´Ù´Â °ÍÀÌ´Ù. ±×·¯³ª, ¸¸¾à /usrÀÌ ´Ù¸¥ ÆÄƼ¼Ç¿¡ ÀÖ°í, glibc¸¦ /usr/i486-linuxglibc2¿¡ ¿¬½À¿ëÀ¸·Î ¼³Ä¡Çß´Ù¸é, glibc¿Í ÇÔ²² ÄÄÆÄÀÏµÈ ÇÁ·Î±×·¥µéÀº /usr ÆÄƼ¼ÇÀÌ ¸¶¿îÆ®µÇ±â ÀÌÀü±îÁö´Â ÀÛµ¿ÇÏÁö ¾Ê´Â´Ù´Â °ÍÀÌ´Ù.

6.2 ¿¬½À¿ë glibc¿Í ÇÔ²² ÄÄÆÄÀÏÇϱâ.

¿¬½À¿ë glibc¿Í ÇÔ²² ÇÁ·Î±×·¥À» ÄÄÆÄÀÏÇϱâÀ§Çؼ± glibc include¿¡ include path ¸¦ ´Ù½Ã ¼³Á¤ÇÒ ÇÊ¿ä°¡ ÀÖ´Ù.

Specifying "-nostdinc" will negate the normal paths, and "-I/usr/i486-linuxglibc2/include" will point to the glibc includes. You will also need to specify the gcc includes, which are found in /usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include (assuming you installed the test lib in i486-linuxglibc2 with gcc version 2.7.2.2).

To link a program with a test-install glibc, you need to specify the gcc setup. This is done by using the option "-b i486-linuxglibc2".

For most programs, you can specify these new options by adding them to the CFLAGS and LDFLAGS makefile options:

 CFLAGS = -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include -b i486-linuxglibc2
 LDFLAGS = -b i486-linuxglibc2
 
If you are using a configure script, define the CFLAGS and LDFLAGS shell variables (by using env/setenv for csh/tcsh, or set/export for sh/bash/etc) before running configure. The makefiles generated by this should contain the proper CFLAGS and LDFLAGS. Not all configure scripts will pick up the variables, so you should check after running configure and edit the makefiles by hand if necessary.

If the programs you are compiling only call gcc (and not cpp or binutils directly), you can use the following script to save having to specify all of the options each time:

 #!/bin/bash
 /usr/bin/gcc -b i486-linuxglibc2 -nostdinc \
              -I/usr/i486-linuxglibc2/include \
              -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include "$@"
 
You can then use this script instead of "gcc" when compiling.

6.3 Compiling programs with libc 5 when glibc is primary library

To compile a program with your old libraries when you have installed glibc as your main library, you need to reset the include paths to the old includes. Specifying "-nostdinc" will negate the normal paths, and "-I/usr/i486-linuxlibc5/include" will point to the glibc includes. You must also specify "-I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include" to include the gcc specific includes. Remember to adjust these paths based on the what you named the new directories and your gcc version.

To link a program with your old libc, you need to specify the gcc setup. This is done by using the option "-b i486-linuxlibc5".

For most programs, you can specify these new options by appending them to the CFLAGS and LDFLAGS makefile options:

 CFLAGS = -nostdinc -I/usr/i486-linuxlibc5/include -I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include -b i486-linuxlibc5
 LDFLAGS = -b i486-linuxlibc5
 
If you are using a configure script, define the CFLAGS and LDFLAGS shell variables (by using env/setenv for csh/tcsh, or set/export for sh/bash/etc) before running configure. The makefiles generated by this should contain the proper CFLAGS and LDFLAGS. Not all configure scripts will pick up the variables, so you should check after running configure and edit the makefiles by hand if necessary.

If the programs you are compiling only call gcc (and not cpp or binutils directly), you can use the following script to save having to specify all of the options each time:

 #!/bin/bash
 /usr/bin/gcc -b i486-linuxlibc5 -nostdinc \
              -I/usr/i486-linuxlibc5/include \
              -I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include "$@"
 
You can then use this script instead of "gcc" when compiling.


Previous Next Contents