Commit graph

102 commits

Author SHA1 Message Date
Gunnar Beutner c6c1e2037b Toolchain: Add platform definition for CMake
This also ensures that pkg-config finds packages in /usr/local
and changes the install prefix to /usr/local.
2021-04-16 19:04:24 +02:00
Gunnar Beutner 50e4cad4a0 Toolchain+LibC: Don't link LibC against crt0
Instead GCC should be used to automatically link against crt0
and crt0_shared depending on the type of object file that is being
built.

Unfortunately this requires a rebuild of the toolchain as well
as everything that has been built with the old GCC.
2021-04-16 17:56:12 +02:00
Brian Gianforcaro 73fab93ef5 Toolchain: Update to the latest gcc release 10.3.0
10.3.0 is a bugfix release, with 178 bugs fixed.
See: https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&resolution=FIXED&target_milestone=10.3
2021-04-14 21:49:54 +02:00
Brian Gianforcaro 5d59affc18 Toolchain: Update binutils to version to latest 2.36.1 release
This updates binutils to the latest release. It looks like some
lines where shuffled around, so I had to fixup out patch to
apply cleanly again.
2021-04-14 21:49:54 +02:00
Gunnar Beutner e95cb252be Toolchain: Install system headers before building GCC
GCC determines whether the system's <limits.h> header is usable
and installs a different version of its own <limits.h> header
depending on whether the system header file exists.

If the system header is missing GCC's <limits.h> header does not
include the system header via #include_next.

For this to work we need to install LibC's headers before
attempting to build GCC.

Also, re-running BuildIt.sh "hides" this problem because at that
point the sysroot directory also already has a <limits.h> header
file from the previous build.
2021-04-12 22:37:34 +02:00
Ben Wiederhake 100ce8fc1f Toolchain: Always strip compiler, not just on CI 2021-03-13 22:42:20 +01:00
Linus Groh f45e16a6a2 Toolchain: Update build paths in CMakeToolchain.txt 2021-03-11 21:01:29 +01:00
Ben Wiederhake c436c3e13d Toolchain: Remove unnecessary file from commit
This file is never read by gcc, and the filename looks like it was never meant to be added.
2021-03-11 12:32:53 +01:00
Tom 389dddd4b3 Meta: Add a build helper script
This script automatically manages the toolchain and cmake/ninja folders
making it easier to manage the different target architectures.
2021-03-09 07:28:59 +01:00
Brian Gianforcaro 90adfcad3a Toolchain: Upgrade BuildQemu.sh to the latest 5.2.0 release 2021-02-24 10:28:15 +01:00
AnotherTest bd318dcdcd Toolchain: Always remove the previous artifacts when building 2021-02-21 23:50:34 +01:00
Itamar 7df61e2c9b Toolchain: Use -ftls-model=initial-exec by default
Our TLS implementation relies on the TLS model being "initial-exec".
We previously enforced this by adding the '-ftls-model=initial-exec'
flag in the root CmakeLists file, but that did not affect ports - So
now we put that flag in the gcc spec files.

Closes #5366
2021-02-19 15:21:24 +01:00
joshua stein 4a2209d0e0 Toolchain: Explicitly enable LTO, fix build on OpenBSD 2021-02-14 09:29:22 +01:00
joshua stein 0d215b5548 Build: Sprinkle some portability, fix on OpenBSD
realpath(1) is specific to coreutils and its behavior can be had
with readlink -f

Create the Toolchain Build directory if it doesn't exist before
calling readlink, since realpath(3) on at least OpenBSD will error
on a non-existent path
2021-02-14 09:29:22 +01:00
Jonathan Turner 0bf5669ba3
Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
Linus Groh 39af1f8519 Ports: Add Python 3.9
The current version of our Python port (3.6.0) is over four years old by
now and has (or had, I haven't actually tried it in a while) some
limitations - time for an upgrade! The latest Python release is 3.9.1,
so I used that version. It's a from-scratch port, no patches are taken
from the previous port to ensure the smallest possible amount of code is
patched. The BuildPython.sh script is useful so I kept it, with some
tweaks. I added a short document explaining each patch to ease judging
their underlying problem and necessity in the future.

Compared to the old Python port, this one does support both the time
module as well as threading (at least _thread) just fine. Importing
modules written in C (everything in /usr/local/lib/python3.9/lib-dynload)
currently asserts in Serenity's dynamic loader, which is unfortunate but
probably solvable. Possibly related to #4642. I didn't try building
Python statically, which might be one possibility to circumvent this
issue.

I also renamed the directory to just "python3", which is analogous to
the Python 3.x package most Linux distributions provide. That implicitly
means that we likely will not support multiple versions of the Python
port at any given time, but again, neither do many other systems by
default. Recent versions are usually backwards compatible anyway though,
so having the latest shouldn't be a problem.
On the other hand bumping the version should now be be as simple as
updating the variables in version.sh, given that no new patches are
required.

These core modules to currently not build - I chose to ignore that for
now rather than adding more patches to make them work somehow, which
means they're fully unavailable. This should probably be fixed in
Serenity itself.

    _ctypes, _decimal, _socket, mmap, resource, termios

These optional modules requiring 3rd-party dependencies do currently not
build (even with depends="ncurses openssl zlib"). Especially the absence
of a readline port makes the REPL a bit painful to use. :^)

    _bz2, _curses, _curses_panel, _dbm, _gdbm, _hashlib, _lzma, _sqlite3,
    _ssl, _tkinter, _uuid, nis, ossaudiodev, readline, spwd, zlib

I did some work on LibC and LibM beforehand to add at least stubs of
missing required functions, it still encounters an ASSERT_NOT_REACHED()
/ TODO() every now and then, notably frexp() (implementations of that
can be found online easily if you want to get that working right now).
But then again that's our fault and not this port's. :^)
2021-01-18 22:28:56 +01:00
Andreas Kling 13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Itamar 8d04bb4d7b Toolchain: Disable exceptions by default
We now configure gcc to always use the -fno-exceptions flag.

This does not affect our code since we do not use exceptions, and also
fixes the gcc port.
2021-01-04 21:57:03 +01:00
Emanuele Torre 370ce42430 Toolchain+LibTTF: Remove some blank line at the end of CMake files. 2021-01-03 23:58:54 +01:00
Andrew Kaster 350d4d3543 Meta: Enable RTTI for Userspace programs
RTTI is still disabled for the Kernel, and for the Dynamic Loader. This
allows for much less awkward navigation of class heirarchies in LibCore,
LibGUI, LibWeb, and LibJS (eventually). Measured RootFS size increase
was < 1%, and libgui.so binary size was ~3.3%. The small binary size
increase here seems worth it :^)
2021-01-01 14:45:09 +01:00
Linus Groh b3da5835f2 Toolchain: Fix incorrect use of ENV{SERENITY_ARCH} in CMakeToolchain.txt
This was setting CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to
"ENV{SERENITY_ARCH}-pc-serenity-...", causing some ports to not build
properly.
2020-12-30 20:30:43 +01:00
meme 23b23cee5a Build: Support non-i686 toolchains
* Add SERENITY_ARCH option to CMake for selecting the target toolchain
* Port all build scripts but continue to use i686
* Update GitHub Actions cache to include BuildIt.sh
2020-12-29 17:42:04 +01:00
Luke 3bdaba0b28 Meta: Add macOS workflow to CI
A good number of contributors use macOS. However, we have a bit of
a tendency of breaking the macOS build without realising it.

Luckily, GitHub Actions does actually supply macOS environments,
so let's use it.
2020-12-28 19:35:32 +01:00
Itamar bbedd320b5 Toolchain+LibC: Fix usage of crt files
We now configure the gcc spec files to use a different crt files for
static & PIE binaries.

This relieves us from the need to explicitly specify the desired crt0
file in cmake scripts.
2020-12-24 21:46:35 +01:00
Itamar 2ba5a325d5 Toolchain+Ports: Fix gcc patch file
Previously, some hunks of the t-slibgcc patch failed to apply
2020-12-14 23:05:53 +01:00
Itamar 758fc8c063 Toolchain: Fix usage of libgcc_s & build PIE executables by default
We can now build the porst with the shared libraries toolchain.
2020-12-14 23:05:53 +01:00
Itamar e2d695eabb Build: Build libgcc_s.so
This is the shared version of libgcc
2020-12-14 23:05:53 +01:00
Itamar b1c1d7661f Toolchain: Configure the path to the dynamic linker 2020-12-14 23:05:53 +01:00
Daniel Lemos 94c56d16b3
Toolchain: Bump Ubuntu version to 20.10 in the Dockerfile (#4401) 2020-12-13 11:00:00 +01:00
Ben Wiederhake a82a17eee8 Toolchain: Trust cache blindly
This is necessary because cache reusability will be determined by Github Actions.

Note that we only cache if explicitly asked to do so,
which only happens on Github Actions.
2020-11-08 09:58:55 +01:00
Laurent Cimon b4790010a8 Build: Modify various parts to allow the build to succeed on FreeBSD 2020-10-20 14:40:47 +02:00
Linus Groh 8fe89cf441 Toolchain: Set CACHED_TOOLCHAIN_ARCHIVE after computing hash 2020-10-19 21:11:39 +02:00
Linus Groh 602eb98479 Toolchain: Remove cached archive and rebuild if extracting fails
This is currently the case on Travis CI: the file exists but fails to
extract, breaking all the CI builds.
2020-10-19 20:06:59 +02:00
Andreas Kling 583bfa04e2 Toolchain: Upgrade to Binutils 2.35.1 2020-10-12 19:53:25 +02:00
Andreas Kling 75d5f436bc Toolchain: Upgrade to GCC 10.2.0 2020-10-12 19:53:25 +02:00
Brian Pfeil 50e9000b40
Toolchain: Fix outdated error message about SERENITY_ROOT (#3624) 2020-09-27 21:13:04 +02:00
Ben Wiederhake 3ab706cac3 Travis: Strip every executable
This cuts down the size of a Toolchain cache entry by another quarter.
(About 250 MiB to about 190 MiB).
2020-09-14 11:40:48 +02:00
Ben Wiederhake 5f724b6ca1 Travis: Toolchain only depends on headers, not impls
When libstdc++ was added in 4977fd22b8, just calling
'make install' was the easiest way to install the headers. And the headers are all
that is needed for libstdc++ to determine the ABI. Since then, BuildIt.sh was
rewritten again and again, and somehow everyone just silently assumed that
libstdc++ also depends on libc.a and libm.a, because surely it does?

Turns out, it doesn't! This massively reduces the dependencies of libstdc++,
hopefully meaning that the Toolchain doesn't need to be rebuilt so often on Travis.

Furthermore, the old method of trying to determine the dependency tree with
bash/grep/etc. has finally broken anyways:

    https://travis-ci.com/github/SerenityOS/serenity/builds/179805569#L567

In summary, this should eliminate most of the Toolchain rebuilds on Travis,
and therefore make Travis build blazingly fast! :^)
2020-08-15 16:49:55 +02:00
Luke bba2da66e7 Toolchain: Update README to point to the current build instructions
This README contains *really* outdated build instructions.
Let's put a pointer to the latest build instructions there instead.
2020-08-15 00:15:20 +02:00
Ben Wiederhake 3f2b78a063 Build: Build libstdc++ in parallel 2020-08-02 18:50:28 +02:00
Ben Wiederhake cdcc09f63b Travis: 'configure' is too chatty for CI
./configure generates about 3500 lines in a few seconds. Noone will ever read
those lines and they make loading the Travis webpage slower. And if there is
ever a problem, it will be because the Travis base image changed (which happens
only rarely) in a way that interferes with compiling gcc (which is incredibly
unlikely), or we update gcc (which happens very rarely) and gcc doesn't like
the Travis iamge (which again is incredibly unlikely). In all of these cases,
finding the culprit will be self-evident.
2020-08-02 18:50:28 +02:00
Nico Weber 06c59cce6f Toolchain: Strip cc1 2020-07-29 17:36:38 +02:00
Andreas Kling 9dcd776da9 Toolchain: Let's leave cc1 in place for now 2020-07-29 15:10:00 +02:00
Ben Wiederhake f29fbe3c76 Meta: Fix shellcheck issues in BuildIt.sh 2020-07-29 01:24:24 +02:00
Ben Wiederhake 962e7855c5 Travis: Reduce Toolchain cache item size by 73%
Empirically, every single push or PR has to download *and then upload*
about 3.6 GiB of "cache stuff", which takes up about 400 seconds:
https://travis-ci.com/github/SerenityOS/serenity/builds/177500795
On every single push/PR! No matter what!

Those 3.6 GB consist of:
- 3.2 GB Toolchain cache (around 260 MB per compressed item)
- 0.4 GB ccache, but is capped at 0.5 GB: https://travis-ci.com/github/BenWiederhake/serenity/builds/177528549
- (And 200 KB for some weird debian package? Dunno.)

Investigating in the size, the Toolchain consists mostly of *DEBUG SYMBOLS IN
THE COMPILER BINARIES* which comically misses the point. If we ever run into
compiler crashes, any stacktrace would be lost anyway as soon as the Travis VM
shuts down. Furthermore, Travis will only ever compile Serenity itself, and
Serenity forbids C in it's Contribution Guidelines. That's another 20 MB we
don't need to cache.

Stripping the binaries and deleting the C compiler reduces the uncompressed size
from 1200 MB down to 220 MB. The compressed size gets reduced from 260 MB to 70MB.
That's a reduction of 73%.

It'll take a while until the 'old' toolchains get deleted.
I guess it'll take less than a week.

From that point onward, the Travis cache will be 1.2 GB, consisting of:
- 0.7 GB Toolchain cache
- 0.5 GB ccache
- (And that weird 200 KB deb file)

If network speeds are linear, then this should reduce the "cache network
overhead time" from about 400 seconds to about 120 seconds.

tl;dr: Strip unnecessary debug infos, delete an unused files, and speed
everything up by two minutes. (Both Toolchain cache hits and Toolchain rebuilds!)
2020-07-29 01:24:24 +02:00
Stefano Cristiano a1e1aa96fb Toolchain: Allow building using CMake on macOS 2020-07-13 08:46:44 +02:00
Érico Nogueira Rolim fef9ad520b
Toolchain: Use curl instead of wget (#2574)
- For Linux: curl is already listed as a dependency;
- For macOS: curl is pre-installed;
- For OpenBSD and FreeBSD: curl is a dependecy of git.
2020-06-18 16:31:12 +02:00
Paul Redmond 1a56fe714c
Toolchain: Support building the toolchain with Ninja (#2504)
This change allows users to use CMAKE_GENERATOR=Ninja ./BuildIt.sh

BuildIt.sh assumes the default cmake generator is Make. However,
the user may specify CMAKE_GENERATOR=Ninja, for example, to set the
default generator. Therefore, instead of calling make to build the
LibC target we should call cmake --build to use the correct generated
files.
2020-06-05 09:31:10 +02:00
Paul Redmond 4d4e578edf Ports: Fix CMake-based ports
The SDL port failed to build because the CMake toolchain filed pointed
to the old root. Now the toolchain file assumes that the Root is in
Build/Root.

Additionally, the AK/ and Kernel/ headers need to be installed in the
root too.
2020-05-29 20:21:10 +02:00
Yonatan Goldschmidt 00c0650f96 Build: Add Dockerfile 2020-05-22 01:19:15 +02:00