Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915226 - media-sound/audacity-3.3.3 fails to compile (lto): ffmpeg-2.3.6-single-header.h:2847:16: error: type ‘struct AVCodecContext’ violates the C++ One Definition Rule [-Werror=odr]
Summary: media-sound/audacity-3.3.3 fails to compile (lto): ffmpeg-2.3.6-single-header...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Professional Audio Applications Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2023-10-06 03:44 UTC by ppw0
Modified: 2024-05-05 04:35 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (media-sound:audacity-3.3.3:20231006-032945.log.gz,25.15 KB, application/gzip)
2023-10-06 03:44 UTC, ppw0
Details
emerge --info (emerge_info.log,7.40 KB, text/x-log)
2023-10-06 03:45 UTC, ppw0
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ppw0 2023-10-06 03:44:06 UTC
Created attachment 872211 [details]
build log

In a stricter lto environment, media-sound/audacity-3.3.3 will fail to compile with the following errors:
```
/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/55/../../ffmpeg-2.3.6-single-header.h:2847:16: error: type ‘struct AVCodecContext’ violates the C++ One Definition Rule [-Werror=odr]
 2847 | typedef struct AVCodecContext {
      |                ^
/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/57/../../ffmpeg-3.4.8-single-header.h:2680:16: note: a different type is defined in another translation unit
 2680 | typedef struct AVCodecContext {
      |                ^
/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/55/../../ffmpeg-2.3.6-single-header.h:2869:9: note: the first difference of corresponding definitions is field ‘bit_rate’
 2869 |     int bit_rate;
      |         ^
/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/57/../../ffmpeg-3.4.8-single-header.h:2703:13: note: a field of same name but different type is defined in another translation unit
 2703 |     int64_t bit_rate;
      |             ^

.
.
.

/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/55/../../ffmpeg-2.3.6-single-header.h:4330:6: error: type ‘AVStreamParseType’ violates the C++ One Definition Rule [-Werror=odr]
 4330 | enum AVStreamParseType {
      |      ^
/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/58/../../ffmpeg-4.2.4-single-header.h:4593:6: note: an enum with different value name is defined in another translation unit
 4593 | enum AVStreamParseType {
      |      ^
/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/55/../../ffmpeg-2.3.6-single-header.h:4336:5: note: name ‘AVSTREAM_PARSE_FULL_RAW’ is defined to 1463898624 while another translation unit defines it as 5
 4336 |     AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'),
      |     ^
/var/tmp/portage/media-sound/audacity-3.3.3/work/audacity-Audacity-3.3.3/libraries/lib-ffmpeg-support/impl/avcodec/58/../../ffmpeg-4.2.4-single-header.h:4599:5: note: mismatching definition
 4599 |     AVSTREAM_PARSE_FULL_RAW,
      |     ^
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.

(stricter lto means with -flto -Werror=odr -Werror=strict-aliasing -Werror=lto-type-mismatch enabled)
Comment 1 ppw0 2023-10-06 03:45:02 UTC
Created attachment 872212 [details]
emerge --info
Comment 2 Larry the Git Cow gentoo-dev 2024-03-05 04:48:43 UTC
The bug has been closed via the following commit(s):

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

commit 54238035c9abd9b278e2fd14312e893922c3be5f
Author:     Eli Schwartz <eschwartz93@gmail.com>
AuthorDate: 2024-03-05 00:49:58 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-05 04:47:49 +0000

    media-sound/audacity: mark as LTO-unsafe, strict-aliasing unsafe
    
    Bug report says ODR violations, but I could not reproduce since I hit
    strict-aliasing issues first. I'm assuming both are an issue, but on the
    other hand either one is a good reason to turn off LTO.
    
    Closes: https://bugs.gentoo.org/915226
    Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 media-sound/audacity/audacity-3.3.3.ebuild | 9 ++++++++-
 media-sound/audacity/audacity-9999.ebuild  | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)