Step-by-step instructions for linux build?

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-28, 21:41

IANAD (I Am Not A Developer). I'm capable of following basic instructions and doing

./configure --with-this --without-that && make && make install

...and stuff like that. The build instructions at https://www.palemoon.org/sourcecode.shtml are Windows-oriented, and don't include the git pull stuff. Based on other stuff I've built, it should go something like...

(1st time only)
git clone something

The actual build script would contain
=====================
cd my_build_dir
git pull
make clean
PREFIX=${HOME}/.local
CFLAGS="my_flags"
./configure --with-this-feature --without-that-feature etc, etc
make
make install

Can someone please fill in the script for me?
There's a right way
There's a wrong way
And then there's my way

New Tobin Paradigm

Re: Step-by-step instructions for linux build?

Unread post by New Tobin Paradigm » 2015-10-28, 23:12

Yeah.. apparently you didn't bother to read the build instructions for linux on the Pale Moon for Linux website and also assume a mozilla-based codebase is just like any other program. Easy mistake to make for the latter.. not so much for the former.

Consult: http://linux.palemoon.org/help/build/ You can also cross-reference MDN as well. It is actually pretty easy.

Though I must ask why you want to build Pale Moon from source. What distro are you on and what is wrong with the generic package we release?

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-29, 01:40

Matt A Tobin wrote:Yeah.. apparently you didn't bother to read the build instructions for linux on the Pale Moon for Linux website and also assume a mozilla-based codebase is just like any other program. Easy mistake to make for the latter.. not so much for the former.
Sorry, I was looking at the wrong page.
Matt A Tobin wrote:Consult: http://linux.palemoon.org/help/build/ You can also cross-reference MDN as well. It is actually pretty easy.
Yikes! That brings back memories of building Mozilla 0.9 (showing my age here). It hasn't changed in all those years. Only one question; what is "scl enable devtoolset-1.1"? Something Centos-specific?
Matt A Tobin wrote:Though I must ask why you want to build Pale Moon from source. What distro are you on and what is wrong with the generic package we release?
I'm on Gentoo linux. I have a desktop, and an ancient 32-bit-only Atom netbook. I was surprised to find that the Atom version links against dev-libs/dbus-glib (Gentoo name). While Gentoo CPU flag optimization is nice, the real attraction of Gentoo is "USE flags". I.e. I can decide which optional dependancies I do and do not want. E.g. for my Seamonkey build, I've disabled chatzilla, dbus, gstreamer, ipc, pulseaudio, roaming, startup-notification, and wifi. Let's just say I want a semi-minimal package customized to my needs. I don't expect you guys to come up with a build to my specs. That's why I'm asking how I can do-it-myself.

I have Gentoo's cross-compiler installed on my desktop (64bit) to build for my Atom (32bit). Given that Gentoo builds almost everything from source, a cross-compiler is pretty well necessary on my setup. Let's see if I have this right...

mkdir pmsrc

wget ftp://source:current@ftp.palemoon.org/p ... -source.7z

(extract the contents of the .7z file to directory pmsrc)

(create mozconfig,txt and build.sh as per http://linux.palemoon.org/help/build/ although my mozconfig.txt will be quite different)

./build.sh (will it run properly without "scl enable devtoolset-1.1"?)
There's a right way
There's a wrong way
And then there's my way

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-29, 01:59

Oh yeah, the version number will change. Consult https://www.palemoon.org/sourcecode.shtml for the current version
There's a right way
There's a wrong way
And then there's my way

Mercury

Re: Step-by-step instructions for linux build?

Unread post by Mercury » 2015-10-29, 02:45

Matt A Tobin wrote:Yeah.. apparently you didn't bother to read the build instructions for linux on the Pale Moon for Linux website and also assume a mozilla-based codebase is just like any other program. Easy mistake to make for the latter.. not so much for the former.
I just tried to find these instructions. It took me a few minutes, even when I knew what to look for.

This is not easy to find, especially since Windows build instructions are under Download > Source code (Well... actually the proper instructions are on the forum, but whatever...) while the Linux instructions are under Help, on the Linux-specific site, which you get to by going through the Download menu on the main site.

If I were doing it, there would be an entry in the FAQ on the main site, "How do I build Pale Moon?", with links to the Windows and Linux instructions. Or, a direct "Building Pale Moon" under Help on the main site, with links to Win and Linux. Having to go to the Linux-specific site through something called "Download" to then look under Help is not an intuitive journey...

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-29, 03:13

One suggestion. The line...

mk_add_options MOZ_OBJDIR=/home/$USER/pmbuild/

in mozconfig.txt assumes the directory structure is standard like "/home/johnsmith". On some large multi-user systems, that may not be the case. I believe that...

mk_add_options MOZ_OBJDIR=$HOME/pmbuild/

is more generic, and covers the all bases better.
There's a right way
There's a wrong way
And then there's my way

User avatar
trava90
Contributing developer
Contributing developer
Posts: 1742
Joined: 2013-05-20, 18:19
Location: Somewhere in Sector 001

Re: Step-by-step instructions for linux build?

Unread post by trava90 » 2015-10-29, 08:13

Walter Dnes wrote:Let's see if I have this right...

mkdir pmsrc

wget ftp://source:current@ftp.palemoon.org/p ... -source.7z

(extract the contents of the .7z file to directory pmsrc)

(create mozconfig,txt and build.sh as per http://linux.palemoon.org/help/build/ although my mozconfig.txt will be quite different)

./build.sh (will it run properly without "scl enable devtoolset-1.1"?)
That should do it! You will also need to create a "pmbuild" folder, because build.sh will fail if it doesn't find it. "scl enable devtoolset-1.1" refers to the Red Hat Developer Toolset, which we use because it provides a newer version of GCC than what comes with CentOS 6. You can just execute the build.sh normally and it will use your system installed compiler.

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-29, 19:04

Here's what I have so far for my mozconfig.txt...

=========================================
# Please note the restrictions on official branding when using this line.
ac_add_options --enable-official-branding
export MOZILLA_OFFICIAL=1

mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser

mk_add_options MOZ_OBJDIR=/home/$USER/palemoon/pmbuild/

ac_add_options --disable-installer
ac_add_options --disable-updater

ac_add_options --disable-tests
ac_add_options --disable-mochitests
ac_add_options --disable-debug

ac_add_options --enable-strip
ac_add_options --enable-optimize="-O2 -mfxsr -mmmx -msse -msse2 -mssse3 -mfpmath=sse -fomit-frame-pointer -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables"

ac_add_options --target=i686-pc-linux
ac_add_options --x-libraries=/usr/lib

ac_add_options --disable-application=b2g
ac_add_options --disable-elf-hack
ac_add_options --disable-jemalloc
ac_add_options --disable-valgrind
=========================================

The various flags come from /proc/cpuinfo and my Gentoo CFLAGS. The 2 no-unwind options are explained in an email discussion at http://permalink.gmane.org/gmane.linux.busybox/36700

Gentoo has flags for preventing Seamonkey from linking to and/or enabling chatzilla dbus gstreamer ipc pulseaudio roaming startup-notification wifi. What are the equivalant options here?
There's a right way
There's a wrong way
And then there's my way

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-30, 17:31

The build didn't like "ac_add_options --disable-application=b2g" in mozconfig.txt, and failed. So I commented out the line. It got further. This time it died on...

"configure:18800: checking for dbus-glib-1 >= 0.60"

Why is this necessary? Under Gentoo, Firefox can be built without dbus egl gmp-autoupdate gstreamer pulseaudio startup-notification wifi. What are the equivalant options here?
There's a right way
There's a wrong way
And then there's my way

New Tobin Paradigm

Re: Step-by-step instructions for linux build?

Unread post by New Tobin Paradigm » 2015-10-30, 17:34

Not everything has an option but Perhaps you should look into configure.in its self and see what you can find.

You never did answer me as to why you want to build it from source when our generic package via the installer should do the trick.

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-30, 22:04

Matt A Tobin wrote:Not everything has an option but Perhaps you should look into configure.in its self and see what you can find.
Thanks. I'll dig through that. By the way, could you provide me with the mozconfig.txt, etc, that you use to generate the 32-bit Atom optimized build? That'll have a large chunk of optimization done already.
Matt A Tobin wrote:
Matt A Tobin wrote:You never did answer me as to why you want to build it from source when our generic package via the installer should do the trick.
I guess I didn't make myself clear enough. I want to make a minimal build for my 32-bit Atom netbook. More minimal than the Atom-optimized version at http://linux.palemoon.org/files/atom/25 ... 86.tar.bz2 Plus I want to optimize it for MY netbook, with the CPU flags that it supports.
There's a right way
There's a wrong way
And then there's my way

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-31, 01:47

After poring through configure.in, I went hacking and slashing. Here's mozconfig.txt. Note that I did this on the netbook, with "-march=native"to ensure that there were no problems with the cross-compiler. The compile soon died but threw multiple errors along the way. The first 2 errors referenced "ldnet". I've gzipped config.log and attached it. All sorts of weird stuff, including...

gcc: error: unrecognized command line option '-fno-integrated-as'

Can anybody make sense of it? mozconfig.txt listed below

Code: Select all

# Please note the restrictions on official branding when using this line.
ac_add_options --enable-official-branding
export MOZILLA_OFFICIAL=1

export IBMBIDI=0

mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser

mk_add_options MOZ_OBJDIR=/home/$USER/palemoon/pmbuild/

ac_add_options --disable-installer
ac_add_options --disable-updater

ac_add_options --disable-tests
ac_add_options --disable-mochitests
ac_add_options --disable-debug

ac_add_options --enable-strip
ac_add_options --enable-optimize="-O2 -march=native -mfpmath=sse -fomit-frame-pointer -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables"

ac_add_options --target=i686-pc-linux
ac_add_options --x-libraries=/usr/lib

ac_add_options --disable-elf-hack
ac_add_options --disable-jemalloc
ac_add_options --disable-valgrind

ac_add_options --disable-dbus
ac_add_options --disable-profiling
ac_add_options --with-pthreads
ac_add_options --disable-startup-notification
ac_add_options --disable-pango
ac_add_options --disable-gio
ac_add_options --disable-gconf
ac_add_options --disable-gnomeui
ac_add_options --disable-websms-backend
ac_add_options --disable-jsd
#WebRTC can be a security problem
ac_add_options --disable-webrtc
ac_add_options --disable-webspeech
ac_add_options --enable-ogg
ac_add_options --enable-webm
ac_add_options --without-system-libvpx
ac_add_options --disable-pulseaudio
ac_add_options --disable-gstreamer
ac_add_options --enable-libjpeg-turbo
ac_add_options --disable-safe-browsing
ac_add_options --disable-url-classifier
ac_add_options --disable-mobile-optimize
ac_add_options --enable-elf-dynstr-gc
ac_add_options --disable-necko-wifi
You do not have the required permissions to view the files attached to this post.
There's a right way
There's a wrong way
And then there's my way

squarefractal

Re: Step-by-step instructions for linux build?

Unread post by squarefractal » 2015-10-31, 01:58

Which version of gcc are you using? Do you have all the necessary headers installed?

The .mozconfig you seem to be using also looks like a dump of all --disable-* you could find, and I'm not sure if things like --without-system-libvpx, --enable-elf-dynstr-gc and --disable-elf-hack make any sense. (The first one is redundant, the last two are not very commonly used and IIRC were generally used in the Firefox 3.* era). Try using the official .mozconfig, which you can find under about:buildconfig of the respective builds.

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-10-31, 05:13

squarefractal wrote:Which version of gcc are you using? Do you have all the necessary headers installed?
i686-pc-linux-gnu-4.9.3 and given that Gentoo builds everything except proprietary binaries (Flash, etc), I hope that it's got necessary headers.
squarefractal wrote:The .mozconfig you seem to be using also looks like a dump of all --disable-* you could find
You get the idea.
squarefractal wrote:Try using the official .mozconfig, which you can find under about:buildconfig of the respective builds.
Thank you very much for that pointer. I didn't know about "about:mozconfig". Apparently the Atom-specific build was done with gcc version 4.7.2 20121015 (Red Hat 4.7.2-5). I wonder if that makes a difference. Anyhow, I'll look at them and see how they work on my system. Thanks again for the pointer.
There's a right way
There's a wrong way
And then there's my way

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-11-01, 03:34

Another newbie-type question, at least for developers, coming up. I've gotten the compile to go some distance before dying. It's getting slow, waiting for the Atom to get to where the build dies. I'd like to cross-compile on my desktop. What do I have to tweak, and where, to tell build.sh to use "/usr/bin/i686-pc-linux-gnu-gcc" and friends, rather than "/usr/bin/gcc" and friends? I have the cross-compiler installed for Gentoo, but it does things automatically, so I'm not familiar with how to switch manually.
There's a right way
There's a wrong way
And then there's my way

User avatar
trava90
Contributing developer
Contributing developer
Posts: 1742
Joined: 2013-05-20, 18:19
Location: Somewhere in Sector 001

Re: Step-by-step instructions for linux build?

Unread post by trava90 » 2015-11-01, 20:51

Walter Dnes wrote:By the way, could you provide me with the mozconfig.txt, etc, that you use to generate the 32-bit Atom optimized build? That'll have a large chunk of optimization done already.
It's the same as the one posted here, with the following four lines added:

Code: Select all

export CFLAGS="-march=atom -mtune=atom"
export CXXFLAGS="-march=atom -mtune=atom"
ac_add_options --disable-devtools
ac_add_options --disable-jsd
Walter Dnes wrote:Apparently the Atom-specific build was done with gcc version 4.7.2 20121015 (Red Hat 4.7.2-5). I wonder if that makes a difference.
The Pale Moon 26.0 beta 3 builds (including Atom) were compiled with GCC 4.9.

Axiomatic

Re: Step-by-step instructions for linux build?

Unread post by Axiomatic » 2015-11-03, 21:38

Walter Dnes wrote:Another newbie-type question, at least for developers, coming up. I've gotten the compile to go some distance before dying. It's getting slow, waiting for the Atom to get to where the build dies. I'd like to cross-compile on my desktop. What do I have to tweak, and where, to tell build.sh to use "/usr/bin/i686-pc-linux-gnu-gcc" and friends, rather than "/usr/bin/gcc" and friends? I have the cross-compiler installed for Gentoo, but it does things automatically, so I'm not familiar with how to switch manually.
Since you are doing a native compile, and I assume your Atom machine does not have much RAM, create a larger SWAP file/partition.

Cross compile:
Specifying your compiler is done by adding these two lines in your .mozconfig:
export CC=/path/to/c/compiler (for you that would be export CC=/usr/bin/i686-pc-linux-gnu-gcc).
export CXX=/path/to/cpp/compiler

If you wish to cross compile, you will not only need GCC (/usr/bin/i686-pc-linux-gnu-gcc), but G++ as well, which is likely /usr/bin/i686-pc-linux-gnu-g++.

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-11-04, 23:45

Axiomatic wrote:Since you are doing a native compile, and I assume your Atom machine does not have much RAM, create a larger SWAP file/partition.
I tried that once. Do not want to do again; it's painfull.
Axiomatic wrote:Cross compile:
Specifying your compiler is done by adding these two lines in your .mozconfig:
export CC=/path/to/c/compiler (for you that would be export CC=/usr/bin/i686-pc-linux-gnu-gcc).
export CXX=/path/to/cpp/compiler

If you wish to cross compile, you will not only need GCC (/usr/bin/i686-pc-linux-gnu-gcc), but G++ as well, which is likely /usr/bin/i686-pc-linux-gnu-g++.
Thanks, but no luck. Gentoo Portage handles cross-compiling complex packages, but I can't.

Code: Select all

cc1: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
*** Fix above errors and then restart with               "make -f client.mk build"
/home/waltdnes/palemoon/pmsrc/client.mk:329: recipe for target 'configure' failed
My "Plan B" is to install a 32-bit virtual machine on my 64-bit desktop. Then do a "native compile" in the virtual machine. I've done a virtual machine in the past (QEMU) for a program years ago that would not build as 64-bit back then. I'll disappear for a few more days while I re-learn QEMU. Thanks for everybody's help so far.
There's a right way
There's a wrong way
And then there's my way

Walter Dnes
Astronaut
Astronaut
Posts: 652
Joined: 2015-07-30, 20:29
Location: Vaughan, ON, Canada

Re: Step-by-step instructions for linux build?

Unread post by Walter Dnes » 2015-11-27, 15:24

I disappeared longer than intended. The machine I had intended to install QEMU on is a 7+ year old Core 2, with 3 Gigs of ram. I re-installed Gentoo in 32-bit mode, which can still access all the ram, so I'm not losing anything. And I can do a semi-native compile with different cpu flags. I'm confused about where to get the source code, which may have contributed to my earlier problems.
As a non-developer, my question is what do I do to get the clone and pull commands to get the 25.8_Atom_Relbranch source code and not the main release source code? Is this some additional git command and/or option?
There's a right way
There's a wrong way
And then there's my way

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

Re: Step-by-step instructions for linux build?

Unread post by Moonchild » 2015-11-27, 15:33

If you've already cloned the repo, then you can switch branches with:
git checkout 25.8_Atom_RelBranch
"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