From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9008F3856249; Fri, 20 May 2022 10:06:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9008F3856249 From: "christian.morales.vega at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105671] New: Unexplained "undefined reference" error Date: Fri, 20 May 2022 10:06:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: christian.morales.vega at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2022 10:06:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105671 Bug ID: 105671 Summary: Unexplained "undefined reference" error Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: christian.morales.vega at gmail dot com Target Milestone: --- Created attachment 53005 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53005&action=3Dedit Full verbose build log I have found a strange issue in my project build that reproduces is Ubuntu 22.04 (gcc 11.2) and Fedora 36 (gcc 12.1.1). This is the most I have been a= ble to reduce it: $ tar xf boost_1_79_0.tar.bz2=20 $ cd boost_1_79_0/ $ ./bootstrap.sh $ ./b2 --with-program_options link=3Dstatic --user-config=3D$PWD/../user-co= nfig.jam $ cd .. $ g++ -o /dev/null test.cpp -Iboost_1_79_0 boost_1_79_0/stage/lib/libboost_program_options.a -Os -flto /usr/bin/ld: /tmp/cccbpRrv.ltrans0.ltrans.o: in function `boost::program_options::options_description::get_option_column_width() con= st': :(.text+0x28cd): undefined reference to `std::__cxx11::basic_stringbuf, std::allocator >::_M_high_mark() const' /usr/bin/ld: /tmp/cccbpRrv.ltrans0.ltrans.o: in function `boost::program_options::(anonymous namespace)::format_one(std::ostream&, boost::program_options::option_description const&, unsigned int, unsigned i= nt) [clone .constprop.0]': :(.text+0x2d80): undefined reference to `std::__cxx11::basic_stringbuf, std::allocator >::_M_high_mark() const' /usr/bin/ld: :(.text+0x2e13): undefined reference to `std::__cxx11::basic_stringbuf, std::allocator >::_M_high_mark() const' /usr/bin/ld: :(.text+0x3d40): undefined reference to `std::__cxx11::basic_stringbuf, std::allocator >::_M_high_mark() const' collect2: error: ld returned 1 exit status $ I'm attaching a log showing the whole Boost.Program_options verbose build l= og. - Change "-Os" for "-O1" and it works - Remove the -supposedly unused- "#include " line and= it works.=