I'm trying to create static libs with MSVC. My project used to use the 'lib' command and supply the appropriate object files. But now, it uses this command:
which yields this error:
D:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\StdOle2.Tlb : fatal error LNK1136: invalid or corrupt file
Is there a way to force the explicit call to lib?
Lib is being called, but it appears that one of the fileset of the <cc> task contains StdOle2.tlb. Any extension that cc does not identify as either a source file or a header file is automatically passed to the linker or librarian. In this case, something is selecting StdOle2.tlb which the librarian is not able to handle. You could also inspect the content of SybLicense.rsp to see if there are any other inappropriate files.
Looking at the .rsp file, I see this is the same problem I had last week w/ the <libset> task including all files in the specified directory instead of those specified. The only difference is that now a .rsp file is being generated whereas last week the files were being listed on the command line explicitly.
I will attach my .rsp file and a file containing my <cc> task in the bug entry.
I've reopened the bug. There isn't an obvious error in the cpptask code, so it might be a bug with Ant's Fileset that is ued to generate the matching files or some problem in setting up that Fileset.
Could you specify what version of Ant your are using and then try a different version of Ant to see if the problem still occurs. Also, specify what Java VM you are using.
Ideally, I would like to have a zip file that I can extract and then expect to have the problem manifest.
When I encountered this problem last week, my temporary solution was to specify libraries via a <fileset> element instead of a <[sys]libset> one. This worked. Unfortunately, a fileset needs to know the full filename (it doesn't prepend 'lib' or append the proper suffix for the given host). That's a problem for me as my build is running on different targets. Also, only the <libset> and <syslibset> elements are pulling in all files. I have other files in the 'src' directory besides .cpp and .h (where the <fileset> is referencing) but they aren't including in the compile or link line. So I'm inclined to think <fileset> is performing properly.
I also tried specifying a single file outright in the fileset (to eliminate wildcards), but it didn't help.
Not sure if I mentioned it, but the system works properly on Linux (w/ GCC) and it uses the same files (SAMBA share).
I'm using Ant v. 1.6.1. Unfortunately, I can't switch to a different version of Ant very easily as I'm using some 1.6.1-specific features/fixes.
I'm using Sun's JVM v. 1.4.2_03.
As you can see from the <cc> task, my system depends on a few external packages which are fairly large. Since the error is in the link step, the files would have to compile successfully first. So it won't be easy to create a stripped down version of the problem. I'll see what I can do by tomorrow.
By the way, I attached the files to this bug entry:
Just a clarrification: in my initial post when I wrote, "My project used to use the 'lib' command..." I was referring to <cc> task's behavior. It used to list the object files explicitly on the command line; it doesn't anymore.
I see why a .rsp file is being used--there are many libraries being specified to lib. If I remove the <syslibset> element that specifies the .NET\VC7\PlatformSDK\lib directory, there are fewer libraries and object files. In this case, they are explicitly specified on the command line to lib--no .rsp file is used.