Problem 2160

Summary: Geant4 10.5.1 compilation in Debug fails due to too many objects
Product: Geant4 Reporter: David Sarria <david.sarria.89>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED LATER    
Severity: normal CC: shangjiaxuan
Priority: P4    
Version: 10.5   
Hardware: PC   
OS: Windows   
Attachments: compilation log , with failure on line 4098

Description David Sarria 2019-04-23 11:44:27 CEST
Created attachment 569 [details]
compilation log , with failure on line 4098

Dear colleagues,

Trying to compile Geant4 with Qt, OpenGL, XERSES-C, in Debug mode with Visual Studio 2015 (v14) on Windows fails. The compilation fails in Debug mode, but everything is fine in Release or RelWithDebInfo modes. The error is:

"LINK : fatal error LNK1189: library limit of 65535 objects exceeded [C:\Users\testeur\Desktop\windows-geant4-installati on-script\build\source\processes\G4processes.vcxproj]"

Apparently, this issue is already known but I did not find a thread here (maybe I did not search carefully enough). See : http://hypernews.slac.stanford.edu/HyperNews/geant4/get/installconfig/1778.html

I attached the full compilation log (error is displayed line 4098)

I would also like to avoid using "RelWithDebInfo" mode because it can be very tricky to debug in some cases (since it is modifying/optimizing the code). And obviously the Release mode does not provide debug capabilities that are very helpful for development.

Thanks in advance for the help.

-David
Comment 1 David Sarria 2019-04-23 11:49:50 CEST
Comment on attachment 569 [details]
compilation log , with failure on line 4098

First line of the attached file indicates "Compiling and Installing GEANT4 10_04_p03" but it is actually 10_05_p01. It is because I tried with 10_04_03 also before (and it gives the same problem) and I forgot to update it.
Comment 2 Ben Morgan 2019-04-23 13:35:14 CEST
Unfortunately there is no workaround for this at the present time. 2019's workplan (https://geant4.web.cern.ch/node/1799) includes a task on modularising libraries which should fix this. That would only be from 10.6 beta (June) however.
Comment 3 David Sarria 2019-04-23 17:29:29 CEST
OK, thanks for the quick reply.
Good luck to the team, and congratulation for the very valuable work that has already been done.

-David
Comment 4 shangjiaxuan 2023-07-20 12:38:35 CEST
A hack to work around this is to specify /Ob1 instead of /Od in cmake cxx flags. This removes most header-inline functions exported, and makes the symbol count much smaller. Of course, inlining functions can interfere with debugging.