Build problem with GCC 11 and Linux Topic is solved

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Build problem with GCC 11 and Linux

Unread post by bSun0000 » 2023-05-15, 14:13

Got this error during compilation (git master):

Code: Select all

33:22.43 In file included from /platform/js/src/builtin/intl/CommonFunctions.cpp:8:
33:22.43 /platform/js/src/builtin/intl/CommonFunctions.h: In function ‘JSString* js::intl::CallICU(JSContext*, const ICUStringFunction&)’:
33:22.44 /platform/js/src/builtin/intl/CommonFunctions.h:119:33: error: no matching function for call to ‘NewStringCopyN<js::CanGC>(JSContext*&, char16_t*, size_t)’
33:22.44   119 |     return NewStringCopyN<CanGC>(cx, chars.begin(), size_t(size));
33:22.44       |            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33:22.44 In file included from /platform/js/src/builtin/intl/CommonFunctions.h:19,
33:22.44                  from /platform/js/src/builtin/intl/CommonFunctions.cpp:8:
33:22.44 /platform/js/src/vm/String.h:1261:1: note: candidate: ‘template<js::AllowGC allowGC, class CharT> JSFlatString* js::NewStringCopyN(js::ExclusiveContext*, const CharT*, size_t)’
33:22.44  1261 | NewStringCopyN(js::ExclusiveContext* cx, const CharT* s, size_t n);
33:22.44       | ^~~~~~~~~~~~~~
33:22.44 /platform/js/src/vm/String.h:1261:1: note:   template argument deduction/substitution failed:
33:22.44 In file included from /platform/js/src/builtin/intl/CommonFunctions.cpp:8:
33:22.44 /platform/js/src/builtin/intl/CommonFunctions.h:119:34: note:   cannot convert ‘cx’ (type ‘JSContext*’) to type ‘js::ExclusiveContext*’
33:22.44   119 |     return NewStringCopyN<CanGC>(cx, chars.begin(), size_t(size));
33:22.44       |                                  ^~
33:22.44 In file included from /platform/js/src/builtin/intl/CommonFunctions.h:19,
33:22.44                  from /platform/js/src/builtin/intl/CommonFunctions.cpp:8:
33:22.44 /platform/js/src/vm/String.h:1265:1: note: candidate: ‘JSFlatString* js::NewStringCopyN(js::ExclusiveContext*, const char*, size_t) [with js::AllowGC allowGC = js::CanGC; size_t = unsigned int]’
33:22.44  1265 | NewStringCopyN(ExclusiveContext* cx, const char* s, size_t n)
33:22.44       | ^~~~~~~~~~~~~~
33:22.45 /platform/js/src/vm/String.h:1265:34: note:   no known conversion for argument 1 from ‘JSContext*’ to ‘js::ExclusiveContext*’
33:22.45  1265 | NewStringCopyN(ExclusiveContext* cx, const char* s, size_t n)
33:22.45       |                ~~~~~~~~~~~~~~~~~~^~
Which is weird. Iv checked the sources and conversion between JSContext and js::ExclusiveContext happens in many other places but they does not trigger this error - so this classes are interchangeable (i guess..), why it does not work here? Although i use custom build flags, ccache and many GCC options with LTO enabled - everything was fine before.

Fixed this by adding #include "jscntxt.h" header to the /platform/js/src/builtin/intl/CommonFunctions.h file but i still wonder - is it a source code bug or something from my side?

Related commit: https://repo.palemoon.org/MoonchildProd ... 95c608bf3c
"Issue #2046 - Create helper method to call ICU string conversion methods"

Does anyone else tried to compile this browser from git after this commit, on linux and using GCC?

User avatar
andyprough
Astronaut
Astronaut
Posts: 701
Joined: 2020-05-31, 04:33

Re: Build problem with GCC 11 and Linux

Unread post by andyprough » 2023-05-15, 14:23

What's your distro and distro version, just out of curiosity?

I haven't tried with gcc 11 yet, I'm still on gcc 10.2 until Debian Bookworm is released later this summer, which is then going to leap forward to gcc 12.2. Should be an interesting transition. I'm hoping things will still build OK.

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: Build problem with GCC 11 and Linux

Unread post by bSun0000 » 2023-05-15, 14:28

I'm using Debian 11 (bullseye) with unstable, testing and experimental repositories enabled in apt.sources (basically - bookworm with bonus bugs)
gcc version 11.3.0 (manually forcing it cuz mainstream is 12/13 already).

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: Build problem with GCC 11 and Linux

Unread post by bSun0000 » 2023-07-16, 08:29

Up. Still can't compile this browser without adding #include "jscntxt.h" to the /platform/js/src/builtin/intl/CommonFunctions.h file. How is no one else have this problem.. it makes no sense to me.

User avatar
andyprough
Astronaut
Astronaut
Posts: 701
Joined: 2020-05-31, 04:33

Re: Build problem with GCC 11 and Linux

Unread post by andyprough » 2023-07-24, 03:17

bSun0000 wrote:
2023-07-16, 08:29
Up. Still can't compile this browser without adding #include "jscntxt.h" to the /platform/js/src/builtin/intl/CommonFunctions.h file. How is no one else have this problem.. it makes no sense to me.
I haven't had any trouble building at all on my Debian 11 based distros, but then again I don't have any testing or experimental or unstable repos enabled like you said you did. So, I don't know. Pale Moon has always been one of the easiest of the large packages to compile for me.

dbsoft
Project Contributor
Project Contributor
Posts: 407
Joined: 2020-02-21, 17:35

Re: Build problem with GCC 11 and Linux

Unread post by dbsoft » 2023-08-05, 23:19

I was not able to reproduce this, I did a build on a version of Ubuntu that uses GCC 11. It built fine from master without any changes.

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: Build problem with GCC 11 and Linux

Unread post by bSun0000 » 2023-08-05, 23:27

This is my .mozconfig:

Code: Select all

# Set GTK Version to 2 or 3
_GTK_VERSION=2

mk_add_options PYTHON=/usr/bin/python2
mk_add_options AUTOCONF=/usr/bin/autoconf-2.13

#mk_add_options AUTOCLOBBER=1

# Standard build options for Pale Moon
ac_add_options --enable-application=palemoon
ac_add_options --enable-optimize="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer -finline-functions -ftree-partial-pre -fpredictive-commoning -mtls-dialect=gnu2 -mstackrealign"
ac_add_options --with-ccache
ac_add_options --enable-js-lto

ac_add_options --enable-default-toolkit=cairo-gtk$_GTK_VERSION
ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --enable-devtools
ac_add_options --enable-jxl
ac_add_options --enable-av1

ac_add_options --enable-ctypes
ac_add_options --enable-ion
ac_add_options --enable-libjpeg-turbo

ac_add_options --disable-content-sandbox
ac_add_options --disable-sandbox

ac_add_options --disable-pulseaudio
ac_add_options --enable-alsa

ac_add_options --enable-release

ac_add_options --disable-dtrace

ac_add_options --disable-profiling
ac_add_options --disable-eme
ac_add_options --disable-webrtc
ac_add_options --disable-gamepad
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-debug-js-modules
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --disable-sync

ac_add_options --with-pthreads

#export MOZ_TELEMETRY_REPORTING=

# Please see https://www.palemoon.org/redist.shtml for restrictions when using the official branding.
#ac_add_options --enable-official-branding
#export MOZILLA_OFFICIAL=1
I suspect this problem comes from ac_add_options --enable-js-lto

(ignore the rest of this mess, i tested multiple things before and didnt bother to clean it up since it works just fine)

Will test the compilation without this flag next time im gonna recompile this browser.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35476
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Build problem with GCC 11 and Linux

Unread post by Moonchild » 2023-08-06, 00:18

bSun0000 wrote:
2023-08-05, 23:27
I suspect this problem comes from ac_add_options --enable-js-lto
Likely. Using LTO will build js de-unified. Some intl tends to be pulled in by js, so it may end up with some deprot. Adding the header would be the solution.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

dbsoft
Project Contributor
Project Contributor
Posts: 407
Joined: 2020-02-21, 17:35

Re: Build problem with GCC 11 and Linux

Unread post by dbsoft » 2023-08-07, 05:57

Fix for this is included with my latest pull request: https://repo.palemoon.org/MoonchildProd ... pulls/2286

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35476
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Build problem with GCC 11 and Linux

Unread post by Moonchild » 2023-08-07, 08:12

dbsoft wrote:
2023-08-07, 05:57
Fix for this is included with my latest pull request: https://repo.palemoon.org/MoonchildProd ... pulls/2286
Merged. Thank you!
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked