View Issue Details

IDProjectCategoryView StatusLast Update
0031680CommunityOCCT:Configurationpublic2020-12-02 17:13
ReporterBenjaminBihler Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformMingw-w64OSWindows 
Product Version7.4.0 
Target Version7.5.0Fixed in Version7.5.0 
Summary0031680: Configuration - Compilation Fails With G++ 10.1, LD 2.34 and Link-Time Optimization
DescriptionWhen building OCCT with g++ 10.1, ld 2.34 and link-time optimization (-flto) using Mingw-w64 on Windows 10, I get the following error:

C:/mingw-w64-10.1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: LDOM_OSStream.cxx.obj (symbol from plugin):(.gnu.linkonce.t._ZTV13LDOM_OSStream[_ZTV13LDOM_OSStream]+0x0): multiple definition of `VTT for LDOM_OSStream'; PCDM_ReadWriter.cxx.obj (symbol from plugin):(.gnu.linkonce.t._ZTV13LDOM_OSStream[_ZTC13LDOM_OSStream0_So]+0x0): first defined here
C:/mingw-w64-10.1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: LDOM_OSStream.cxx.obj (symbol from plugin):(.gnu.linkonce.t._ZTV13LDOM_OSStream[_ZTV13LDOM_OSStream]+0x0): multiple definition of `vtable for LDOM_OSStream'; PCDM_ReadWriter.cxx.obj (symbol from plugin):(.gnu.linkonce.t._ZTV13LDOM_OSStream[_ZTC13LDOM_OSStream0_So]+0x0): first defined here
C:/mingw-w64-10.1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: LDOM_OSStream.cxx.obj (symbol from plugin):(.gnu.linkonce.t._ZTV13LDOM_OSStream[_ZTV13LDOM_OSStream]+0x0): multiple definition of `construction vtable for std::ostream-in-LDOM_OSStream'; PCDM_ReadWriter.cxx.obj (symbol from plugin):(.gnu.linkonce.t._ZTV13LDOM_OSStream[_ZTC13LDOM_OSStream0_So]+0x0): first defined here


I have found more "multiple definition" errors with this tool combination, but I do not fully understand the reason. See https://stackoverflow.com/questions/62150048/why-does-g-10-1-complain-about-a-named-lambda-in-a-header-file-and-others-do-n for another example. These errors haven't been there up to g++ 9.2 (I do not know the corresponding ld version number anymore), but appear here from g++ 10.1 on.

This post: https://stackoverflow.com/a/57504289/2492801
explains how to force vtable generation. According to my understanding the vtable of LDOM_OSStream is generated in more than one compilation unit, since that class does not have a non-inline virtual function.

Following the cited post, I propose to add a non-inline virtual destructor. Indeed this solves the compilation problems here.
Steps To ReproduceNot required
TagsNo tags attached.
Test case numberNot required

Activities

git

2020-07-21 14:38

administrator   ~0093228

Branch CR31680 has been created by BenjaminBihler.

SHA-1: ca5ec1c316c7618a6ad46cd0f60662f7b3bfa48c


Detailed log of new commits:

Author: Benjamin Bihler
Date: Tue Jul 21 13:37:03 2020 +0200

    0031680: Configuration - Compilation Fails With G++ 10.1, LD 2.34 and Link-Time Optimization
    
    Added a non-inline empty virtual destructor to LDOM_OSStream to force vtable generation in one
    translation unit only.

bugmaster

2020-07-25 13:21

administrator   ~0093313

Combination -
OCCT branch : IR-2020-07-24
master SHA - 4c7a3faef5f292475c23ee615ad49d57fc039b58
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2020-07-24 SHA - be95aa91db3bd344c872901349e58022d3c687fc
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17271.39000000011 / 17230.04000000007 [+0.24%]
Products
Total CPU difference: 800.6699999999917 / 791.7399999999936 [+1.13%]
Windows-64-VC14:
OCCT
Total CPU difference: 18742.140625 / 18745.390625 [-0.02%]
Products
Total CPU difference: 1329.234375 / 1321.390625 [+0.59%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2020-07-25 14:02

administrator   ~0093336

Branch CR31680 has been deleted by inv.

SHA-1: ca5ec1c316c7618a6ad46cd0f60662f7b3bfa48c

Related Changesets

occt: master 6531dfea

2020-07-21 11:37:03

BenjaminBihler


Committer: bugmaster Details Diff
0031680: Configuration - Compilation Fails With G++ 10.1, LD 2.34 and Link-Time Optimization

Added a non-inline empty virtual destructor to LDOM_OSStream to force vtable generation in one
translation unit only.
Affected Issues
0031680
mod - src/LDOM/LDOM_OSStream.cxx Diff File
mod - src/LDOM/LDOM_OSStream.hxx Diff File

Issue History

Date Modified Username Field Change
2020-07-21 14:32 BenjaminBihler New Issue
2020-07-21 14:32 BenjaminBihler Assigned To => BenjaminBihler
2020-07-21 14:38 git Note Added: 0093228
2020-07-21 14:38 BenjaminBihler Assigned To BenjaminBihler => bugmaster
2020-07-21 14:38 BenjaminBihler Status new => resolved
2020-07-21 14:38 BenjaminBihler Steps to Reproduce Updated
2020-07-21 15:14 kgv Status resolved => reviewed
2020-07-25 13:21 bugmaster Note Added: 0093313
2020-07-25 13:21 bugmaster Status reviewed => tested
2020-07-25 13:29 bugmaster Test case number => Not required
2020-07-25 13:57 bugmaster Changeset attached => occt master 6531dfea
2020-07-25 13:57 bugmaster Status tested => verified
2020-07-25 13:57 bugmaster Resolution open => fixed
2020-07-25 14:02 git Note Added: 0093336
2020-12-02 16:43 emo Fixed in Version => 7.5.0
2020-12-02 17:13 emo Status verified => closed