Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

/Zl switch does not work

levicki
Valued Contributor I
513 Views

I compile a project with /Zl switch added to the command line and in the resulting obj/lib files I still get strings:

-defaultlib:"uuid.lib" -defaultlib:"uuid.lib" -defaultlib:"libirc"

That's right, uuid.lib is listed twice for each object file as if once wouldn't be enough.

Why is the /Zl switch interpreted half-way only? When I say "ignore default libraries" I mean all of them!

0 Kudos
8 Replies
JenniferJ
Moderator
513 Views
VC2005 cl.exe has the same behavior. You can use /nodefaultlib at link that will ignore all the default libs include uuid.lib/libirc.
0 Kudos
levicki
Valued Contributor I
513 Views

Jennifer, I am sorry but MSVC 2005 cl.exe doing the same is a poor excuse unless you meant to say that it is a compatibility hack.

I am still curious why does the compiler emit uuid.lib twice? Isn't once enough?

I have seen duplicate library names emitted into object files several times with ICC, sometimes just one name, sometimes all library names are repeated. Fixing it (if it is an error on compiler side) could perhaps improve compile and link speed a bit for those extra large projects with thousands of files.

0 Kudos
JenniferJ
Moderator
513 Views

ICL has to match CL on this in order to do mix-match linking.

After talking with experts on this, the uuid.lib is not inserted by the compiler. It's likely in the VC header files twice like "#pragma comment(lib:uuid.lib)". so it's in .obj twice. As my testcase, it has "#include ". It brings the uuid.lib twices in the .obj file.

0 Kudos
levicki
Valued Contributor I
513 Views

Ok, we are getting somewhere.

Could you please ask the experts why the compiler does not coalesce multiple pragmas which reference the same library file?

I have tested it and Microsoft compiler does the same but I want to know why. Is it a bug which somehow got "copied" to Intel compiler or is it really neccessary to have duplicate references in order for the linker to work?

0 Kudos
levicki
Valued Contributor I
513 Views

Any update on this?

0 Kudos
Brandon_H_Intel
Employee
513 Views

Hi Igor,

It's not necessary to have the duplicates, and certainly our front end could implement a logic to coalesce these #pragma comment statements, but is there any problem with having the multiple -defaultlib references?

0 Kudos
levicki
Valued Contributor I
513 Views

Not a real problem as such but:

  • It looks sloppy for a product labeled as "Professional"
  • It is unneccessary waste of disk space
  • Coalescing may improve build times for large projects

I would certainly like to see it fixed even though it is a minor issue.

0 Kudos
Brandon_H_Intel
Employee
513 Views
I would submit a Premier Support issue then, but I would not expect this to be addressed quickly. It's hard to find a case where the disk space issue would be compelling enough to be a concern, and I would suspect that the fix itself might actually hinder build times if anything, due to the fact that the front end would now have to keep track of which #pragma comment libs were processed, and then do a compare each time it processes a new #pragma comment. Again, though, that wouldn't be significant in most if not all cases. I agree that it does look sloppy.
0 Kudos
Reply