Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor II
3 Views

Odd behaviour "Rebuild" - one object file missing at first run

Hello,

we are experiencing a very odd behaviour with Visual Studio (2015) and Intel Fortran (2017): we use the netCDF library in our programs and it turns out that the first (!) time we do a rebuild of one of the programs in the solution an object file from the Fortran interface library for netCDF is missing - typeSizes.obj, whereas the corresponding .mod is there. According to the build log, it was correctly compiled. Of course it means that at the end things cannot be properly built.

But if we rebuild it again, the object file is actually present and the whole build succeeds.

While I state here that it has to do with the netCDF library and its Fortran interface, I cannot be sure - it is just that it happens with a source file from that library. I cannot remember ever seeing it with any other program or programs though.

The phenomenon is repeatable: every time I start Visual Studio and rebuild one of the programs in the solution, the first rebuild fails and all subsequent ones do the job properly. It is also very odd that only that one object file (but not the .mod file) is missing.

Does anybody have a suggestion as to how to solve this? It is an annoyance, not impossible to get around, but still, an annoyance.

 

 

0 Kudos
5 Replies
Highlighted
3 Views

Let's investigate:

Let's investigate:

Do a clean, then, do a full build (we expect an error)

Inspect the folder(s) where you have targeted the .mod and .obj files.

Two situations may present itself: a) only .mod is present, b) both .mod and .obj are present.

If b) then possibly your Anti-Virus intercepted the .obj creation and is inspecting it during the link phase. Look at the timestamps to see if significantly different.

If a), write down the time stamp of the .mod file. Then perform your second build, examine the time stamps of both .mod and .obj to see if both got rebuilt.

Does this occur with and without IPO enabled?

I've seen this occur in older versions of IVF when you update a version of IVF and use formerly created Solutions/Projects. The fix for this is to copy your existing solutions and projects into a different place, delete the solutions and project, then create new ones. Keeping the old ones permit you to perform a side-by-side settings comparison for getting your options set properly.

Additional note, if your modules have circular dependencies this behavior can also happen.

Jim Dempsey

0 Kudos
Highlighted
Valued Contributor II
3 Views

Hi Jim,

Hi Jim,

thanks for the prompt reply. I tried this: Clean, Build ... and got a satisfactory build result. The files typeSizes.obj and typeSizes.mod have the same timestamp (I have checked it down to the second).

Now I have done a Rebuild (after the Build was completed) and I see a number of files are left over - three .obj files and two .mod files. Others in that directory (x64\Release) have been removed.

We do not use IPO and most if not all options are set to default.

Hm, the one thing that is different with this project than all the others in this solution is that the directory in question contains both a .vfproj and a .vcxproj file ... your remark about old solutions/projects triggered me to contemplate that as a reason.

0 Kudos
Highlighted
3 Views

>>.vcxproj is a C/C++ Project

>>.vcxproj is a C/C++ Project type.

I generally use (select) Create New (sub-)Folder for Project as opposed to placing the Projects within the same folder as the Solution. IIF you have selected to keep the Projects in the same folder as the Solution (and co-resident with the IVF Project), and if there are dependencies between  the C/C++ and IVF projects then there may be and issue (although I cannot state this for a fact).

An additional thing to check is the Project dependencies of each project in your solution. For each project: Right-Click on Project in the Solution explorer and select Project Dependencies. Then check the boxes according to what you know are the proper dependencies.

Jim Dempsey

0 Kudos
Highlighted
Valued Contributor III
3 Views

Quote:Arjen Markus wrote:

Arjen Markus wrote:

.. Does anybody have a suggestion as to how to solve this? It is an annoyance, not impossible to get around, but still, an annoyance.

You possibly have a Visual Studio solution with N number of Fortran projects (vfproj) and M other projects (e.g., C/C++ vcxproj, etc.).  An option for you to try is:

  • Make a copy of your solution and the projects in some other folder,
  • In this copy solution, strip down the projects with simple "Hello World!" type of subprograms and functions, cutting the projects down to single source files, if possible.  Make sure to retain all the solution and project settings and dependencies,  But delete all intermediate folders (e.g., Debug/Release) and all the files created by the toolchains in this copy folder e.g., *.user, *,mod, *.obj, etc.
  • See if the underlying issue persists; if yes, it may be easier now to investigate the root cause.  If it's still unsolvable, post a zip of the folder here on this thread,
  • If stripped down case works as expected, build back up the projects step-by-step in an order that appears in your assessment to be simplest-to-the-most-involved along with independent-projects first and the dependent ones later on.  Check at each step whether the original issue resurfaces
  • Take a close look at the point where the issue pops up again - you will likely have the clue(s) to the problem at this stage to resolve the issue.
  • If you are able to fully build back the solution and yet not encounter the original issue, chances are something got corrupted in your initial solution directory that has been rectified by this exercise - note this has happened with other users with VS projects and multilanguage project dependences. Your new folder then holds your sanitized solution!
0 Kudos
Highlighted
Valued Contributor II
3 Views

Thanks for all the answers.

Thanks for all the answers. They have given me enough ideas to try out.

0 Kudos