Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build the assets? #4

Closed
kohler opened this issue Jan 23, 2020 · 2 comments
Closed

How to build the assets? #4

kohler opened this issue Jan 23, 2020 · 2 comments

Comments

@kohler
Copy link

kohler commented Jan 23, 2020

Hi Sergio!

Thanks very much for this port, which I've used in teaching for several semesters. I'd like to build a version of the port with a newer GCC. Do you have any scripts/config lines explaining how you built the assets?

Thanks,
Eddie Kohler

@SergioBenitez
Copy link
Owner

Hi Eddie! Glad to hear you've been using the ports successfully!

My raw, personal notes are below. I've updated them on every successful and unsuccessful attempt to build a macOS-hosted cross-compiler. I will note, however, that unsuccessful attempts are much more common than the inverse. If you manage to build a more recent version, I'd love to update the binaries in this repository!

Installation & Build

  1. Install required dependencies:

    brew install gawk help2man bash gcc
    brew reinstall --universal --with-examples gettext
    brew link --force gawk gettext

  2. Build crosstool-ng from source.

    git clone https://github.com/crosstool-ng/crosstool-ng.git
    cd crosstool-ng
    ./bootstrap

    • This will inform you of any missing dependencies.

    • You may need to modify the first line of this file to read:

      /usr/local/bin/bash

    ./configure --prefix=$SOME_LOCAL_PATH

    • I used SOME_LOCAL_PATH=/Users/$user/Local/xtools-ng

    make
    make install
    alias ct-ng=$SOME_LOCAL_PATH/bin/ct-ng

  3. Create two case-sensitive images.

    The large volume will be the build directory. The small volume will contain
    the finished binaries.

    A few configuration parameters:

    • $large-volume: name to be used for large image (e.g: arch-build)
    • $small-volume: name to be used for small image (e.g: arch-tools)
    • $large-location: where to store the large image (e.g: arch-build.dmg)
    • $small-location: where to store the small image (e.g: arch-tools.dmg)

    hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 16g -volname $large-volume $large-location

    hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 1g -volname $small-volume $small-location

  4. Mount the images.

    option 1) just open the images

    option 2) hdiutil attach $LOCATION

  5. Create the config (in small volume).

    This is the hardest part.

    Idea is to start with a known working config (see ct-ng list-samples) and
    then modify it as desired. For example, for the Raspberry Pi 3:

     ct-ng aarch64-rpi3-linux-gnueabi
    

    Then use ct-ng menuconfig to change things around. In particular, modify
    the "Paths" to point to the two volumes that were created.

     * Local tarballs directory: /Volumes/${large-volume}/src
     * Working directory: /Volumes/${large-volume}/.build
     * Prefix directory: /Volumes/${small-volume}/${CT_TARGET}
    
    • Uncheck "render toolchain read-only"
    • Ensure curl is used for downloads. wget fails strangely.
    • Uncheck "add crosstool-ng version to --version output"
  6. Create the src directory.

    mkdir /Volumes/${large-volume}/src

  7. Build.

    ct-ng build

Troubleshooting

Bad Digests

This happens sometimes, for some reason. Just try building again. If that
doesn't work, ct-ng clean, then try again.

You'll need to have the GNU sha512sum coreutil installed. This can come from
brew install coreutils. You'll need to symlink it manually:

  sudo ln -s sudo ln -s /usr/local/bin/gsha512sum /usr/local/bin/sha512sum

@SergioBenitez
Copy link
Owner

Closing this out, but do let me know if I can be of further help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants