2010-07-02 56 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