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

Compilation on MacOs - M2 #355

Closed
HouseSimOn opened this issue Aug 26, 2023 · 22 comments
Closed

Compilation on MacOs - M2 #355

HouseSimOn opened this issue Aug 26, 2023 · 22 comments
Assignees
Labels
bug Something isn't working macos An Apple macOS specific problem pdf

Comments

@HouseSimOn
Copy link

HouseSimOn commented Aug 26, 2023

I've performed steps from https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf to install compiler:

$ brew install cmake
$ brew tap ArmMbed/homebrew-formulae
$ brew install arm-none-eabi-gcc

After that I tried to compile project and I got following error:
arm-none-eabi-gcc: fatal error: cannot read spec file 'nosys.specs': No such file or directory

Then I uninstalled arm-none-eabi-gcc using brew and installed brew install --cask gcc-arm-embedded. Now compilation works, but I see that compiler identification is AppleClang rather than arm-none-eabi-.

Configuring cmake I see correct compilers:

% cmake -G "Unix Makefiles" ..
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
-- The C compiler identification is GNU 12.3.1
-- The CXX compiler identification is GNU 12.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /opt/homebrew/bin/arm-none-eabi-gcc

But during compilation I see AppleClang:

% make 
[  1%] Creating directories for 'ELF2UF2Build'
[  2%] No download step for 'ELF2UF2Build'
[  3%] No update step for 'ELF2UF2Build'
[  4%] No patch step for 'ELF2UF2Build'
[  5%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is AppleClang 14.0.3.14030022
-- The CXX compiler identification is AppleClang 14.0.3.14030022

Why there is info about AppleClang compiler?

@kilograham
Copy link

Because tools like elf2uf2 and pioasm are compiled from source using the native compiler

@lurch
Copy link
Contributor

lurch commented Aug 27, 2023

ping @aallan in case the instructions in the Getting Started PDF need updating for M2 Macs.

@timlukins
Copy link

Installing on a M2 Mac today this worked for me. Thanks for up-to-date hint.

However, I had to not only do a brew uninstall arm-none-eabi-gcc (as I had installed this first) - but then a brew autoremove to get rid of some lingering files before the brew install --cask gcc-arm-embedded would work.

i.e.

% brew uninstall arm-none-eabi-gcc
Uninstalling /opt/homebrew/Cellar/arm-none-eabi-gcc/13.2.0... (566 files, 155.8MB)

% brew install --cask gcc-arm-embedded
==> Downloading https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-darwin-arm64-arm-none-eabi.pkg
Already downloaded: /Users/tim/Library/Caches/Homebrew/downloads/aece88d979bd1713368d7f7e09da4283d884cf79f498e99ac02d5ad8415bcdb7--arm-gnu-toolchain-12.3.rel1-darwin-arm64-arm-none-eabi.pkg
==> Installing Cask gcc-arm-embedded
==> Running installer for gcc-arm-embedded; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
installer: Package name is arm-gnu-toolchain-12.3.rel1-darwin-arm64-arm-none-eabi
installer: Upgrading at base path /
installer: The upgrade was successful.
==> Purging files for version 12.3.rel1 of Cask gcc-arm-embedded
Error: It seems there is already a Binary at '/opt/homebrew/bin/arm-none-eabi-as'.

 % brew autoremove                       
==> Autoremoving 4 unneeded formulae:
arm-none-eabi-binutils
gmp
libmpc
mpfr
Uninstalling /opt/homebrew/Cellar/arm-none-eabi-binutils/2.41... (81 files, 30.6MB)
Uninstalling /opt/homebrew/Cellar/libmpc/1.3.1... (12 files, 470KB)
Uninstalling /opt/homebrew/Cellar/mpfr/4.2.0-p12... (30 files, 3MB)
Uninstalling /opt/homebrew/Cellar/gmp/6.2.1_1... (21 files, 3.2MB)

% brew install --cask gcc-arm-embedded  
==> Downloading https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-darwin-arm64-arm-none-eabi.pkg
Already downloaded: /Users/tim/Library/Caches/Homebrew/downloads/aece88d979bd1713368d7f7e09da4283d884cf79f498e99ac02d5ad8415bcdb7--arm-gnu-toolchain-12.3.rel1-darwin-arm64-arm-none-eabi.pkg
==> Installing Cask gcc-arm-embedded
==> Running installer for gcc-arm-embedded; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
installer: Package name is arm-gnu-toolchain-12.3.rel1-darwin-arm64-arm-none-eabi
installer: Upgrading at base path /
installer: The upgrade was successful.
==> Linking Binary 'arm-none-eabi-as' to '/opt/homebrew/bin/arm-none-eabi-as'
==> Linking Binary 'arm-none-eabi-c++' to '/opt/homebrew/bin/arm-none-eabi-c++'
==> Linking Binary 'arm-none-eabi-c++filt' to '/opt/homebrew/bin/arm-none-eabi-c++filt'
==> Linking Binary 'arm-none-eabi-cpp' to '/opt/homebrew/bin/arm-none-eabi-cpp'
==> Linking Binary 'arm-none-eabi-elfedit' to '/opt/homebrew/bin/arm-none-eabi-elfedit'
==> Linking Binary 'arm-none-eabi-g++' to '/opt/homebrew/bin/arm-none-eabi-g++'
==> Linking Binary 'arm-none-eabi-gcc' to '/opt/homebrew/bin/arm-none-eabi-gcc'
==> Linking Binary 'arm-none-eabi-gcc-12.3.1' to '/opt/homebrew/bin/arm-none-eabi-gcc-12.3.1'
==> Linking Binary 'arm-none-eabi-gcc-ar' to '/opt/homebrew/bin/arm-none-eabi-gcc-ar'
==> Linking Binary 'arm-none-eabi-gcc-nm' to '/opt/homebrew/bin/arm-none-eabi-gcc-nm'
==> Linking Binary 'arm-none-eabi-gcc-ranlib' to '/opt/homebrew/bin/arm-none-eabi-gcc-ranlib'
==> Linking Binary 'arm-none-eabi-gcov' to '/opt/homebrew/bin/arm-none-eabi-gcov'
==> Linking Binary 'arm-none-eabi-gcov-dump' to '/opt/homebrew/bin/arm-none-eabi-gcov-dump'
==> Linking Binary 'arm-none-eabi-gcov-tool' to '/opt/homebrew/bin/arm-none-eabi-gcov-tool'
==> Linking Binary 'arm-none-eabi-gdb' to '/opt/homebrew/bin/arm-none-eabi-gdb'
==> Linking Binary 'arm-none-eabi-gdb-add-index' to '/opt/homebrew/bin/arm-none-eabi-gdb-add-index'
==> Linking Binary 'arm-none-eabi-gfortran' to '/opt/homebrew/bin/arm-none-eabi-gfortran'
==> Linking Binary 'arm-none-eabi-gprof' to '/opt/homebrew/bin/arm-none-eabi-gprof'
==> Linking Binary 'arm-none-eabi-ld' to '/opt/homebrew/bin/arm-none-eabi-ld'
==> Linking Binary 'arm-none-eabi-ld.bfd' to '/opt/homebrew/bin/arm-none-eabi-ld.bfd'
==> Linking Binary 'arm-none-eabi-lto-dump' to '/opt/homebrew/bin/arm-none-eabi-lto-dump'
==> Linking Binary 'arm-none-eabi-nm' to '/opt/homebrew/bin/arm-none-eabi-nm'
==> Linking Binary 'arm-none-eabi-objcopy' to '/opt/homebrew/bin/arm-none-eabi-objcopy'
==> Linking Binary 'arm-none-eabi-objdump' to '/opt/homebrew/bin/arm-none-eabi-objdump'
==> Linking Binary 'arm-none-eabi-ranlib' to '/opt/homebrew/bin/arm-none-eabi-ranlib'
==> Linking Binary 'arm-none-eabi-readelf' to '/opt/homebrew/bin/arm-none-eabi-readelf'
==> Linking Binary 'arm-none-eabi-size' to '/opt/homebrew/bin/arm-none-eabi-size'
==> Linking Binary 'arm-none-eabi-strings' to '/opt/homebrew/bin/arm-none-eabi-strings'
==> Linking Binary 'arm-none-eabi-strip' to '/opt/homebrew/bin/arm-none-eabi-strip'
==> Linking Binary 'arm-none-eabi-ar' to '/opt/homebrew/bin/arm-none-eabi-ar'
==> Linking Binary 'arm-none-eabi-addr2line' to '/opt/homebrew/bin/arm-none-eabi-addr2line'
🍺  gcc-arm-embedded was successfully installed!

@stefannilsson
Copy link

Thanks a lot, @timlukins ! Worked great on my M1 too.

@GoldeggCoder
Copy link

Thanks alot! Worked also on my M2 machine!!! Searched for hours. Got it now

@allthingsclowd
Copy link

Thank you - this solved an error I was getting on my Apple M2 Max.

"arm-none-eabi-gcc: fatal error: cannot read spec file 'nosys.specs': No such file or directory"

Got this after following the "Getting started Guide"

@aallan
Copy link
Contributor

aallan commented Oct 10, 2023

Okay, transferring this to the pico-feedback repo as a documentation problem.

@aallan aallan reopened this Oct 10, 2023
@aallan aallan transferred this issue from raspberrypi/pico-sdk Oct 10, 2023
@aallan aallan added bug Something isn't working macos An Apple macOS specific problem pdf labels Oct 10, 2023
@DenoG1997
Copy link

Thanks a lot!!!!!!!!!!!! finally after 12 hours of debugging.......

@aallan
Copy link
Contributor

aallan commented Oct 23, 2023

@nathan-contino We should possibly look at this as your intro to the PDF toolchain this week.

@mjmdavis
Copy link

FWIW I had the same issue which was resolved by brew install --cask gcc-arm-embedded

@opsnlops
Copy link

Same for me. I had to remove the old compiler and brew autoremove to let it clean up before I could get the gcc-arm-embedded install to go. Once I got the new one installed it was smooth sailing.

@axeleckert
Copy link

Thank you very much! Works after

  1. brew uninstall arm-none-eabi-gcc
  2. brew auto remove
  3. brew install --cask gcc-arm-embedded

on my Mac M2 Max Sonoma!

@aallan
Copy link
Contributor

aallan commented Nov 13, 2023

See also raspberrypi/pico-sdk#1543 for OpenOCD related things.

@aallan
Copy link
Contributor

aallan commented Nov 20, 2023

Doesn't look to be anything specific to M2, or Sonoma. Looks to be a Homebrew imposed thing. General Mac instructions need updating in the Getting Started guide.

@aallan
Copy link
Contributor

aallan commented Nov 20, 2023

Also see #335

@aallan
Copy link
Contributor

aallan commented Dec 14, 2023

This one should be closed, right @nathan-contino this got fixed in the recent databooks PR?

@nathan-contino
Copy link
Collaborator

Yes!

@cryptographix
Copy link

cryptographix commented Jan 5, 2024

Still not in the latest available pdf

(https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf) is still incorrect.

Is there a release date for a new version?

@aallan
Copy link
Contributor

aallan commented Jan 5, 2024

No, we haven't made a documentation release yet. There will be one in the next month or so.

@happyldw
Copy link

감사합니다.
알려주신 대로 하니 빌드가 잘 됩니다.

@aallan
Copy link
Contributor

aallan commented Jan 19, 2024

Documentation release should happen beginning of next week.

@taesungh
Copy link

taesungh commented Feb 6, 2024

Thank you for the documentation update @aallan. However, I want to note that tapping ArmMbed/homebrew-formulae should not be necessary anymore as gcc-arm-embedded is a native cask, so I think the documentation in 9.1.1 could be further updated to remove the unnecessary tap

brew install cmake
brew install --cask gcc-arm-embedded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos An Apple macOS specific problem pdf
Projects
None yet
Development

No branches or pull requests