### FreeBSD package installation example Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md Example of how to install a package on FreeBSD using the ports system. ```bash cd /usr/ports/lang/gcc6 make install clean ``` -------------------------------- ### Option 1: Install directly into the sysroot of the toolchain Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Example of configuring, making, and installing a package directly into the toolchain's sysroot. ```bash $ ./configure --build= --host= \ --prefix=/usr --enable-foo-bar... $ make $ make DESTDIR=///sysroot install ``` -------------------------------- ### Install Homebrew Packages Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md List of packages to install using Homebrew for macOS. ```shell autoconf automake bash binutils bison gawk git gnu-sed gnu-tar gettext help2man libtool make ncurses readline texinfo wget xz zstd ``` -------------------------------- ### Packaging installation with DESTDIR Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Example of using DESTDIR for installing crosstool-NG during packaging. ```bash ./configure --prefix=/usr make make DESTDIR=/packaging/place install ``` -------------------------------- ### Typical installation using configure Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Standard procedure for configuring, building, and installing crosstool-NG. ```bash ./configure --prefix=/some/place make make install export PATH="${PATH}:/some/place/bin" ``` -------------------------------- ### Build Log Example Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/4_Building.md An example of the output log during a successful toolchain build, showing various stages and information messages. ```text [INFO ] Performing some trivial sanity checks [INFO ] Build started 20170319.002217 [INFO ] Building environment variables [EXTRA] Preparing working directories [EXTRA] Installing user-supplied crosstool-NG configuration [EXTRA] ================================================================= [EXTRA] Dumping internal crosstool-NG configuration [EXTRA] Building a toolchain for: [EXTRA] build = x86_64-pc-linux-gnu [EXTRA] host = x86_64-pc-linux-gnu [EXTRA] target = mipsel-sde-elf [EXTRA] Dumping internal crosstool-NG configuration: done in 0.05s (at 00:02) [INFO ] ================================================================= [INFO ] Retrieving needed toolchain components' tarballs [EXTRA] Retrieving 'gmp-6.1.2' [EXTRA] Saving 'gmp-6.1.2.tar.xz' to local storage [EXTRA] Retrieving 'mpfr-3.1.5' [EXTRA] Saving 'mpfr-3.1.5.tar.xz' to local storage ... [INFO ] Installing cross-gdb [EXTRA] Configuring cross-gdb [EXTRA] Building cross-gdb [EXTRA] Installing cross-gdb [EXTRA] Installing '.gdbinit' template [INFO ] Installing cross-gdb: done in 98.55s (at 10:51) [INFO ] ================================================================= [INFO ] Cleaning-up the toolchain's directory [INFO ] Stripping all toolchain executables [EXTRA] Creating toolchain aliases [EXTRA] Removing access to the build system tools [EXTRA] Removing installed documentation [INFO ] Cleaning-up the toolchain's directory: done in 0.42s (at 10:52) [INFO ] Build completed at 20170319.003309 [INFO ] (elapsed: 10:51.42) [INFO ] Finishing installation (may take a few seconds)... ``` -------------------------------- ### Kernel Configuration Example Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/8_Internals.md Example of a kernel configuration option and its help entry. ```kconfig config KERNEL_bare_metal help Build a compiler for use without any kernel. ``` ```kconfig config KERNEL_bare_metal select BARE_METAL help Build a compiler for use without any kernel. ``` -------------------------------- ### Configuring with GNU autotools Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Example of using --host and --build tuples with a configure script. ```bash ./configure --host=your-host-tuple --build=your-build-tuple ``` -------------------------------- ### Option 2: Copy the toolchain's sysroot to the staging area Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Example of copying the toolchain's sysroot and then configuring, making, and installing packages into the staging area with --sysroot. ```bash $ cp -a $(-gcc --your-cflags-except-sysroot -print-sysroot) \ /path/to/staging $ ./configure --build= --host= \ --prefix=/usr --enable-foo-bar... CC="-gcc --sysroot=/path/to/staging" \ CXX="-g++ --sysroot=/path/to/staging" \ LD="-ld --sysroot=/path/to/staging" \ AND_SO_ON="tuple-andsoon --sysroot=/path/to/staging" $ make $ make DESTDIR=/path/to/staging install ``` -------------------------------- ### List available sample configurations Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/3_Configuration.md Command to display a list of pre-configured toolchains that can be used as a starting point. ```bash ct-ng list-samples ``` -------------------------------- ### Bootstrap the repository Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Command to run the bootstrap script after cloning the repository. ```bash ./bootstrap ``` -------------------------------- ### Applying Contributed Code Patches Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Example command to apply an lzma-compressed patch from the contrib directory to the crosstool-NG source. ```bash lzcat contrib/foobar.patch.lzma | patch -p1 ``` -------------------------------- ### Setting the PATH environment variable Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Example of how to add the toolchain's bin directory to the PATH. ```bash export PATH="${PATH}:/your/toolchain/path/bin" ``` -------------------------------- ### ct-ng configure with FreeBSD tool configuration Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md Example of running ct-ng's configure script with specific tool configurations for FreeBSD. ```bash ./configure --with-sed=/usr/local/bin/gsed \ --with-make=/usr/local/bin/gmake \ ``` -------------------------------- ### Populate Script Usage Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Example of using the populate script to copy the root directory and add necessary libraries from the sysroot. ```bash your-target-tuple-populate -s /your/root -d /your/root-populated ``` -------------------------------- ### Example Usage of cross-ldd Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Demonstrates how to use the cross-ldd script to resolve dynamic library dependencies for an application. ```bash PATH=~/x-tools/powerpc64-multilib-linux-gnu/bin:$PATH powerpc64-multilib-linux-gnu-gcc -o example example.c powerpc64-multilib-linux-gnu-ldd --root=`powerpc64-multilib-linux-gnu-gcc -print-sysroot` example ``` -------------------------------- ### Get crosstool-NG version Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/support.md Command to retrieve the currently installed version of crosstool-NG. ```bash ct-ng version ``` -------------------------------- ### Running ct-ng from a working directory Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Commands to create a working directory and run ct-ng help. ```bash mkdir work-dir cd work-dir ct-ng help ``` -------------------------------- ### Compiling with specific toolchain flags Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Examples of using make with CC, CROSS_COMPILE, or CHOST variables. ```bash make CC=your-host-tuple-gcc ``` ```bash make CROSS_COMPILE=your-host-tuple- ``` ```bash make CHOST=your-host-tuple ``` -------------------------------- ### Download released tarball Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Commands to download the crosstool-NG tarball using wget. ```bash wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-VERSION.tar.bz2 ``` ```bash wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-VERSION.tar.xz ``` -------------------------------- ### Hacker's way configuration Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Configuration for running crosstool-NG from the source directory. ```bash ./configure --enable-local make ``` -------------------------------- ### Verify tarball signature Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Commands to import PGP keys, download signature, and verify the tarball. ```bash gpg --keyserver pgp.surfnet.nl --recv-keys 35B871D1 11D618A4 wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-VERSION.tar.bz2.sig gpg --verify crosstool-ng-VERSION.tar.bz2.sig ``` -------------------------------- ### Append to Shell Profile Script Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md Environment variables to append to your shell's profile script for Homebrew and crosstool-NG setup. ```shell BREW_PREFIX="$(brew --prefix)" PATH="${PATH}:${BREW_PREFIX}/opt/binutils/bin" PATH="${BREW_PREFIX}/opt/bison/bin:${PATH}" PATH="${BREW_PREFIX}/opt/libtool/libexec/gnubin:${PATH}" PATH="/Volumes/crosstool-ng/bin:${PATH}" export PATH LDFLAGS="-L${BREW_PREFIX}/opt/binutils/lib" LDFLAGS+=" -L${BREW_PREFIX}/opt/bison/lib" LDFLAGS+=" -L${BREW_PREFIX}/opt/ncurses/lib" export LDFLAGS CPPFLAGS="-I${BREW_PREFIX}/opt/binutils/include" CPPFLAGS+=" -I${BREW_PREFIX}/opt/ncurses/include" export CPPFLAGS export PKG_CONFIG_PATH="${BREW_PREFIX}/share/pkgconfig:${PKG_CONFIG_PATH}" ``` -------------------------------- ### Configure with Staging Area Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/5_Toolchain_Usage.md Example of configuring the build process to use a staging area for headers and libraries, separate from the toolchain's sysroot. ```bash $ ./configure --build= --host= \ --prefix=/usr --enable-foo-bar... \ CPPFLAGS="-I/path/to/staging/usr/include" \ LDFLAGS="-L/path/to/staging/lib -L/path/to/staging/usr/lib" $ make $ make DESTDIR=/path/to/staging install ``` -------------------------------- ### Canadian Cross Toolchain Example Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/6_Toolchain_Types.md Demonstrates the steps to build a Canadian Cross toolchain, including setting up the prerequisite toolchain and configuring the main Canadian Cross toolchain. ```bash ct-ng x86_64-w64-mingw32 ct-ng build PATH=~/x-tools/x86_64-w64-mingw32/bin:$PATH ct-ng x86_64-w64-mingw32,x86_64-pc-linux-gnu ct-ng build ``` -------------------------------- ### Build All Toolchains Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/4_Building.md Command to build all sample toolchains. ```bash ct-ng build-all ``` -------------------------------- ### List Available Steps Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/4_Building.md Command to retrieve a list of all acceptable steps for build control. ```bash ct-ng list-steps ``` -------------------------------- ### Signed-off-by Line Example Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/7_Contributing.md An example of the required Signed-off-by line for patch submissions. ```text Signed-off-by: John DOE ``` -------------------------------- ### CT_DoGet Function Example Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/8_Internals.md Example of using the CT_DoGet function to download kernel sources. ```bash CT_DoGet linux-2.6.26.5 ftp://ftp.kernel.org/pub/linux/kernel/v2.6 ``` -------------------------------- ### CT_ExtractAndPatch Function Example Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/8_Internals.md Example of using the CT_ExtractAndPatch function to extract and patch kernel sources. ```bash CT_ExtractAndPatch linux-2.6.26.5 ``` -------------------------------- ### Build Crosstool-NG Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md Commands to bootstrap, configure, and build crosstool-NG on the mounted volume. ```shell ./bootstrap # again, only needed if you got the source from git ./configure --prefix=/Volumes/crosstool-ng make make install ``` -------------------------------- ### Mount Sparse Image Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md Command to mount the created sparse disk image. ```shell cd $HOME hdiutil mount crosstool-ng.sparseimage ``` -------------------------------- ### Package Manager Script Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/8_Internals.md Command to get help for the package manager script. ```bash maintainer/manager-packages.sh --help ``` -------------------------------- ### Create Case-Sensitive APFS Sparse Image Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md Command to create a 40GB case-sensitive APFS sparse disk image for crosstool-NG. ```shell cd $HOME hdiutil create -size 40g -fs "Case-sensitive APFS" -type SPARSE -volname crosstool-ng crosstool-ng.sparseimage ``` -------------------------------- ### Unmount Sparse Image Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/C_Setup_OS.md Command to unmount the sparse disk image. ```shell hdiutil unmount /Volumes/crosstool-ng ``` -------------------------------- ### Load a sample configuration as a base Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/3_Configuration.md Command to load a chosen sample configuration to be used as the base for further customization. ```bash ct-ng arm-unknown-linux-gnueabi ``` -------------------------------- ### Running ct-ng in Hacker's way Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/2_Installation.md Command to run ct-ng help when using the Hacker's way. ```bash ./ct-ng help ``` -------------------------------- ### Show details of a specific sample configuration Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/3_Configuration.md Command to view detailed information about a particular sample configuration. ```bash ct-ng show-arm-unknown-linux-gnueabi ``` -------------------------------- ### Basic Build Command Source: https://github.com/crosstool-ng/crosstool-ng.github.io/blob/master/_pages/docs/4_Building.md The primary command to initiate the toolchain build process. ```bash ct-ng build ```