Rockbox Development > Starting Development and Compiling
rockboxdev.sh doesn't seem to run on Mac OS?
rockbox_dev123:
--- Quote from: Mudb0y on September 27, 2023, 11:57:21 AM ---When I try to run tools/rockboxdev.sh on my M2 MacBook Pro running Senoma, I get no output from my terminal.
--- End quote ---
For a little more info, this is becase tools/rockboxdev.sh has "set -e" on line 7. This means that Bash will exit immediately if (to simplify) a command fails. The failure and exit happens before anything is printed.
See here for more info.
As well as making many commits to update the toolchain, speachy has good advice:
--- Quote from: speachy on September 27, 2023, 12:23:15 PM ---Try running it with 'bash -x rockboxdev.sh' instead and see where it stops.
--- End quote ---
Another way to do the same thing is to change the "set -e" line to "set -ex" and we see that in this case, chris_s is right that the calls to readlink are failing:
--- Quote from: chris_s on September 27, 2023, 12:24:58 PM ---replace readlink with greadlink
--- End quote ---
I have successfully compiled rockbox for an ipodvideo on macOS Sequoia 15.1.1
I'm listening to music on the device now, so it has worked.
I have provided some steps below that can be followed.
I assume you are already using homebrew.
This has only been tested for the arm targets.
Steps to compile the gcc cross compiler with clang on macOS (from the latest master):
--- Code: ---mkdir -p build && cd build
sed -i '' 's/readlink/greadlink/g' ../tools/rockboxdev.sh
sed -i '' 's/mpfr-3.1.6/mpfr-4.1.0/g' ../tools/rockboxdev.sh
sed -i '' 's/mpc-1.0.1/mpc-1.2.1/g' ../tools/rockboxdev.sh
sed -i '' "s/CXXFLAGS='-std=gnu++03' run_cmd/CXXFLAGS='-std=gnu++03 -fbracket-depth=512' run_cmd/" ../tools/rockboxdev.sh
sed -i '' 's/"isl"/"gmp isl"/g' ../tools/rockboxdev.sh
sed -i '' 's%-/tmp%-$TMPDIR%g' ../tools/rockboxdev.sh
--- End code ---
You can now run ../tools/rockboxdev.sh as normal e.g.:
--- Code: ---../tools/rockboxdev.sh --target="a"
--- End code ---
Personally, I prefer to put the compiled binaries in a custom directory and add it to PATH manually e.g.
--- Code: ---rockbox_cross_compiler_dir=$HOME/some/path
../tools/rockboxdev.sh --target="a" --prefix="$rockbox_cross_compiler_dir"
export PATH="${rockbox_cross_compiler_dir}/bin:$PATH"
--- End code ---
This has the benefit of not requiring root to build (as you don't need to access the default prefix directory /usr/local).
I haven't tested running ../tools/rockboxdev.sh as root, but it probably works.
Once you get to the compilation stage for gcc, it will fail.
cd into the build directory (this will be $TMPDIR/rbdev-build/build-gcc/ by default if you didn't specify --builddir to override).
You will need to manually apply the patch here to $TMPDIR/rbdev-build/gcc-4.9.4/gcc/config/host-darwin.c.
You can skip the patch changes to $TMPDIR/rbdev-build/gcc-4.9.4/gcc/config/aarch64/aarch64.h.
After patching, run make. Compilation takes a phenomenally long time on my M1 Macbook Pro. So instead of making a coffee, consider cooking some dinner!
After compilation finishes, run (sudo) make install.
Finally, you can now compile rockbox (optionally specifying the prefix if you used a custom one):
--- Code: ---target="ipodvideo"
../tools/configure --target="$target" --type="n" --prefix="$rockbox_cross_compiler_dir"
make fullzip
--- End code ---
You should now have a build/rockbox-full.zip !
EDIT: gcc compilation time:
--- Code: ---real 25m6.665s
user 74m47.146s
sys 32m44.817s
--- End code ---
chris_s:
That's awesome! :)
--- Quote from: rockbox_dev123 on November 30, 2024, 12:33:33 PM ---This has only been tested for the arm targets.
--- End quote ---
Can confirm this works for MIPS, too. An additional requirement in that case seems to be having gsed (GNU sed) installed and making sure it is used over the MacOS-provided one.
speachy:
--- Quote from: rockbox_dev123 on November 30, 2024, 12:33:33 PM ---
--- Code: ---sed -i '' 's/mpfr-3.1.6/mpfr-4.1.0/g' ../tools/rockboxdev.sh
sed -i '' 's/mpc-1.0.1/mpc-1.2.1/g' ../tools/rockboxdev.sh
--- End code ---
--- End quote ---
Major version bumps in these libraries could introduce codegen differences versus what's already in use, I don't want to bump those requirements for consistency's sake.
(They're already bumped as part of the GCC 9.5 toolchain upgrade, but there are still some issues there)
Meanwhile, I've applied all of the other changes in a way that preserves the ability to build on Linux. Here's the patch; I'd appreciate someone making sure it actually works on MacOS too (after applying those two changes above manually)
https://gerrit.rockbox.org/r/c/rockbox/+/6134
EDIT: I'm 98% sure that the "hosted" (ie X / Y ) tooclchains will not build properly under MacOS, due to their reliance on having system libraries present.
rockbox_dev123:
--- Quote from: speachy on November 30, 2024, 08:26:10 PM ---Major version bumps in these libraries could introduce codegen differences versus what's already in use, I don't want to bump those requirements for consistency's sake.
(They're already bumped as part of the GCC 9.5 toolchain upgrade, but there are still some issues there)
Meanwhile, I've applied all of the other changes in a way that preserves the ability to build on Linux. Here's the patch; I'd appreciate someone making sure it actually works on MacOS too (after applying those two changes above manually)
--- End quote ---
I downloaded an archive of your patch from Gerrit and replaced tools/rockboxdev.sh and added the tools/toolchain-patches/apple_silicon.patch file.
I also did these manual changes:
--- Quote from: rockbox_dev123 on November 30, 2024, 12:33:33 PM ---
--- Code: ---sed -i '' 's/mpfr-3.1.6/mpfr-4.1.0/g' ../tools/rockboxdev.sh
sed -i '' 's/mpc-1.0.1/mpc-1.2.1/g' ../tools/rockboxdev.sh
--- End code ---
--- End quote ---
I can confirm that I am able to build the toolchain on macOS. I can't vote on the patch because I don't have the privileges. I've voted on the patch and would appreciate if this was merged into master.
Looking forward to the eventual GCC 9.5 toolchain upgrade. But until then I am happy to be able to build and I'm aware that I should probably switch to rockbox built on Linux (with the correct mpfr and mpc versions) before submitting any bug reports.
Thanks to all for your work.
Navigation
[0] Message Index
[*] Previous page
Go to full version