2015-12-14 19 views
2

所以我在一箇舊的CentOS 6.6發行版,並從源代碼編譯GCC 5.2。 當我安裝它時,它會在libexec下創建它的5.2.0子文件夾,但是二進制文件cc1和cc1 plus是巨大的!本機GCC 5二進制文件太大(libexec)

這是我如何建立它

Using built-in specs. 
COLLECT_GCC=./gcc 
COLLECT_LTO_WRAPPER=/usr2/libexec/gcc/i686-redhat-linux-gnu/5.2.0/lto-wrapper 
Target: i686-redhat-linux-gnu 
Configured with: ../configure 
--prefix=/usr2 
--disable-multilib 
--enable-languages=c,c++ 
--enable-gnu-unique-object 
--disable-dssi 
--enable-libstdcxx-threads 
--enable-libstdcxx-time 
--enable-shared 
--enable-__cxa_atexit 
--disable-libunwind-exceptions 
--disable-libada 
--host=i686-redhat-linux-gnu 
--build=i686-redhat-linux-gnu 
--target=i686-redhat-linux-gnu 
--with-default-libstdcxx-abi=gcc4-compatible 
--with-arch=i686 
--enable-linker-build-id 
--with-system-zlib 
--with-default-libstdcxx-abi=gcc4-compatible 
Thread model: posix 
gcc version 5.2.0 (GCC) 

這裏是4.4.7的LS在發行

-rwxr-xr-x 1 root root 8566416 Jul 23 00:19 cc1 
-rwxr-xr-x 1 root root 9574772 Jul 23 00:19 cc1plus 
-rwxr-xr-x 1 root root 101596 Jul 23 00:19 collect2 
-rwxr-xr-x 1 root root 9419280 Jul 23 00:19 f951 

這裏是新編譯的相同5.2.0

-rwxr-xr-x 1 root root 102532928 Dec 11 16:48 cc1 
-rwxr-xr-x 1 root root 109000772 Dec 11 16:48 cc1plus 
-rwxr-xr-x 1 root root 2033844 Dec 11 16:48 collect2 
drwxr-xr-x 2 root root  4096 Dec 11 16:48 install-tools 
-rwxr-xr-x 1 root root  995 Dec 11 16:48 liblto_plugin.la 
lrwxrwxrwx 1 root root  22 Dec 11 16:48 liblto_plugin.so -> liblto_plugin.so.0.0.0 
lrwxrwxrwx 1 root root  22 Dec 11 16:48 liblto_plugin.so.0 -> liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 root root 235508 Dec 11 16:48 liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 root root 98350432 Dec 11 16:48 lto1 
-rwxr-xr-x 1 root root 2288396 Dec 11 16:48 lto-wrapper 

cc1,cc1plus和lto1各100MB。 5.2是否正常? 這是爲什麼發生?

由於@Marc Glisse評論,我跑了兩個二進制

5.2.0/cc1: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped 

4.4.7/cc1: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped 

一個文件是這個剝離使其中的差別? 我錯過了什麼配置標誌?

+1

嵌入式系統的事情是,你實際上不在這些系統上編程*,你編程*爲*他們。這就是爲什麼存在交叉編譯等原因。 –

+0

謝謝Joachim。我不知道交叉編譯。我做了一個快速搜索,並沒有真正記錄如何做到這一點。 顯然我需要做一個686到486編譯器,可能鏈接到正確的內核頭文件?也許binutils呢? 仍然在部署和測試時,我們有時會在機器上編譯,所以編譯器很方便(我們這裏沒有談論POS機)。 所以我仍然會解決我提到的尺寸問題。 – Claudio

+0

'file/path/to/cc1'說的是什麼? –

回答

1

感謝@MarcGlisse指引我在正確的方向。

不管你如何配置GCC,除非你有

make install-strip 

二進制安裝將滿符號。 安裝剝離版本使尺寸縮小了70%。

-rwxr-xr-x 1 root root 19749196 Dec 14 13:01 cc1 
-rwxr-xr-x 1 root root 21057676 Dec 14 13:01 cc1plus 
-rwxr-xr-x 1 root root 507336 Dec 14 13:01 collect2 
drwxr-xr-x 2 root root  4096 Dec 14 13:01 install-tools 
-rwxr-xr-x 1 root root  995 Dec 14 13:01 liblto_plugin.la 
lrwxrwxrwx 1 root root  22 Dec 14 13:01 liblto_plugin.so -> liblto_plugin.so.0.0.0 
lrwxrwxrwx 1 root root  22 Dec 14 13:01 liblto_plugin.so.0 -> liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 root root 76972 Dec 14 13:01 liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 root root 18930924 Dec 14 13:01 lto1 
-rwxr-xr-x 1 root root 693024 Dec 14 13:01 lto-wrapper 
drwxr-xr-x 2 root root  4096 Dec 14 13:01 plugin 
相關問題