Clang Error Raised When Compiling Using AVR-GCC on Mac OS - clang

I am trying to cross compile a program for an AVR using avr-gcc that I installed through macports. In the terminal:
avr-gcc -O1 -DF_CPU=1000000UL -DBAUD=9600 -I. -I/opt/local/avr/include/ -Wl,-Map,main.map -mmcu=atmega328p main.c -c
which results in the errors:
clang: error: unknown argument: '-mgcc-isr'
clang: error: unknown argument: '-mno-skip-bug'
The above cross compile used to work but after updating to Catalina and reinstalling avr-gcc something has gotten messed up. Searching google I have found that, with newer versions of Clang, if Clang doesn't recognize the command line argument then it raises an error. The suggestions said to use something like -Wno-error=gcc-isr. So my command becomes:
avr-gcc -O1 -Wno-error=gcc-isr -DF_CPU=1000000UL -DBAUD=9600 -I. -I/opt/local/avr/include/ -Wl,-Map,main.map -mmcu=atmega328p main.c -c
which results in:
cc1: error: ‘-Werror=gcc-isr’: no option -Wgcc-isr
It looks like something is getting messed up between Clang and avr-gcc. Although I'm not sure why Clang gets called when I am using avr-gcc. Does anyone have any idea what's going on here?

Ok, I'm not sure why clang gets called with avr-gcc but I did manage to get the code to compile by uninstalling: (1) avr-gcc and (2) avr-binutils through macports using:
sudo port uninstall avr-binutils
sudo port uninstall avr-libc (I uninstalled this because it depends on avr-gcc)
sudo port uninstall avr-gcc
then I reinstalled it using
sudo port install avr-gcc
which asked if I wanted install avr-binutils. I then reinstalled avr-libc. These are the direct steps. I made a mistake by hitting 'N' when it asked me if I wanted to install avr-binutils. So I had add:
sudo port clean avr-binutils
to clear that error. Once that was cleared I could follow the above steps. Again, this cleared the error by just reinstalling the cross compiling software but I still think there is some underlying misunderstanding of the original problem.

I ran into the same issue while I was trying to compile a keyboard firmware that runs on an atmega32 microcontroller and I had to rebuild avr-gcc locally to fix things.
While the accepted solution did not work for me - I got the same error again
clang: error: unknown argument: '-mgcc-isr'
clang: error: unknown argument: '-mno-skip-bug'
What did work for me was to first uninstall avr-binutils and avr-gcc like so
brew uninstall --ignore-dependencies avr-binutils
brew uninstall --ignore-dependencoes avr-gcc#9
and then reinstall avr-binutils
brew install avr-binutils
Instead of simply reinstalling avr-gcc, install from source like so
brew install --build-from-source avr-gcc#9

Related

RN pod install occurs the error message "machine `arm64-apple' not recognized" regardless of Rosseta or not

I'm suffering from the error message below.
<PATH>Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing: Unknown `--is-lightweight' option
Try `<PATH>Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
Invalid configuration `arm64-apple-darwin21.4.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin21.4.0 failed
Open terminal and arch -x86_64 pod install is not working.
Open terminal as Rosetta Mode and pod install also is not working.
I guess it is related to something bug with libraries with Flipper-Glog however, I don't have any idea where I start finding to solve this issue. (machine `arm64-apple' not recognized)
Could you give me some advice about to solve this issue?
Thanks!

How to install gfortran for MacOS Monterey (version 12.2.1) M1?

I am trying to install Fortran on my MacBook MacOS Monterey (version 12.2.1) M1 chip laptop. I downloaded and installed the gfortran from this website (gfortran 12-Dec 18, 2021): https://github.com/fxcoudert/gfortran-for-macOS/releases with no issues.
I then followed the instructions on this link: https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/ and when following the steps to do a 'quick check' with C++, I receive these errors:
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_3.so] Error 1
I attempted to solve the issue by inputted this command in terminal:
ln -s /usr/local/gfortran /opt/R/arm64
But I received a "Permission denied" output.
There may be issues with installing gfortran on Monterey M1 chip, but I think the main problem is where my gfortran is located on my laptop. I am not sure. Does anyone have a solution as to how to relocate gfortran on my laptop through Terminal?
Much appreciated.
Have you tried to install and update XCode Command Line Tools? In principle, it comes with gcc and gfortran. Once installed, you do not need to use directly XCode to run gfortran on a terminal. XCode is available from the app store.
You can also install gcc (which contain gfortran) via brew brew install gcc.

"fftw.h not found" after installing it in Mac terminal

I'm running problem of getting fftw working. I'm on mac and have installed fftw using brew on the terminal.
brew install fftw
It gave me a reminder of "Warning: fftw 3.3.8 is already installed and up-to-date" if I put in this install command again. But I cannot call fftw.h in C. It gave me an error of "fftw.h file not found" if I have a line of
#include <fftw.h>
I also tried installing directly by
./configure
make
make install
and ran
make check
It told me "FFTW transforms passed basic tests!", but it still didn't work in C.
Any suggestions would be appreciated!
You need to specify the location of the header to your compiler. Adding the directory inclusion for either installation in both cases the header can be found in /usr/local/include
gcc ... -I/usr/local/include ...
Additionally, as has been pointed out, you need to #include <fftw3.h>. Also be reminded, that your autoconf build only has the double precision functionality installed. While the brew installation brings all 3 precisions, float, double and long double.
You will hit a wall again, possibly, when you want to link. Add -L/usr/local/lib to the linker command to be able to link like so -lfftw3 -lfftw3f -lfftw3l etc

valgrind installation using brew on macOS High Sierra 10.13.2

I get the following error when trying to install valgrind on the version of macOS using brew:
valgrind: This formula either does not compile or function as expected
on macOS versions newer than Sierra due to an upstream
incompatibility. Error: An unsatisfied requirement failed this build.
I have tried to follow suggestions from all related posts on the issue, and even tried building valgrind using the ./configure option after downloading the source tarball. But that too fails with a gcc incompatibility error, which I am unable to overcome, despite following workaround suggestions on the Web.
Any help would be appreciated.
TIA
Vinod
brew install --HEAD valgrind seems to work now.
See this issue for more details.
You may wish to build it directly and install instead of using home-brew. I have created a port of valgrind 3.13.0 to work on macOS High Sierra (10.13.x). You can get it here: https://github.com/padiakalpesh/valgrind_3.13_high_sierra
Once you have obtained the source, run the following commands from inside the source directory:
./configure
make
sudo make install

How do I install rpy2 when clang doesn't support OpenMP (Mac OSX)?

I am trying to use pip to install rpy2 on OSX 10.12.5. I get this error:
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
error: command '/usr/bin/clang' failed with exit status 1
From what I understand, this is because my version of clang does not support OpenMP. Using homebrew, I installed LLVM 8.1.0 (clang 802.0.42), but now I need to update clang to support OpenMP. Can anyone give me detailed instructions of how to go about this? I am not understanding the other sources I am reading online.
I just got rpy2-2.9.0 to install via pip on Mac OSX 10.13, after getting the same error you reported, by downgrading to R 3.3.3, downloaded from https://cran.r-project.org/bin/macosx/. I just re-installed R 3.3.3 then re-ran 'pip install rpy2' and it installed fine.

Resources