Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 916965

Summary: games-strategy/ja2-stracciatella-0.20.0 fails to compile (lto): Strategic_Pathing.cc:30:8: error: type ‘struct path_t’ violates the C++ One Definition Rule [-Werror=odr]
Product: Gentoo Linux Reporter: ppw0
Component: Current packagesAssignee: Misanthropos <misanthropos>
Status: RESOLVED FIXED    
Severity: normal CC: eschwartz93, games, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/ja2-stracciatella/ja2-stracciatella/issues/1963
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 618550    
Attachments: build log
emerge --info

Description ppw0 2023-11-06 17:24:27 UTC
Created attachment 874155 [details]
build log

In a stricter lto environment, ja2-stracciatella-0.20.0 will fail to compile with the following errors:
```
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Strategic/Strategic_Pathing.cc:30:8: error: type ‘struct path_t’ violates the C++ One Definition Rule [-Werror=odr]
   30 | struct path_t
      |        ^
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Tactical/PathAI.cc:85:8: note: a different type is defined in another translation unit
   85 | struct path_t
      |        ^
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Strategic/Strategic_Pathing.cc:32:15: note: the first difference of corresponding definitions is field ‘nextLink’
   32 |         INT16 nextLink;           //2
      |               ^
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Tactical/PathAI.cc:87:17: note: a field with different name is defined in another translation unit
   87 |         INT32   iLocation; //4
      |                 ^
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Strategic/Strategic_Pathing.cc:40:8: error: type ‘struct trail_t’ violates the C++ One Definition Rule [-Werror=odr]
   40 | struct trail_t
      |        ^
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Tactical/PathAI.cc:98:8: note: a different type is defined in another translation unit
   98 | struct trail_t
      |        ^
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Strategic/Strategic_Pathing.cc:43:15: note: the first difference of corresponding definitions is field ‘diStratDelta’
   43 |         short diStratDelta;
      |               ^
/var/tmp/portage/games-strategy/ja2-stracciatella-0.20.0/work/ja2-stracciatella-0.20.0/src/game/Tactical/PathAI.cc:101:15: note: a field with different name is defined in another translation unit
  101 |         UINT8 stepDir;
      |               ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
```

Attaching logs.
Comment 1 ppw0 2023-11-06 17:25:30 UTC
Created attachment 874156 [details]
emerge --info
Comment 2 Larry the Git Cow gentoo-dev 2024-03-29 18:47:42 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aaaf2b02085fe368746241561c29050eca562882

commit aaaf2b02085fe368746241561c29050eca562882
Author:     Eli Schwartz <eschwartz93@gmail.com>
AuthorDate: 2024-03-29 15:32:28 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-29 18:45:16 +0000

    games-strategy/ja2-stracciatella: mark as LTO-unsafe
    
    Closes: https://bugs.gentoo.org/916965
    Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 games-strategy/ja2-stracciatella/ja2-stracciatella-0.21.0.ebuild | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)