Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 836219 - www-client/firefox-98.0.2 fails to compile with libcxx
Summary: www-client/firefox-98.0.2 fails to compile with libcxx
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 5 votes (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
: 836338 (view as bug list)
Depends on:
Blocks: systemwide-libcxx
  Show dependency tree
 
Reported: 2022-03-26 20:38 UTC by Christian Apeltauer
Modified: 2022-06-20 19:32 UTC (History)
12 users (show)

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


Attachments
build.log (build.log.bz2,289.23 KB, application/x-bzip2)
2022-03-26 20:41 UTC, Christian Apeltauer
Details
emerge --info (info,6.50 KB, text/plain)
2022-03-26 20:41 UTC, Christian Apeltauer
Details
bgo-836219.patch (bgo-836219.patch,1.95 KB, text/plain)
2022-03-27 07:53 UTC, Joonas Niilola
Details
ld.lld: error (file_836219.txt,14.28 KB, text/plain)
2022-04-04 14:52 UTC, Doom Guy
Details
firefox-99.0 build log (build.log.tar.xz,71.11 KB, application/x-xz)
2022-04-10 20:07 UTC, Mamadou Babaei
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Apeltauer 2022-03-26 20:38:48 UTC
www-client/firefox-98.0.2 fails to compile:

In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/accessible/atk/AccessibleWrap.cpp:7:^O^O
8 0:54.93^O In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/accessible/atk/AccessibleWrap.h:10:^O^O
8 0:54.93^O In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/include/nsCOMPtr.h:28:^O^O
8 0:54.93^O In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/include/mozilla/RefPtr.h:13:^O^O
8 0:54.93^O In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/include/mozilla/DbgMacro.h:13:^O^O
8 0:54.93^O In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/include/mozilla/Span.h:30:^O^O
8 0:54.93^O In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/stl_wrappers/string:64:^O^O
8 0:54.93^O In file included from /var/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/system_wrappers/string:3:^O^O
8 0:54.93^O /usr/include/c++/v1/string:1721:9: error: call to '__throw_length_error' is ambiguous^O^O
8 0:54.93^O         _VSTD::__throw_length_error("basic_string");^O^O
8 0:54.93^O         ^~~~~~~~~~~~~~~~~~~~~~~~~~~^O^O
8 0:54.93^O /usr/include/c++/v1/__config:826:15: note: expanded from macro '_VSTD'^O^O
8 0:54.93^O #define _VSTD std^O^O
8 0:54.93^O               ^^O^O
8 0:54.93^O /var/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/include/mozilla/throw_gcc.h:92:59: note: candidate function^O^O
8 0:54.93^O MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error(^O^O
8 0:54.93^O                                                           ^^O^O
8 0:54.93^O /usr/include/c++/v1/stdexcept:253:6: note: candidate function^O^O
8 0:54.93^O void __throw_length_error(const char*__msg)^O^O
8 0:54.93^O      ^^O^O

And several further errors, all related to __throw_length_error

Reproducible: Always
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-26 20:41:14 UTC
Please always include the full build.log & emerge --info.

Anyway, ajak hit this in #gentoo-mozilla 2 days ago -- it's to do with libcxx/libc++.
Comment 2 Christian Apeltauer 2022-03-26 20:41:32 UTC
Created attachment 767918 [details]
build.log
Comment 3 Christian Apeltauer 2022-03-26 20:41:53 UTC
Created attachment 767919 [details]
emerge --info
Comment 4 Joonas Niilola gentoo-dev 2022-03-27 07:53:08 UTC
Created attachment 767961 [details]
bgo-836219.patch

Can you try the patch provided in the FreeBSD bug?

mkdir -p /etc/portage/patches/www-client/firefox-98.0.2/

And place the cleaned patch there, for convenience I've attached it to this bug. Then continue emerging firefox:rapid normally and make sure you see 

 * Applying user patches from /etc/portage/patches ...
 * Applying bgo-836219.patch ...  [ ok ]
 * User patches applied.

Let me know if you need more detailed steps!
Comment 5 Perfect Gentleman 2022-03-27 08:40:58 UTC
(In reply to Joonas Niilola from comment #4)
> Created attachment 767961 [details]
> bgo-836219.patch
> 
> Can you try the patch provided in the FreeBSD bug?
> 
> mkdir -p /etc/portage/patches/www-client/firefox-98.0.2/
> 
> And place the cleaned patch there, for convenience I've attached it to this
> bug. Then continue emerging firefox:rapid normally and make sure you see 
> 
>  * Applying user patches from /etc/portage/patches ...
>  * Applying bgo-836219.patch ...  [ ok ]
>  * User patches applied.
> 
> Let me know if you need more detailed steps!

Have you done the full test of this patch?
Comment 6 Perfect Gentleman 2022-03-27 08:42:10 UTC
 0:46.15 In file included from /tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/mozglue/baseprofiler/core/shared-libraries-linux.cc:16:
 0:46.15 In file included from /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/system_wrappers/fstream:3:
 0:46.15 In file included from /usr/include/c++/v1/fstream:193:
 0:46.16 In file included from /usr/include/c++/v1/filesystem:244:
 0:46.16 /usr/include/c++/v1/__filesystem/directory_iterator.h:32:7: error: visibility does not match previous declaration
 0:46.16 class _LIBCPP_HIDDEN __dir_stream;
 0:46.16       ^
 0:46.16 /usr/include/c++/v1/__config:688:44: note: expanded from macro '_LIBCPP_HIDDEN'
 0:46.16 #    define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
 0:46.16                                            ^
 0:46.16 /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/system_wrappers/fstream:2:13: note: previous attribute is here
 0:46.16 #pragma GCC visibility push(default)
 0:46.16             ^
 0:46.16 1 error generated.
 0:46.16 make[4]: *** [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/rules.mk:660: shared-libraries-linux.o] Error 1
 0:46.16 make[4]: Leaving directory '/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/mozglue/baseprofiler'
 0:46.16 make[3]: *** [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/recurse.mk:72: mozglue/baseprofiler/target-objects] Error 2
 0:46.16 make[3]: *** Waiting for unfinished jobs...
Comment 7 Joonas Niilola gentoo-dev 2022-03-29 08:17:03 UTC
*** Bug 836338 has been marked as a duplicate of this bug. ***
Comment 8 Attila Tóth 2022-03-30 21:18:41 UTC
(In reply to Perfect Gentleman from comment #6)
>  0:46.15 In file included from
> /tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/mozglue/
> baseprofiler/core/shared-libraries-linux.cc:16:
>  0:46.15 In file included from
> /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> system_wrappers/fstream:3:
>  0:46.15 In file included from /usr/include/c++/v1/fstream:193:
>  0:46.16 In file included from /usr/include/c++/v1/filesystem:244:
>  0:46.16 /usr/include/c++/v1/__filesystem/directory_iterator.h:32:7: error:
> visibility does not match previous declaration
>  0:46.16 class _LIBCPP_HIDDEN __dir_stream;
>  0:46.16       ^
>  0:46.16 /usr/include/c++/v1/__config:688:44: note: expanded from macro
> '_LIBCPP_HIDDEN'
>  0:46.16 #    define _LIBCPP_HIDDEN __attribute__
> ((__visibility__("hidden")))
>  0:46.16                                            ^
>  0:46.16
> /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> system_wrappers/fstream:2:13: note: previous attribute is here
>  0:46.16 #pragma GCC visibility push(default)
>  0:46.16             ^
>  0:46.16 1 error generated.
>  0:46.16 make[4]: ***
> [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/rules.mk:
> 660: shared-libraries-linux.o] Error 1
>  0:46.16 make[4]: Leaving directory
> '/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/
> mozglue/baseprofiler'
>  0:46.16 make[3]: ***
> [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/recurse.
> mk:72: mozglue/baseprofiler/target-objects] Error 2
>  0:46.16 make[3]: *** Waiting for unfinished jobs...

Me too. Removing the pragma from tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/system_wrappers/fstream is a workaround for this. Three questions came into my mind.
1. How this file is generated during compile?
2. How a GCC pragma screws up clang?
3. Could we just go back to gcc or is it too oldschool?
Comment 9 Perfect Gentleman 2022-04-02 03:01:15 UTC
(In reply to Attila Tóth from comment #8)
> 
> Me too. Removing the pragma from
> tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> system_wrappers/fstream is a workaround for this. Three questions came into
> my mind.
> 1. How this file is generated during compile?
> 2. How a GCC pragma screws up clang?
> 3. Could we just go back to gcc or is it too oldschool?

This workaround didn't work in my cases.
Comment 10 Attila Tóth 2022-04-02 06:53:50 UTC
(In reply to Perfect Gentleman from comment #9)
> (In reply to Attila Tóth from comment #8)
> > 
> > Me too. Removing the pragma from
> > tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> > system_wrappers/fstream is a workaround for this. Three questions came into
> > my mind.
> > 1. How this file is generated during compile?
> > 2. How a GCC pragma screws up clang?
> > 3. Could we just go back to gcc or is it too oldschool?
> 
> This workaround didn't work in my cases.

There's another compile-time created fstream.h file with the same contents. One might need to handle that as well in order to go on...
Comment 11 Perfect Gentleman 2022-04-02 07:18:03 UTC
(In reply to Attila Tóth from comment #10)
> There's another compile-time created fstream.h file with the same contents.
> One might need to handle that as well in order to go on...

It didn't help too. 'cause later there is /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/dist/system_wrappers/fstrem which causes the break.
Comment 12 12101111 2022-04-04 08:53:00 UTC
(In reply to Perfect Gentleman from comment #6)
>  0:46.15 In file included from
> /tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/mozglue/
> baseprofiler/core/shared-libraries-linux.cc:16:
>  0:46.15 In file included from
> /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> system_wrappers/fstream:3:
>  0:46.15 In file included from /usr/include/c++/v1/fstream:193:
>  0:46.16 In file included from /usr/include/c++/v1/filesystem:244:
>  0:46.16 /usr/include/c++/v1/__filesystem/directory_iterator.h:32:7: error:
> visibility does not match previous declaration
>  0:46.16 class _LIBCPP_HIDDEN __dir_stream;
>  0:46.16       ^
>  0:46.16 /usr/include/c++/v1/__config:688:44: note: expanded from macro
> '_LIBCPP_HIDDEN'
>  0:46.16 #    define _LIBCPP_HIDDEN __attribute__
> ((__visibility__("hidden")))
>  0:46.16                                            ^
>  0:46.16
> /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> system_wrappers/fstream:2:13: note: previous attribute is here
>  0:46.16 #pragma GCC visibility push(default)
>  0:46.16             ^
>  0:46.16 1 error generated.
>  0:46.16 make[4]: ***
> [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/rules.mk:
> 660: shared-libraries-linux.o] Error 1
>  0:46.16 make[4]: Leaving directory
> '/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/
> mozglue/baseprofiler'
>  0:46.16 make[3]: ***
> [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/recurse.
> mk:72: mozglue/baseprofiler/target-objects] Error 2
>  0:46.16 make[3]: *** Waiting for unfinished jobs...

It's a libc++ issue, fixed in upstream:
https://github.com/llvm/llvm-project/commit/7ab1ab0db40158e6f0794637054c98376e236a6d

See also: 
https://bugzilla.mozilla.org/show_bug.cgi?id=1761560
https://bugzilla.mozilla.org/show_bug.cgi?id=1754469
Comment 13 Doom Guy 2022-04-04 14:51:11 UTC
(In reply to 12101111 from comment #12)
> (In reply to Perfect Gentleman from comment #6)
> >  0:46.15 In file included from
> > /tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/mozglue/
> > baseprofiler/core/shared-libraries-linux.cc:16:
> >  0:46.15 In file included from
> > /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> > system_wrappers/fstream:3:
> >  0:46.15 In file included from /usr/include/c++/v1/fstream:193:
> >  0:46.16 In file included from /usr/include/c++/v1/filesystem:244:
> >  0:46.16 /usr/include/c++/v1/__filesystem/directory_iterator.h:32:7: error:
> > visibility does not match previous declaration
> >  0:46.16 class _LIBCPP_HIDDEN __dir_stream;
> >  0:46.16       ^
> >  0:46.16 /usr/include/c++/v1/__config:688:44: note: expanded from macro
> > '_LIBCPP_HIDDEN'
> >  0:46.16 #    define _LIBCPP_HIDDEN __attribute__
> > ((__visibility__("hidden")))
> >  0:46.16                                            ^
> >  0:46.16
> > /tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/dist/
> > system_wrappers/fstream:2:13: note: previous attribute is here
> >  0:46.16 #pragma GCC visibility push(default)
> >  0:46.16             ^
> >  0:46.16 1 error generated.
> >  0:46.16 make[4]: ***
> > [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/rules.mk:
> > 660: shared-libraries-linux.o] Error 1
> >  0:46.16 make[4]: Leaving directory
> > '/tmp/portage/www-client/firefox-98.0.2/work/firefox_build/instrumented/
> > mozglue/baseprofiler'
> >  0:46.16 make[3]: ***
> > [/tmp/portage/www-client/firefox-98.0.2/work/firefox-98.0.2/config/recurse.
> > mk:72: mozglue/baseprofiler/target-objects] Error 2
> >  0:46.16 make[3]: *** Waiting for unfinished jobs...
> 
> It's a libc++ issue, fixed in upstream:
> https://github.com/llvm/llvm-project/commit/
> 7ab1ab0db40158e6f0794637054c98376e236a6d
> 
> See also: 
> https://bugzilla.mozilla.org/show_bug.cgi?id=1761560
> https://bugzilla.mozilla.org/show_bug.cgi?id=1754469

Tried with this patch and FreeBSD patch, and when was finalizing building, I got ld.lld error. Using Clang/LLVM/lld/Musl globally here.
Comment 14 Doom Guy 2022-04-04 14:52:10 UTC
Created attachment 768770 [details]
ld.lld: error
Comment 15 tt_1 2022-04-04 17:35:04 UTC
Can the fix for libcxx please be pused to the tree?
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-04 17:52:46 UTC
(In reply to tt_1 from comment #15)
> Can the fix for libcxx please be pused to the tree?

It was only posted here a few hours ago and llvm@ isn't CC'd.
Comment 17 Mamadou Babaei 2022-04-10 20:07:24 UTC
Created attachment 769898 [details]
firefox-99.0 build log

It still fails with 99.0. I hope this gets fixed as it's really annoying.
Comment 18 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-10 20:09:42 UTC
(In reply to Mamadou Babaei from comment #17)
> Created attachment 769898 [details]
> firefox-99.0 build log
> 
> It still fails with 99.0. I hope this gets fixed as it's really annoying.

I don't think comments like this are very helpful. People are doing the best they can but ultimately libcxx is an odd configuration and most developers aren't even using it.
Comment 19 Mamadou Babaei 2022-04-10 20:11:12 UTC
(In reply to Sam James from comment #18)
> (In reply to Mamadou Babaei from comment #17)
> > Created attachment 769898 [details]
> > firefox-99.0 build log
> > 
> > It still fails with 99.0. I hope this gets fixed as it's really annoying.
> 
> I don't think comments like this are very helpful. People are doing the best
> they can but ultimately libcxx is an odd configuration and most developers
> aren't even using it.

Sorry did not want to offend you. Just wanted to post the new build log.
Comment 20 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-10 20:19:21 UTC
(In reply to Mamadou Babaei from comment #19)

No worries, I get it, I just wanted to emphasise that libcxx is a bit odd so we're not all experts in it. But I'm trying to get that commit backported to LLVM 14 so we can apply it in Gentoo: https://github.com/llvm/llvm-project/issues/54841.

Then I think we can go from there.
Comment 21 Mamadou Babaei 2022-04-10 20:24:09 UTC
Thank you very much for the effort you put into this. I acknowledge my setup on building clang with libcxx might seem weird. I need it for building certain libraries for a few of my own projects.
Comment 22 Joonas Niilola gentoo-dev 2022-04-11 04:34:57 UTC
I actually thought this fix was already included in llvm-14. 

But yes libcxx is a bit annoying to test, since AFAIK you need your whole system built with it, and last I tried that wasn't exactly the easiest or fastest task.

Still nice to see the root cause has been identified. We'll progress from there!
Comment 23 Attila Tóth 2022-04-14 22:02:29 UTC
freebsd patch works for me
Comment 24 Attila Tóth 2022-04-19 19:14:23 UTC
Still hitting this bug with firefox-99.0.1. However the patch no longer solves the problem:
nditionVariable_posix.o.pp  -fcolor-diagnostics  /var/tmp/portage/www-client/firefox-99.0.1/work/firefox-99.0.1/mozglue/misc/ConditionVariable_posix.cpp
 0:05.36 In file included from /var/tmp/portage/www-client/firefox-99.0.1/work/firefox-99.0.1/mozglue/baseprofiler/core/shared-libraries-linux.cc:16:
 0:05.36 In file included from /var/tmp/portage/www-client/firefox-99.0.1/work/firefox_build/dist/system_wrappers/fstream:3:
 0:05.36 In file included from /usr/include/c++/v1/fstream:193:
 0:05.36 In file included from /usr/include/c++/v1/filesystem:244:
 0:05.36 /usr/include/c++/v1/__filesystem/directory_iterator.h:32:7: error: visibility does not match previous declaration
 0:05.36 class _LIBCPP_HIDDEN __dir_stream;
 0:05.36       ^
 0:05.36 /usr/include/c++/v1/__config:688:44: note: expanded from macro '_LIBCPP_HIDDEN'
 0:05.36 #    define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
 0:05.36                                            ^
 0:05.36 /var/tmp/portage/www-client/firefox-99.0.1/work/firefox_build/dist/system_wrappers/fstream:2:13: note: previous attribute is here
 0:05.36 #pragma GCC visibility push(default)
 0:05.36             ^
 0:05.91 1 error generated.
Comment 25 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-19 19:16:17 UTC
(In reply to Attila Tóth from comment #24)
> Still hitting this bug with firefox-99.0.1. However the patch no longer
> solves the problem:

What version of clang and libcxx? It should be in 14.0.1.
Comment 26 tt_1 2022-04-19 19:17:08 UTC
please provide new emerge --info, and new build log as well
Comment 27 Mamadou Babaei 2022-04-21 09:47:14 UTC
Oh, how ignorant I was! I didn't realize till now that www-client/firefox ebuild comes with a clang useflag and optionally can be built with gcc. I just did:

echo 'www-client/firefox -clang' > /etc/portage/package.use/www-client_firefox

and, as long as I have the latest www-client/firefox built, I really don't mind much if firefox is built with gcc instead of clang unless there's a significant difference in terms of performance or binary size. I'd appreciate any hints or information on that.
Comment 28 Larry the Git Cow gentoo-dev 2022-06-20 19:32:39 UTC
The bug has been referenced in the following commit(s):

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

commit b7eabfefdf3e45a2d47c90df65e9d5973009077c
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2022-06-20 19:29:34 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2022-06-20 19:32:35 +0000

    www-client/firefox: attempt to fix libc++ issue on 101.0.1
    
     - probably doesn't solve all issues with libc++ and clang-14, but at
       least some!
    
    Closes: https://bugs.gentoo.org/853142
    Bug: https://bugs.gentoo.org/836219
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/Manifest                   | 2 +-
 www-client/firefox/firefox-101.0.1-r11.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)