Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 861731 - [guru] dev-libs/mtxclient-0.8.0 fails to compile (lto): <artificial>:(.text+0x5d3a): undefined reference to
Summary: [guru] dev-libs/mtxclient-0.8.0 fails to compile (lto): <artificial>:(.text+0...
Status: RESOLVED FIXED
Alias: None
Product: GURU
Classification: Unclassified
Component: Package issues (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: tastytea
URL: https://github.com/Nheko-Reborn/mtxcl...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-28 14:10 UTC by Agostino Sarubbo
Modified: 2023-02-23 09:24 UTC (History)
1 user (show)

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


Attachments
build.log (build.log,143.10 KB, text/plain)
2022-07-28 14:10 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-07-28 14:10:23 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-libs/mtxclient-0.8.0 fails to compile (lto).
Discovered on: amd64 (internal ref: guru_tinderbox)

NOTE:
This machine uses lto with CFLAGS=-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

Here is a bit of explanation:

-Werror=lto-type-mismatch:
User to find possible runtime issues in packages. It likely means the package is unsafe to build & use with LTO.
For projects using the same identifier but with different types across different files, they must be fixed to be consistent across the codebase.

-Werror=odr:
Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO. C++ code must comply with the One Definition Rule (ODR) - see https://en.cppreference.com/w/cpp/language/definition#One_Definition_Rule.

-Werror=strict-aliasing:
Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO.

Workarounds:
- If upstream is friendly and still active, file a bug upstream. For emulators, codecs, games, or multimedia packages, it may be worth just applying a workaround instead, as upstreams sometimes aren't receptive to these bugs (VALID FOR ALL).
- Use the new 'filter-lto' from flag-o-matic.eclass as it's likely to be unsafe with LTO (VALID FOR lto-type-mismatch - odr).
- Fix it yourself if interested, of course (VALID FOR ALL).
- Append-flags -fno-strict-aliasing (VALID FOR strict-aliasing).
- Use memcpy() but a union is sometimes suitable too (VALID FOR strict-aliasing).
- -fstrict-aliasing is implied by -O2, so this must be addressed in some form (VALID FOR strict-aliasing).

See also: https://marc.info/?l=gentoo-dev&m=165639574126280&w=2
Comment 1 Agostino Sarubbo gentoo-dev 2022-07-28 14:10:25 UTC
Created attachment 795278 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2022-07-28 14:10:26 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:


/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x3024): undefined reference to `void mtx::events::to_json<mtx::events::msg::KeyVerificationRequest>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&, mtx::events::Event<mtx::events::msg::KeyVerificationRequest> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x4e49): undefined reference to `void mtx::events::to_json<mtx::events::msg::KeyVerificationAccept>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&, mtx::events::Event<mtx::events::msg::KeyVerificationAccept> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x5672): undefined reference to `void mtx::events::to_json<mtx::events::msg::KeyVerificationKey>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&, mtx::events::Event<mtx::events::msg::KeyVerificationKey> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x5ea5): undefined reference to `void mtx::events::to_json<mtx::events::msg::Encrypted>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&, mtx::events::RoomEvent<mtx::events::msg::Encrypted> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x6085): undefined reference to `void mtx::events::to_json<mtx::events::msg::KeyVerificationMac>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&, mtx::events::Event<mtx::events::msg::KeyVerificationMac> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x6388): undefined reference to `void mtx::events::to_json<mtx::events::msg::Encrypted>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&, mtx::events::RoomEvent<mtx::events::msg::Encrypted> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x7688): undefined reference to `void mtx::events::to_json<mtx::events::msg::KeyVerificationCancel>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&, mtx::events::Event<mtx::events::msg::KeyVerificationCancel> const&)'
<artificial>:(.text+0x2c35): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationRequest>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationRequest>&)'
<artificial>:(.text+0x3f30): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationStart>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationStart>&)'
<artificial>:(.text+0x4a13): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationAccept>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationAccept>&)'
<artificial>:(.text+0x54f9): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationKey>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationKey>&)'
<artificial>:(.text+0x5c3a): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationMac>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationMac>&)'
<artificial>:(.text+0x5d3a): undefined reference to `void mtx::events::from_json<mtx::events::msg::Encrypted>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::RoomEvent<mtx::events::msg::Encrypted>&)'
<artificial>:(.text+0x6725): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationReady>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationReady>&)'
<artificial>:(.text+0x6f42): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationDone>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationDone>&)'
<artificial>:(.text+0x748f): undefined reference to `void mtx::events::from_json<mtx::events::msg::KeyVerificationCancel>(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, mtx::events::Event<mtx::events::msg::KeyVerificationCancel>&)'
FAILED: events 
FAILED: messages 
collect2: error: ld returned 1 exit status
Comment 3 tastytea 2022-08-19 15:45:36 UTC
Notified upstream, workaround on the way.
Comment 4 Larry the Git Cow gentoo-dev 2022-08-24 15:52:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0e70dbcc07413a6f106b7462c277ce919db08099

commit 0e70dbcc07413a6f106b7462c277ce919db08099
Author:     Ronny (tastytea) Gutbrod <gentoo@tastytea.de>
AuthorDate: 2022-08-19 15:46:33 +0000
Commit:     Ronny (tastytea) Gutbrod <gentoo@tastytea.de>
CommitDate: 2022-08-19 15:46:33 +0000

    dev-libs/mtxclient: work around LTO build failure
    
    Closes: https://bugs.gentoo.org/861731
    Signed-off-by: Ronny (tastytea) Gutbrod <gentoo@tastytea.de>

 dev-libs/mtxclient/mtxclient-0.8.0.ebuild | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Comment 5 Larry the Git Cow gentoo-dev 2023-02-23 09:24:50 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=84bc38bdc07b9894e7d36a4d7be9b669c1f589ed

commit 84bc38bdc07b9894e7d36a4d7be9b669c1f589ed
Author:     Ronny (tastytea) Gutbrod <gentoo@tastytea.de>
AuthorDate: 2023-02-20 12:06:09 +0000
Commit:     Ronny (tastytea) Gutbrod <gentoo@tastytea.de>
CommitDate: 2023-02-20 14:17:18 +0000

    dev-libs/mtxclient: add 0.9.2
    
    remove LTO workaround for tests
    
    Bug: https://bugs.gentoo.org/861731
    Signed-off-by: Ronny (tastytea) Gutbrod <gentoo@tastytea.de>

 dev-libs/mtxclient/Manifest               |  1 +
 dev-libs/mtxclient/mtxclient-0.9.2.ebuild | 45 +++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)