Compiling Palemoon with Mozilla-build x86 with msys

Discussions about the development and maturation of the platform code (UXP).
Warning: may contain highly-technical topics.

Moderators: trava90, athenian200

User avatar
FlorinCB
Newbie
Newbie
Posts: 6
Joined: 2021-12-13, 03:52
Location: Jerusalem
Contact:

Compiling Palemoon with Mozilla-build x86 with msys

Unread post by FlorinCB » 2024-02-15, 09:34

Hi,
I did try to compile Palemoon with msys or msys2.

Code: Select all

# Unpacked the tools in: c:\mozilla-build\ based on 3.5 and 4.1 with MSys and MSys2, Perl, etc.
# Made a custom start-shell-MSVC.bat that allows running x86 compliers and did run it, and inside:
cd c: # go to c:/ which is a directory for bash/MSYS command prompt, 
mkdir projects 
cd projects 
mkdir palemoon-source
git clone https://repo.palemoon.org/MoonchildProductions/Pale-Moon.git palemoon-source
cd palemoon-source
git submodule init && git submodule update
git checkout release && git submodule update
notepad++.exe myconfig.txt # added the text from https://developer.palemoon.org/build/windows/
./mach build > .build.log 2>&1 # build and write .build.log
# I did get Error No. 1
export MOZCONFIG=c:/projects/palemoon-source/myconfig.txt
make -f client.mk build > .GLUE_build.log 2>&1 # build and write .GLUE_build.log
# I did get Error No. 2
Error No. 1 in .build.log:

Code: Select all

make -f /c/projects/palemoon-source/client.mk realbuild CREATE_MOZCONFIG_JSON=
Adding client.mk options from :
    MOZ_OBJDIR=c:/projects/palemoon-source/obj-i686-pc-mingw32
    OBJDIR=c:/projects/palemoon-source/obj-i686-pc-mingw32
make[1]: Entering directory `/c/projects/palemoon-source'
make[2]: Entering directory `/c/projects/palemoon-source'
cd c:/projects/palemoon-source/obj-i686-pc-mingw32
/c/projects/palemoon-source/configure
Reexecuting in the virtualenv
ERROR: Cannot find project xulrunner
*** Fix above errors and then restart with\
               "make -f client.mk build"
make[2]: *** [configure] Error 1
make[2]: Leaving directory `/c/projects/palemoon-source'
make[1]: *** [c:/projects/palemoon-source/obj-i686-pc-mingw32/Makefile] Error 2
make[1]: Leaving directory `/c/projects/palemoon-source'
make: *** [build] Error 2
Error No. 2 in .GLUE_build.log:

Code: Select all

 0:06.40 c:\mozilla-build\mozmake\mozmake.EXE -f client.mk MOZ_PARALLEL_BUILD=8 -s configure
 0:35.80 cd c:/projects/palemoon-source/obj-i686-pc-mingw32
 0:35.91 c:/projects/palemoon-source/configure
 0:39.97 Reexecuting in the virtualenv
 0:42.74 Adding configure options from c:\projects\palemoon-source\myconfig.txt
 0:42.76   --enable-application=palemoon
 0:42.76   --enable-optimize=-O2 -GTs -GS- -Qspectre -utf-8
 0:42.76   --enable-official-branding
 0:42.76   --enable-update-channel=release
 0:42.76   --disable-updater
 0:42.76   --disable-precompiled-startupcache
 0:42.76   --enable-jemalloc
 0:42.76   --enable-strip
 0:42.76   --disable-parental-controls
 0:42.76   --disable-accessibility
 0:42.76   --disable-gamepad
 0:42.76   --disable-webrtc
 0:42.76   --enable-av1
 0:42.76   --enable-jxl
 0:42.76   CC=c:/VCToolkit100/bin/cl.EXE
 0:42.76   LD=c:/VCToolkit100/bin/link.exe
 0:42.76   MOZILLA_OFFICIAL=1
 0:42.76   MC_OFFICIAL=1
 0:42.76   BUILD_ARCH=x86
 0:42.76   WIN_UCRT_REDIST_DIR=C:/Program Files/Windows Kits/10/Redist/10.0.22621.0/ucrt/DLLs/x86
 0:42.76   BUILD_64=
 0:42.76   WIN32_REDIST_DIR=c:/VCToolkit100/Redist/x86/Microsoft.VC100.CRT
 0:43.57 checking for a shell... C:/mozilla-build/msys/bin/sh.exe
 0:46.04 checking for host system type... i686-pc-mingw32
 0:46.04 checking for target system type... i686-pc-mingw32
 0:46.04 checking whether cross compiling... no
 0:46.32 checking for pkg_config... not found
 0:46.35 checking for yasm... c:/mozilla-build/yasm/yasm.EXE
 0:46.46 checking yasm version... 1.3.0
 0:46.83 checking for the target C compiler... c:/VCToolkit100/bin/cl.EXE
 0:47.13 checking whether the target C compiler can be used...
 0:47.13 DEBUG: <truncated - see config.log for full output>
 0:47.13 DEBUG: | %KERNEL "WINNT"
 0:47.13 DEBUG: |
 0:47.13 DEBUG: |
 0:47.13 DEBUG: |
 0:47.13 DEBUG: |
 0:47.13 DEBUG: | #line 76 "c:\\users\\orynider\\appdata\\local\\temp\\conftest.gfehvj.c"
 0:47.13 DEBUG: |
 0:47.13 DEBUG: | %ENDIANNESS "little"
 0:47.13 DEBUG: |
 0:47.13 DEBUG: |
 0:47.13 DEBUG: | #line 81 "c:\\users\\orynider\\appdata\\local\\temp\\conftest.gfehvj.c"
 0:47.13 DEBUG: Its error output was:
 0:47.13 DEBUG: | Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
 0:47.13 DEBUG: | Copyright (C) Microsoft Corporation.  All rights reserved.
 0:47.13 DEBUG: |
 0:47.13 DEBUG: | AI
 0:47.13 DEBUG: | v4.0.30319
 0:47.13 DEBUG: | c1 : fatal error C1083: Cannot open source file: 'C:\mozilla-build\msys\AI': No such file or directory
 0:47.13 DEBUG: | conftest.gfehvj.c
 0:47.13 DEBUG: | c1 : fatal error C1083: Cannot open source file: 'C;C:\mozilla-build\msys\Windows\Microsoft.NET\Framework\v4.0.30319': Invalid argument
 0:47.13 ERROR: Command `c:/VCToolkit100/bin/cl.EXE -E 'c:\users\orynider\appdata\local\temp\conftest.gfehvj.c'` failed with exit status 2.
 0:47.22 *** Fix above errors and then restart with\
 0:47.22                "c:/mozilla-build/mozmake/mozmake.EXE -f client.mk build"
 0:47.24 client.mk:366: recipe for target 'configure' failed
 0:47.24 mozmake.EXE: *** [configure] Error 1

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by athenian200 » 2024-02-15, 15:28

Your first attempt to build seems to have not worked out... because it didn't pick up your .mozconfig file. I know in theory you should be able to use the MOZCONFIG variable to use any file, but in practice that's kind of dodgy, especially on Windows. It seems to work better on Linux, though.

So, I would try using ./mach build again, but this time try renaming myconfig.txt to .mozconfig and unset the MOZCONFIG variable, because it might actually cause issues.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
FlorinCB
Newbie
Newbie
Posts: 6
Joined: 2021-12-13, 03:52
Location: Jerusalem
Contact:

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by FlorinCB » 2024-02-18, 06:52

Hello again,
Here is what I did get with some edits to the .mozconfig file:

Code: Select all

make -f /c/projects/palemoon-source/client.mk realbuild CREATE_MOZCONFIG_JSON=
Adding client.mk options from c:/projects/palemoon-source/.mozconfig:
    AUTOCLOBBER=1
    MOZ_MAKE_FLAGS=-j8
    MOZ_OBJDIR=c:/projects/palemoon-source/obj-i686-pc-mingw32
    OBJDIR=c:/projects/palemoon-source/obj-i686-pc-mingw32
    FOUND_MOZCONFIG=c:/projects/palemoon-source/.mozconfig
make[1]: Entering directory `/c/projects/palemoon-source'
make[2]: Entering directory `/c/projects/palemoon-source'
cp c:/projects/palemoon-source/.mozconfig c:/projects/palemoon-source/obj-i686-pc-mingw32/.mozconfig
cd c:/projects/palemoon-source/obj-i686-pc-mingw32
/c/projects/palemoon-source/configure
Reexecuting in the virtualenv
Adding configure options from c:\projects\palemoon-source\.mozconfig
  --enable-application=palemoon
  --enable-optimize=-O2 -GTs -GS- -Qspectre -utf-8
  --enable-official-branding
  --enable-update-channel=release
  --disable-updater
  --disable-precompiled-startupcache
  --enable-jemalloc
  --enable-strip
  --disable-parental-controls
  --disable-accessibility
  --disable-gamepad
  --disable-webrtc
  --enable-av1
  --enable-jxl
  CC=C:/MsVS14/VC/Tools/MSVC/14.0.23026/bin/HostX64/x86/cl.EXE
  LD=C:/MsVS14/VC/Tools/MSVC/14.0.23026/bin/HostX64/x86/link.EXE
  MOZILLA_OFFICIAL=1
  MC_OFFICIAL=1
  BUILD_ARCH=x86
  WIN_UCRT_REDIST_DIR=C:/Program Files/Windows Kits/10/Redist/10.0.22621.0/ucrt/DLLs/x86
  BUILD_64=
  WIN32_REDIST_DIR=C:/MsVS14/VC/redist/MSVC/14.0.23026/x86/Microsoft.VC140.CRT
checking for a shell... C:/mozilla-build/msys/bin/sh.exe
checking for host system type... i686-pc-mingw32
checking for target system type... i686-pc-mingw32
checking whether cross compiling... no
checking for pkg_config... not found
checking for yasm... c:/mozilla-build/yasm/yasm.EXE
checking yasm version... 1.3.0
checking for the target C compiler... C:/MsVS14/VC/Tools/MSVC/14.0.23026/bin/HostX64/x86/cl.EXE
checking whether the target C compiler can be used... no
DEBUG: <truncated - see config.log for full output>
DEBUG: | #elif __linux__
DEBUG: | %KERNEL "Linux"
DEBUG: | #elif _WIN32 || __CYGWIN__
DEBUG: | %KERNEL "WINNT"
DEBUG: | #elif __NetBSD__
DEBUG: | %KERNEL "NetBSD"
DEBUG: | #elif __APPLE__
DEBUG: | %KERNEL "Darwin"
DEBUG: | #endif
DEBUG: | #if _MSC_VER || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
DEBUG: | %ENDIANNESS "little"
DEBUG: | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
DEBUG: | %ENDIANNESS "big"
DEBUG: | #endif
DEBUG: Executing: `C:/MsVS14/VC/Tools/MSVC/14.0.23026/bin/HostX64/x86/cl.EXE -E 'c:\users\orynider\appdata\local\temp\conftest.l5c9iq.c'`
DEBUG: COMPILER = msvc
DEBUG: VERSION = 190023026
DEBUG: CPU = x86
DEBUG: KERNEL = WINNT
DEBUG: ENDIANNESS = little
ERROR: This version (19.00.23026) of the MSVC compiler is not supported.
You must install Visual C++ 2015 Update 3 or newer in order to build.
See https://developer.mozilla.org/en/Windows_Build_Prerequisites
*** Fix above errors and then restart with\
               "make -f client.mk build"
make[2]: *** [configure] Error 1
make[2]: Leaving directory `/c/projects/palemoon-source'
make[1]: *** [c:/projects/palemoon-source/obj-i686-pc-mingw32/Makefile] Error 2
make[1]: Leaving directory `/c/projects/palemoon-source'
make: *** [build] Error 2
I did the try with Microsoft Visual Studio Desktop 2015 Express - ENU

There is any "Update 3" or more new at my.visualstudio.com ?

Here is the log after Update 3:

Code: Select all

make -f /c/projects/palemoon-source/client.mk realbuild CREATE_MOZCONFIG_JSON=
Adding client.mk options from c:/projects/palemoon-source/.mozconfig:
    AUTOCLOBBER=1
    MOZ_MAKE_FLAGS=-j8
    MOZ_OBJDIR=c:/projects/palemoon-source/obj-i686-pc-mingw32
    OBJDIR=c:/projects/palemoon-source/obj-i686-pc-mingw32
    FOUND_MOZCONFIG=c:/projects/palemoon-source/.mozconfig
make[1]: Entering directory `/c/projects/palemoon-source'
make[2]: Entering directory `/c/projects/palemoon-source'
cp c:/projects/palemoon-source/.mozconfig c:/projects/palemoon-source/obj-i686-pc-mingw32/.mozconfig
cd c:/projects/palemoon-source/obj-i686-pc-mingw32
/c/projects/palemoon-source/configure
Reexecuting in the virtualenv
Adding configure options from c:\projects\palemoon-source\.mozconfig
  --enable-application=palemoon
  --enable-optimize=-O2 -GTs -GS- -Qspectre -utf-8
  --enable-official-branding
  --enable-update-channel=release
  --disable-updater
  --disable-precompiled-startupcache
  --enable-jemalloc
  --enable-strip
  --disable-parental-controls
  --disable-accessibility
  --disable-gamepad
  --disable-webrtc
  --enable-av1
  --enable-jxl
  CC=C:/MsVS14/VC/Tools/MSVC/14.0.24210/bin/HostX64/x86/cl.EXE
  LD=C:/MsVS14/VC/Tools/MSVC/14.0.24210/bin/HostX64/x86/link.EXE
  MOZILLA_OFFICIAL=1
  MC_OFFICIAL=1
  BUILD_ARCH=x86
  WIN_UCRT_REDIST_DIR=C:/Program Files/Windows Kits/10/Redist/10.0.22621.0/ucrt/DLLs/x86
  BUILD_64=
  WIN32_REDIST_DIR=C:/MsVS14/VC/redist/MSVC/14.0.24210/x86/Microsoft.VC140.CRT
checking for a shell... C:/mozilla-build/msys/bin/sh.exe
checking for host system type... i686-pc-mingw32
checking for target system type... i686-pc-mingw32
checking whether cross compiling... no
checking for pkg_config... not found
checking for yasm... c:/mozilla-build/yasm/yasm.EXE
checking yasm version... 1.3.0
checking for the target C compiler... C:/MsVS14/VC/Tools/MSVC/14.0.24210/bin/HostX64/x86/cl.EXE
checking whether the target C compiler can be used... 
DEBUG: <truncated - see config.log for full output>
DEBUG: | #elif _WIN32 || __CYGWIN__
DEBUG: | %KERNEL "WINNT"
DEBUG: | #elif __NetBSD__
DEBUG: | %KERNEL "NetBSD"
DEBUG: | #elif __APPLE__
DEBUG: | %KERNEL "Darwin"
DEBUG: | #endif
DEBUG: | #if _MSC_VER || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
DEBUG: | %ENDIANNESS "little"
DEBUG: | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
DEBUG: | %ENDIANNESS "big"
DEBUG: | #endif
DEBUG: Executing: `C:/MsVS14/VC/Tools/MSVC/14.0.24210/bin/HostX64/x86/cl.EXE -E 'c:\users\orynider\appdata\local\temp\conftest._adbjf.c'`
DEBUG: The command returned non-zero exit status 2.
DEBUG: Its error output was:
DEBUG: | Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86
DEBUG: | Copyright (C) Microsoft Corporation.  All rights reserved.
DEBUG: | 
DEBUG: | conftest._adbjf.c
DEBUG: | cl : Command line error D8027 : cannot execute 'C:\MsVS14\VC\Tools\MSVC\14.0.24210\bin\HostX64\x86\c1.dll'
ERROR: Command `C:/MsVS14/VC/Tools/MSVC/14.0.24210/bin/HostX64/x86/cl.EXE -E 'c:\users\orynider\appdata\local\temp\conftest._adbjf.c'` failed with exit status 2.
*** Fix above errors and then restart with\
               "make -f client.mk build"
make[2]: *** [configure] Error 1
make[2]: Leaving directory `/c/projects/palemoon-source'
make[1]: *** [c:/projects/palemoon-source/obj-i686-pc-mingw32/Makefile] Error 2
make[1]: Leaving directory `/c/projects/palemoon-source'
make: *** [build] Error 2
Last edited by FlorinCB on 2024-02-18, 17:06, edited 1 time in total.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by athenian200 » 2024-02-18, 09:32

FlorinCB wrote:
2024-02-18, 06:52
I did the try with Microsoft Visual Studio Desktop 2015 Express - ENU

There is any "Update 3" or more new at my.visualstudio.com ?
You seem to be hitting a lot of errors... what build instructions are you looking at? These are the ones we use now:

https://developer.palemoon.org/build/windows/

We don't use VS 2015 anymore, we've moved to VS 2022 because we now need C++17 capability. So this has alerted us to an outdated error message that probably needs to be fixed at some point.

These instructions should just work... if they don't, then something very strange is going on here.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
FlorinCB
Newbie
Newbie
Posts: 6
Joined: 2021-12-13, 03:52
Location: Jerusalem
Contact:

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by FlorinCB » 2024-02-18, 17:20

I had to install Visual Studio Express for Desktops 2015 since the instructions did not showed that a minimum version and subversion is required but now I reached inside C:\projects\palemoon-source\platform\build\moz.configure\toolchain.configure

Code: Select all

    # Note: We do a strict version check because there sometimes are backwards
    # incompatible changes in the standard, and not all code that compiles as
    # C99 compiles as e.g. C11 (as of writing, this is true of libnestegg, for
    # example)
    if info.language == 'C' and info.language_version != 199901:
        if info.type in ('clang-cl', 'clang', 'gcc'):
            append_flag('-std=gnu99')

    cxx17_version = 201703
    if info.language == 'C++':
        if info.language_version != cxx17_version:
            # Compiler doesn't default to C++17, so add the appropriate flag.
            if info.type in ('clang', 'gcc'):
                # We're on Clang or GCC, enable C++17 and add GNU extensions.
                append_flag('-std=gnu++17')
            else:
                # We're on MSVC; enable C++17 language mode.
                append_flag('-std:c++17')

    # We force clang-cl to emulate Visual C++ 2015 Update 3 with fallback to
    # cl.exe.
    if info.type == 'clang-cl' and info.version != '19.00.24213':
        # Those flags are direct clang-cl flags that don't need -Xclang, add
        # them directly.
        flags.append('-fms-compatibility-version=19.00.24213')
        flags.append('-fallback')
Last edited by FlorinCB on 2024-02-18, 17:56, edited 1 time in total.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by athenian200 » 2024-02-18, 17:24

FlorinCB wrote:
2024-02-18, 17:20
I had to install Visual Studio Express for Desktops 2015 since the instructions did not showed a minimum version and subversion is required but now I reached inside C:\projects\palemoon-source\platform\build\moz.configure\toolchain.configure
Well, those code comments are obsolete, I'm sorry. The earliest version of VS our codebase can be compiled with now is probably VS 2019. Also, we have never used Clang to build the codebase...

It kind of seems like you're used to building Firefox and are kind of jumping into building PM assuming it works the same way?
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
FlorinCB
Newbie
Newbie
Posts: 6
Joined: 2021-12-13, 03:52
Location: Jerusalem
Contact:

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by FlorinCB » 2024-02-18, 18:37

The C Link binary from Update 3 is compiled in 10/06/2016 at 08:30:25 and looking in the source code the cxx version 17 should be from 2017/03, so two versions above VS 2015 should work.

edit: I do not know about the includes and libraries from VS 2015 or 2019 or from witch SDK if they are OK or not.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by athenian200 » 2024-02-18, 22:24

FlorinCB wrote:
2024-02-18, 18:37
The C Link binary from Update 3 is compiled in 10/06/2016 at 08:30:25 and looking in the source code the cxx version 17 should be from 2017/03, so two versions above VS 2015 should work.

edit: I do not know about the includes and libraries from VS 2015 or 2019 or from witch SDK if they are OK or not.
Well, like I said, we usually build with VS 2022. We haven't really tested those older versions in a while... I think one guy built it with VS 2019 recently, but I don't know what he did exactly.

VS 2015 simply didn't have good C++17 support, and VS 2017 was only marginally better. The first VS to have good C++17 support was 2019. The compile dates for the C link binaries don't have anything to do with it?

I'm just confused, why are you using older versions of VS and trying to make sense of obsolete code comments? Is there some context here I'm missing for why you can't use anything newer? The instructions I linked are what we keep up-to-date and in working order, you're going down paths with this attempt that are not maintained at all...
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

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

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by Moonchild » 2024-02-19, 04:40

Note, you can't use express. you have to install the community edition and follow what we have available for setting up the build environment.
VS2015 is also no longer really supported. use VS2022
"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: 419
Joined: 2020-02-21, 17:35

Re: Compiling Palemoon with Mozilla-build x86 with msys

Unread post by dbsoft » 2024-02-19, 22:16

I still do builds on VS2017, but it requires some patches to work:

https://repo.palemoon.org/dbsoft/UXP/sr ... h/vs2017-6

Post Reply