-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from EvilFreelancer/master
Update to LFS 8.2
- Loading branch information
Showing
107 changed files
with
1,012 additions
and
511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
toolchain | ||
/.idea/ | ||
/toolchain/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,100 @@ | ||
#!/bin/bash | ||
set -e | ||
echo "Building gcc.." | ||
echo "Approximate build time: 82 SBU" | ||
echo "Required disk space: 3.2 GB" | ||
echo "Building GCC.." | ||
echo "Approximate build time: 81 SBU (with tests)" | ||
echo "Required disk space: 3.1 GB" | ||
|
||
# 6.20. GCC package contains the GNU compiler collection, which | ||
# includes the C and C++ compilers | ||
tar -xf /sources/gcc-*.tar.xz -C /tmp/ \ | ||
&& mv /tmp/gcc-* /tmp/gcc \ | ||
&& pushd /tmp/gcc | ||
# change the default directory name for 64-bit libraries to “lib” | ||
|
||
# If building on x86_64, change the default directory name for | ||
# 64-bit libraries to “lib”: | ||
case $(uname -m) in | ||
x86_64) | ||
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 | ||
sed -e '/m64=/s/lib64/lib/' \ | ||
-i.orig gcc/config/i386/t-linux64 | ||
;; | ||
esac | ||
# remove the symlink created earlier as the final gcc includes will be installed here | ||
|
||
# Remove the symlink created earlier as the final gcc includes will | ||
# be installed here | ||
rm -f /usr/lib/gcc | ||
# create build directory | ||
mkdir -v build && cd build | ||
|
||
# The GCC documentation recommends building GCC in a dedicated | ||
# build directory: | ||
mkdir -v build | ||
cd build | ||
|
||
# prepare for compilation | ||
SED=sed \ | ||
../configure --prefix=/usr \ | ||
--enable-languages=c,c++ \ | ||
--disable-multilib \ | ||
--disable-bootstrap \ | ||
--with-system-zlib | ||
# compile package | ||
SED=sed \ | ||
../configure --prefix=/usr \ | ||
--enable-languages=c,c++ \ | ||
--disable-multilib \ | ||
--disable-bootstrap \ | ||
--with-system-zlib | ||
|
||
# Compile the package: | ||
make | ||
# increase the stack size prior to running the tests | ||
|
||
# One set of tests in the GCC test suite is known to exhaust the | ||
# stack, so increase the stack size prior to running the tests: | ||
ulimit -s 32768 | ||
# test the results, but do not stop at errors | ||
|
||
# Test the results, but do not stop at errors: | ||
if [ $LFS_TEST -eq 1 ]; then | ||
make -k check || true | ||
# check results (manual) | ||
# To receive a summary of the test suite results, run: | ||
../contrib/test_summary | grep -A7 Summ | ||
fi | ||
# install | ||
|
||
# Install the package: | ||
make install | ||
# make symlinks | ||
|
||
# Create a symlink required by the FHS for "historical" reasons. | ||
ln -sv ../usr/bin/cpp /lib | ||
|
||
# Many packages use the name cc to call the C compiler. | ||
# To satisfy those packages, create a symlink: | ||
ln -sv gcc /usr/bin/cc | ||
# add a compatibility symlink to enable building programs with | ||
# Link Time Optimization (LTO) | ||
|
||
# Add a compatibility symlink to enable building programs with | ||
# Link Time Optimization (LTO): | ||
install -v -dm755 /usr/lib/bfd-plugins | ||
ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/7.2.0/liblto_plugin.so \ | ||
ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/7.3.0/liblto_plugin.so \ | ||
/usr/lib/bfd-plugins/ | ||
# perform sanity checks (as above) | ||
|
||
# Now that our final toolchain is in place, it is important to again | ||
# ensure that compiling and linking will work as expected. We do this | ||
# by performing the same sanity checks as we did earlier in the chapter: | ||
echo 'int main(){}' > dummy.c | ||
cc dummy.c -v -Wl,--verbose &> dummy.log | ||
readelf -l a.out | grep ': /lib' | ||
|
||
# Now make sure that we're setup to use the correct start files | ||
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log | ||
|
||
# Verify that the compiler is searching for the correct header files: | ||
grep -B4 '^ /usr/include' dummy.log | ||
|
||
# Next, verify that the new linker is being used with the correct search paths: | ||
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' | ||
|
||
# Next make sure that we're using the correct libc: | ||
grep "/lib.*/libc.so.6 " dummy.log | ||
|
||
# Lastly, make sure GCC is using the correct dynamic linker: | ||
grep found dummy.log | ||
# cleanup | ||
|
||
# Once everything is working correctly, clean up the test files: | ||
rm -v dummy.c a.out dummy.log | ||
# move a misplaced file | ||
|
||
# Finally, move a misplaced file: | ||
mkdir -pv /usr/share/gdb/auto-load/usr/lib | ||
mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib | ||
|
||
# Cleanup | ||
popd \ | ||
&& rm -rf /tmp/gcc |
Oops, something went wrong.