Installing GCC: Building

GCC ¼³Ä¡Çϱâ: ÄÄÆÄÀÏ(Building)

Now that GCC is configured, you are ready to build the compiler and runtime libraries.

Áö±ÝÀº GCC°¡ ȯ°æ¼³Á¤ÀÌ µÇ¾ú´Ù¸é, ´ç½ÅÀº ÄÄÆÄÀÏ·¯¿Í ·±Å¸ÀÓ ¶óÀ̺귯¸®µéÀ» ¸¸µé Áغñ°¡ ´Ù µÈ °ÍÀÌ´Ù.

We highly recommend that GCC be built using GNU make; other versions may work, then again they might not.

¿ì¸®´Â GNU make¸¦ »ç¿ëÇÏ¿© GCC¸¦ ÄÄÆÄÀÏ(bulid)Çϱ⸦ °­·ÂÈ÷ ÃßõÇÑ´Ù; ´Ù¸¥ ¹öÀüÀº ÀÛµ¿ÇÒ ¼öµµ ÀÖ°í ´Ù½Ã ÀÛµ¿ÇÏÁö ¾ÊÀ» ¼öµµ ÀÖ´Ù.

(For example, many broken versions of make will fail if you use the recommended setup where objdir is different from srcdir.)

(¿¹¸¦µé¸é, ¸¹Àº makeÀÇ ±úÁø ¹öÀüµéÀ» ÀÌ¿ëÇÏ¸é ±ÇÀåÇÏ´Â ¼³Á¤ÀÎ srcdir¿Í ´Ù¸¥ °÷À¸·Î objdir¸¦ ¼³Á¤ÇÏ¿´À»½Ã¿¡ ½ÇÆÐÇÏ°Ô µÉ °ÍÀÌ´Ù.)

Building a native compiler

³×ÀÌƼºê ÄÄÆÄÀÏ·¯ ¸¸µé±â

For a native build issue the command `make bootstrap'. This will build the entire GCC system, which includes the following steps:

³×ÀÌƼºê¸¦ À§Çؼ­ 'make bootstrap'¶ó´Â ¸í·ÉÀ» »ç¿ëÇÑ´Ù. ÀÌ°ÍÀº ÀüüÀÇ GCC ½Ã½ºÅÛÀ» ¸¸µé °ÍÀÌ´Ù. ±× ´Ü°è´Â ´ÙÀ½°ú °°´Ù:

If you are short on disk space you might consider `make bootstrap-lean' instead. This is identical to `make bootstrap' except that object files from the stage1 and stage2 of the 3-stage bootstrap of the compiler are deleted as soon as they are no longer needed.

¸¸¾à ´ç½ÅÀÌ °¡Áö°í ÀÖ´Â µð½ºÅ© °ø°£ÀÌ Àû´Ù¸é `make bootstrap-lean'¸¦ ´ë½Å »ç¿ëÇÏ´Â °ÍÀ» °í·ÁÇغÁ¾ßÇÑ´Ù. ÀÌ°ÍÀº 3-stage ºÎÆ®½ºÆ®·¦¿¡¼­ÀÇ stage1, stage2·ÎºÎÅÍ ³ª¿Â ¿ÀºêÁ§Æ® È­ÀϵéÀ» ±×°ÍµéÀÌ ´õÀÌ»ó ÇÊ¿ä¾ø°Ô µÇÀÚ¸¶ÀÚ »èÁ¦ÇÑ´Ù´Â °ÍÀ» »©°ï `make bootstrap'°ú µ¿ÀÏÇÏ´Ù.

If you want to save additional space during the bootstrap and in the final installation as well, you can build the compiler binaries without debugging information with "make CFLAGS='-O' LIBCFLAGS='-g -O2' LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap". This will save roughly 40% of disk space both for the bootstrap and the final installation. (Libraries will still contain debugging information.)

¸¸¾à ´ç½ÅÀÌ ¸¶Áö¸· ¼³Ä¡ °úÁ¤ »Ó¸¸ ¾Æ´Ï¶ó ºÎÆ®½ºÆ®·¦°úÁ¤Áß¿¡ Ãß°¡ÀûÀÎ °ø°£À» Àý¾àÇϱ⸦ ¿øÇÑ´Ù¸é, "make CFLAGS='-O' LIBCFLAGS='-g -O2' LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap"ÇÔÀ¸·Î½á µð¹ö±ë Á¤º¸¸¦ ¾ø¾Ö°í ÄÄÆÄÀÏ·¯ ¹ÙÀ̳ʸ®¸¦ ¸¸µé ¼ö ÀÖ´Ù. ÀÌ°ÍÀº ºÎÆ®½ºÆ®·¦ ±×¸®°í ¸¶Áö¸· ÀνºÅç°úÁ¤¿¡¼­ °ÅÀÇ 40%ÀÇ µð½ºÅ© °ø°£ Àý¾àÀ» °¡Á®¿À°ÔµÈ´Ù. (¶óÀ̺귯¸®µéÀº µð¹ö±ë Á¤º¸¸¦ ¿©ÀüÈ÷ Æ÷ÇÔÇÏ°Ô µÉ °ÍÀÌ´Ù.)

If you used the flag --enable-languages=... to restrict the compilers to be built, only those you've actually enabled will be built. This will of course only build those runtime libraries, for which the particular compiler has been built. Please note, that re-defining LANGUAGES when calling `make bootstrap' *does not* work anymore!

ÄÄÆÄÀÏ·¯¸¦ ¸¸µé½Ã¿¡ Á¦¾ÇÀ» À§Çؼ­ --enable-languages=... Ç÷¡±×¸¦ »ç¿ëÇÑ´Ù¸é, ½ÇÁ¦ÀûÀ¸·Î »ç¿ëÇÒ °Íµé·Î ¸¸µé°Ô µÉ °ÍÀÌ´Ù. ÀÌ°ÍÀº Ưº°ÇÑ ÄÄÆÄÀÏ·¯·Î ¸¸µé±â À§Çؼ­ ±× ¾ð¾îµéÀÇ ·±Å¸ÀÓ ¶óÀ̺귯¸®¸¦ ¸¸µé°ÍÀÌ´Ù. `make bootstrap' È£Ãâ½Ã¿¡ ÀçÁ¤ÀÇµÈ ¾ð¾îµéÀº ´õ ÀÌ»ó ÀÛµ¿ÇÏÁö ¾ÊÀ» °ÍÀÌ´Ù.

Building a cross compiler

Å©·Î½º ÄÄÆÄÀÏ·¯ ¸¸µé±â

We recommend reading the crossgcc FAQ for information about building cross compilers.

Å©·Î½º ÄÄÆÄÀÏ·¯¸¦ ¸¸µå´Â °Í¿¡ ´ëÇÑ Á¤º¸µéÀº crossgcc FAQ¿¡¼­ ¾ò¾î¼­ Àо±â¸¦ ±ÇÇÑ´Ù.

When building a cross compiler, it is not generally possible to do a 3-stage bootstrap of the compiler. This makes for an interesting problem as parts of GCC can only be built with GCC.

Å©·Î½º ÄÄÆÄÀÏ·¯¸¦ ¸¸µé½Ã¿¡, ÀϹÝÀûÀ¸·Î ÄÄÆÄÀÏ·¯ÀÇ 3-stage ºÎÆ®½ºÆ®·¦À» ÇÏ´Â °ÍÀº °¡´ÉÇÏÁö ¾Ê´Ù ÀÌ°ÍÀº GCCÀÇ ºÎºÐÀ¸·Î½á °ü½ÉÀÖ´Â ¹®Á¦¸¦ À§ÇØ ´ÜÁö GCC¿Í ÇÔ²² ¸¸µé¾îÁø´Ù. (??)

To build a cross compiler, we first recommend building and installing a native compiler. You can then use the native GCC compiler to build the cross compiler.

Å©·Î½º ÄÄÆÄÀÏ·¯¸¦ ¸¸µé±â À§Çؼ­, ¿ì¸®´Â ¿ì¼± ³×ÀÌƼºê ÄÄÆÄÀÏ·¯¸¦ ¸¸µé°í ¼³Ä¡Çϱ⸦ ±ÇÀåÇÑ´Ù. ´ç½ÅÀº Å©·Î½º ÄÄÆÄÀÏ·¯¸¦ ¸¸µé±â À§Çؼ­ ³×ÀÌƼºê ÄÄÆÄÀÏ·¯¸¦ »ç¿ëÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.

Assuming you have already installed a native copy of GCC and configured your cross compiler, issue the command "make", which performs the following steps:

´ç½ÅÀÌ ÀÌ¹Ì ³×ÀÌƼºê ÄÄÆÄÀÏ·¯¸¦ °¡Áö°í ÀÖÀ¸¸ç Å©·Î½º ÄÄÆÄÀÏ·¯¸¦ À§ÇÑ ¼³Á¤À» ¸¶ÃÆ´Ù°í °¡Á¤ÇÑ´Ù¸é, "make" ¸í·ÉÀ» ½ÇÇàÇ϶ó. ÀÌ°ÍÀº ´ÙÀ½°ú °°Àº ÀÛ¾÷µéÀ» ¼öÇàÇÑ´Ù:

Note that if an error occurs in any step the make process will exit.

¸¸¾à ¾î¶² ´Ü°è¿¡¼­¶óµÎ ¿¡·¯°¡ ¹ß»ýÇϸé make ÀÛ¾÷Àº ¸ØÃß°Ô µÉ °ÍÀÌ´Ù.

Building in parallel

º´·ÄÀûÀ¸·Î ¸¸µé±â

If you have a multiprocessor system you can use `make bootstrap MAKE="make -j 2" -j 2' or just `make -j 2 bootstrap' for GNU Make 3.79 and above instead of just `make bootstrap' when building GCC. You can use a bigger number instead of two if you like. In most cases, it won't help to use a number bigger than the number of processors in your machine.

¸¸¾à ´ç½ÅÀÌ ¸ÖƼÇÁ·Î¼¼¼­ ½Ã½ºÅÛÀ» °¡Áö°í ÀÖ´Ù¸é, GCC¸¦ ¸¸µé½Ã¿¡ À§¿¡ ÀÖ´Â `make bootstrap' ´ë½Å¿¡ `make bootstrap MAKE="make -j 2" -j 2'³ª GNU Make 3.79 ¿¡¼­ `make -j 2 bootstrap' ¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù. ´ç½ÅÀÌ ÁÁ´Ù¸é 2º¸´Ù ´õ Å« ¼ö¸¦ »ç¿ëÇÒ ¼öµµ ÀÖ´Ù. ´ëºÎºÐÀÇ °æ¿ì¿¡, ´ç½ÅÀÇ ¸Ó½ÅÀÇ ÇÁ·Î¼¼¼­ÀÇ ¼öº¸´Ù Å« ¼ö¸¦ »ç¿ëÇÏ´Â °ÍÀº º° µµ¿òÀÌ µÇÁö ¾ÊÀ» °ÍÀÌ´Ù.


Return to the GCC Installation page

GCC ¼³Ä¡Çϱâ ÆäÀÌÁö·Î µ¹¾Æ°¡±â