2010-07-02 52 views
0

我有嘗試編譯使用Borland C++ Builder的6.0DOS報告的錯誤:錯誤的文件數

它是由Borland公司稱爲使(與bpr2mak創建makefile文件),它是由一個叫做靜態庫的批處理文件。 bat文件(用於使用Visual Studio和一些Borland C++ Builder遺留項目編譯整個項目),該文件是從Cygwin中運行的bash shell腳本調用的。

當我直接從Cygwin的shell中運行.bat文件,它運行正常,但是當它從一個程序調用具有升壓::進程::啓動我得到這個錯誤的cygwin正在運行:

C:\ARQUIV~1\Borland\CBUILD~1\Bin\..\BIN\TLib /u bclibs.lib @[email protected]@@
DOS-reported error: Bad file number
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
opening '[email protected]@@'
** error 1 ** deleting bclibs.lib

這是一個複雜的場景,但是這個調用cygwin的程序是在我們需要構建我們需要爲各種Linux distos和Windows 32和64位構建的軟件包時運行的。

注意:這是唯一的Borland的項目失敗,其他的編譯就好了(它使用Borland也是唯一的靜態庫,因此它可以是一些問題與TLib工具

回答

1

我只是猜測這裏,但這可能與路徑中的長文件名和/或空格有關

1)修改您的makefile,以便在執行失敗命令(set > d:\env.txt & echo CD=%CD% >> d:\env.txt)之前立即將當前環境保存到文件中。然後運行它(直接和通過程序)並比較良好運行和不良運行的環境。

2)使用Sysinternals的filemon,在兩種情況下捕獲磁盤訪問的日誌(這些日誌將會非常龐大​​,儘管您可以取消選中除Open外的所有內容以減小大小)。再次,比較並檢查線索...

3)嘗試安裝所有涉及符合8.3方案的路徑。

+0

創建輸入管道來解決。對於1)解決方案,唯一的區別是程序使用Boost :: Process設置的環境變量。 – Vargas 2010-07-05 12:05:33

0

此錯誤與C++本身無關。當您的構建腳本打開太多文件時(超過DOS命令處理器環境中的定義),會發生這種情況。要解決此問題,請嘗試將值爲files的變量設置爲253.對於Windows XP,此變量在文件%WINDIR%\system32\config.nt中定義。

files=253 
+0

我已經嘗試將其設置爲更高的值,但它也不起作用,我將該值設置爲253並保持不變。 – Vargas 2010-07-05 12:03:32

0

看來它是Borland C++工具中已知的bug。下面是描述和可能的解決方法針對此問題:

Problem: Some static Lib projects will not link correctly when compiled. You might see something like this :

J:\Borland\CBUILD~1\bin\..\BIN\TLib /u debug\jpegD.lib @[email protected]@@ 
DOS-reported error: Bad file number 
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation 
opening '[email protected]@@' 

** error 1 ** deleting debug\jpegD.lib 
MAKE failed, returned : 1 

Workaround : In some cases (where the "Bad file number" error is seen) it may be possible to work around this by specifying -tDEFLIB.BMK in the BPR2MAKE Options field, and Turning off the "Capture Make Output" option.

我沒有測試過,但我希望幫助。

+0

我也試過這個,它沒有工作。 – Vargas 2010-07-05 18:35:35