Issue on Windows x64 Debug linkage

76 views
Skip to first unread message

Tulio Ligneul

unread,
Jul 27, 2016, 8:49:15 AM7/27/16
to deal.II User Group
Hi,
I have been trying to compile the examples using Visual Studio Community 2015 targeting x64 platform.
If I try to compile the 'step-1' example in Release mode, it finishes in just a few seconds, but if i try to compile it in Debug mode it seems the linker hangs and never ends.
Is the linking time supposed to be really long, even for such a simple example? If not, has anyone faced this issue and came up with a solution?
I'm attaching the linker log to this message.
Regards,
Tulio
log.txt

Wolfgang Bangerth

unread,
Jul 27, 2016, 12:04:25 PM7/27/16
to dea...@googlegroups.com
On 07/27/2016 06:49 AM, Tulio Ligneul wrote:
>
> I have been trying to compile the examples using Visual Studio Community 2015
> targeting x64 platform.
> If I try to compile the 'step-1' example in Release mode, it finishes in just
> a few seconds, but if i try to compile it in Debug mode it seems the linker
> hangs and never ends.
> Is the linking time supposed to be really long, even for such a simple
> example? If not, has anyone faced this issue and came up with a solution?

Tulio -- it's certainly not the intention that it takes that long. We're not
Windows experts, so we may be doing something wrong. One thing that already
sticks out to me is that you seem to be linking against a static library,
rather than a .dll, right? I don't know how we determine to use one or the
other, but .dll libraries should be much faster.

The second part is that these libraries are *large*. Can you check how large
they are on your system? I suspect that the debug version is much larger
because of all of the debug symbols, so would expect things to take a long
time to link. But that's really the best I can offer from afar...

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@math.tamu.edu
www: http://www.math.tamu.edu/~bangerth/

Matthias Maier

unread,
Jul 27, 2016, 12:31:53 PM7/27/16
to dea...@googlegroups.com
The last time I checked (statically) linking an executable against the
debug or release version was on the order of several minutes.

We currently do not support shared libraries (dlls) on Windows. This
might change with [1] though.

[1] https://github.com/dealii/dealii/pull/2807

Tulio Ligneul

unread,
Jul 27, 2016, 10:05:06 PM7/27/16
to deal.II User Group
In my system, deal_II.lib is about 400MB and deal_II.g.lib is almost 2GB.

Maybe the issue is somehow related to these reports:
https://www.gittprogram.com/question/1740272_x64-linker-hanging.html

I think i'll wait for the patch allowing to build deal.II as a dynamic library.  I usually develop in Ubuntu but i also need my program to run on Windows. For now, compiling only in Release mode is good enough.

Regards,

Tulio

Wolfgang Bangerth

unread,
Jul 28, 2016, 1:03:07 PM7/28/16
to dea...@googlegroups.com
On 07/27/2016 08:05 PM, Tulio Ligneul wrote:
> In my system, deal_II.lib is about 400MB and deal_II.g.lib is almost 2GB.

How much memory/RAM do you have in your system? I would not be surprised if
you needed 10GB to link a 2GB library. If you don't have that much, the
operating system will start to swap out data and then it can take forever.
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__connect.microsoft.com_VisualStudio_feedback_details_995447_linker-2Dis-2Dhanging-2Dwhile-2Dlinking-2Dsome-2Dproject-2Din-2Ddebug-2Dx64-2Dconfiguration&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=bn1clvQAiDQrfAC4yKbN0PlSr7RWRs-U3WJ0zRBB2qM&m=c_xwp0Rh13-GKNF7fVcUZoqlcZj2VZXblnm-2ZUnrhw&s=reRA7jaZJcHsEqlwnTZVrPH_wspoTOncSAPUu52tDiM&e=>
>
> https://www.gittprogram.com/question/1740272_x64-linker-hanging.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.gittprogram.com_question_1740272-5Fx64-2Dlinker-2Dhanging.html&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=bn1clvQAiDQrfAC4yKbN0PlSr7RWRs-U3WJ0zRBB2qM&m=c_xwp0Rh13-GKNF7fVcUZoqlcZj2VZXblnm-2ZUnrhw&s=qm7zUzMXCYYVlnMjutGub8L_miInfoGNbU39xKQQIXc&e=>
>
> http://stackoverflow.com/questions/23494142/ms-c-2012-linker-hangs-but-only-in-debug-mode-x64
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__stackoverflow.com_questions_23494142_ms-2Dc-2D2012-2Dlinker-2Dhangs-2Dbut-2Donly-2Din-2Ddebug-2Dmode-2Dx64&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=bn1clvQAiDQrfAC4yKbN0PlSr7RWRs-U3WJ0zRBB2qM&m=c_xwp0Rh13-GKNF7fVcUZoqlcZj2VZXblnm-2ZUnrhw&s=ht7u_cKJxrXj5gSPwhkpJq9p8ZVyUHqVV7k71iMZULM&e=>

Hard to tell whether these are related.


> I think i'll wait for the patch allowing to build deal.II as a dynamic
> library. I usually develop in Ubuntu but i also need my program to run on
> Windows. For now, compiling only in Release mode is good enough.

OK, good to know that you have an alternative way to work.

Tulio Ligneul

unread,
Nov 19, 2016, 8:37:49 AM11/19/16
to deal.II User Group, bang...@tamu.edu
Hi,

I just would like to let you guys know that i have solved my problem.

Previously, the linker was hanging when i tried to build an example and didn't even give any error message. After a installed a more recent version of visual studio community 2015, it started giving an error message saying that it couldn't find deal_II.g.lib, even though the path was correct. After some digging, i found out that VS was using the 32-bit toolset targeting 64-bit. 

So, to make VS use the 64 toolset, one can set the environment variable PreferredToolArchitecture to x64:
Or use a small hack-around in CMake:

Regards,

Túlio 

Jason McIntosh

unread,
Nov 26, 2016, 11:52:49 AM11/26/16
to deal.II User Group, bang...@tamu.edu
Hi Túlio,

What exactly did you do in VisualStudio?  Did you edit your project file outside of the IDE or did you make a change in your IDE or did you edit a Windows environment variable?

Jason

Tulio Ligneul

unread,
Nov 28, 2016, 8:15:00 AM11/28/16
to deal.II User Group, bang...@tamu.edu
I used both methods that i said earlier and both worked.

But to avoid having to set a variable inside the visual studio command prompt and opening the project from there, at the end, i prefer to use the CMake solution in https://github.com/preillyme/hiphop-php/blob/master/CMake/VisualStudioToolset.cmake

You just have to put:

if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 14 2015 Win64")
     set(CMAKE_GENERATOR_TOOLSET "v140</PlatformToolset><PreferredToolArchitecture>x64</PreferredToolArchitecture><PlatformToolset>v140")
endif()

before your project command. It will force the visual studio project to use the x64 architecture. Note that this only works for the generator "Visual Studio 14 2015 Win64". If you are using a different one you just have to change the code accordingly.

Regards,

Túlio
Reply all
Reply to author
Forward
0 new messages