Updating ARM toolchain

I'm trying to build for device using playdate-cpp (GitHub - nstbayless/playdate-cpp: C++ on playdate)
I'm using a M1 Macbook pro 8gb RAM on the latest system update.

To build for device I do as specified at this page: Inside Playdate with C

When It comes to the linking step I get this error:

/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .data has both ordered

[`.ARM.exidx.text.__aeabi_atexit' in /usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libstdc++.a(atexit_arm.o)] and unordered 

[`.data.__global_locale' in /usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-locale.o)] sections
/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: final link failed: bad value

It is specified on the repository above, and in a forum post that updating the ARM toolchain might solve the problem. I've downloaded and installed a newer version from Arm GNU Toolchain Downloads – Arm Developer
But IDK how to specify the path to that toolchain (which has installed under /Applications/ArmGNUToolchain)

This docs you linked to say this:

This will produce a PDX that’s ready to run on the Simulator. When you want to build for the device, delete the contents of the build folder (or create a second folder), then run these commands which build an ARM binary:

cd build
cmake -DCMAKE_TOOLCHAIN_FILE=<path to SDK>/C_API/buildsupport/arm.cmake ..
make

I think you probably want to provide -DCMAKE_TOOLCHAIN_FILE= /Applications/ArmGNUToolchain or some subdirectory where the binaries are.

No this option's purpose is to link to an SDK CMake file that handles compiling with the ARM toolchain.

I've actually found the solution, with some help from this post: Symlinks to ARM toolchain binaries

When you install the Playdate SDK it also installs a bunch of symlinks to it's own ARM Toolchain in /usr/local/bin

All I did was run the command
ln -sf /Applications/ARMGNUToolchain/13.2.Rel1/arm-none-eabi/bin/* /usr/local/bin
This replaced the SDK's toolchain symlinks with the new ones and it compiled and ran on playdate fine

1 Like