gcc: 內部錯誤:檔案大小超出限制 gcc: Internal error: File size limit exceeded

來源:互聯網
上載者:User

今天使用gcc編譯器時,出現了如下錯誤:

gcc: 內部錯誤:檔案大小超出限制

[root@hdfs05 COpFile]# gcc readxml.c
gcc: Internal error: File size limit exceeded (program as)
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.

[root@hdfs05 COpFile]# gcc readxml.c
gcc: 內部錯誤:檔案大小超出限制 (程式 cc1)
請提交一份完整的錯誤報表。
具體步驟請參見 <URL:http://bugzilla.redhat.com/bugzilla>。

解決辦法:

    這是由於我在shell中誤操作了命令“ulimit 0”所導致的,
    ulimit命令是用來限制使用者的某些系統資源的,包括可以開啟的檔案數量、可

以使用的CPU時間、可以使用的記憶體總量、當前shell可以建立的最大檔案容量等等

。命令具體使用請查閱相關資料,這裡只介紹與檔案大小限制相關的知識。
   
    命令使用方式: ulimit [-SHacdfilmnpqstuvx] [配額]

    ulimit預設的選項是 -f,即限制當前shell可以建立檔案的最大容量,其單位

是KB,注意是當前shell,即若在當前shell中使用了 ulimit -f 命令,其作用範圍

只是當前shell,不會作用於其他shell。

    例如 :
    ulimit 1024 = ulimit -f 1024 表示可以建立的最大檔案容量是1024KB=1M。
使用 ulimit -f 或者ulimit可以查看限制的容量大小。如果不想限制建立檔案的大

小,可以將配額賦值為unlimited,例如: ulimit unlimited 或 ulimit -f

unlimited。

    由於我使用了命令 ulimit 0,最大檔案是0,所以gcc編譯會出現錯誤,
    解決辦法是:
    在當前shell中運行命令 ulimit unlimited ;
    或者
    退出該shell,重新啟動一個shell

    此外,介紹一下 ulimit -c [配額] 命令,它是限制可以建立的最大核心檔案(core files)的容量,在使用gdb調式程式時可能要用到它。

    例如:

 xiaosuo@gentux test $ ulimit -c
 0
 xiaosuo@gentux test $ ulimit -c 1000
 xiaosuo@gentux test $ ulimit -c
 1000
 xiaosuo@gentux test $ ./a.out
 段錯誤 (core dumped)
 
        編譯出現錯誤,產生了core檔案,
        用gdb調試一下core檔案:
        xiaosuo@gentux test $ gdb ./a.out core

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.