AtomLinter/linter-gcc

Atom linter-gcc not working on mac os

Closed this issue ยท 23 comments

Hi,
I've been using linter gcc on linux for a good time, helping me out quite a lot but when i tried to download it on mac os, it simply doesnt want to cooperate. My machine tries to use clang instead even though I've passed the path of my gcc compiler.. Is there any way to switch over to gcc instead of downloading the clang linter?
Thanks a lot

Solved

Self Update (for other curious users / people with the same problem)

xcode had installed its own gcc version which was probably beeing masked by clang even though it appeared in the ''which gcc'' path.
So I manually downloaded a stable gcc version through Homebrew (brew install gcc).
The summary reported that gcc was installed in the path /usr/local/Cellar/gcc/5.3.0.
The most important step was to pass the executable path of my manually installed gcc compiler to the settings of linter-gcc.
That should be /usr/local/Cellar/gcc/5.3.0/bin/gcc-5 (or whatever the summary path of your installation was, plus the /bin/gcc- ).
Hope this was helpful enough to someone else as well and will soften the pain! :)

@pwnywiz huge help for me!! thank you!!

This is really useful information. I think I'll add it to the readme

Thanks. Huge help here! ๐Ÿ‘๐Ÿป

I have set things up as described in this issue. Things are working fine except the following error I am getting.

clang -cclass: error: unable to open output file 'foo.o': 'Permission denied'.

Anyone had a similar problem?

Yes I have the same issue, except it is clang -cc1as (not -cclass). It says it is trying to open the name of my file with a ".o' extension, despite that I have saved it as a ".c" file.

epiks commented

It disappears when I add -fsyntax-only to C++ flags.

It will not disappear when I add -fsyntax-only to C flags.

My gcc is /usr/local/bin/gcc-6 installed with homebrew.

I am having the same issue as @ayberkt , I tried everything but I can't fix it.. I keep getting this error:

clang -cclass: error: unable to open output file 'somefile.o': 'Permission denied'.

Can anyone help with this?

Hi, I'm still getting an error message in Atom:

linter-gcc: Executable not found
"/usr/local/Cellar/gcc/6.2.0/bin/gcc-6" not found

So, the solution proposed is not fixing the issue even tho it would make perfect sense.

Ok, it was fixed by adding the gcc path "/usr/local/opt/gcc/bin/gcc-6" to /etc/paths file.
Sorry for the extra comment

I also getting clang -cc1as: error unable to open output file 'co.o': 'Permission denied', Any one have solved it?

Thanks

Same here!
For instance, I have already added /usr/local/opt/gcc/bin/gcc-6 to my PATH and added in GCC executable path /usr/local/Cellar/gcc/6.3.0_1/bin/gcc-6

@epiks I do as you say. It works.
@hebaishi should you fix this ?

I am getting

Rezwans-iMac:sample rezwan$ make -f mkfile.r
cc -c main.c 
error: unable to open output file 'main.o': 'Permission denied'
1 error generated.
make: *** [main.o] Error 1

Any one have solved it?

Hey, I have solved above issue using following command ๐Ÿ‘

Rezwans-iMac:sample rezwan$ chmod +rw .

I installed gcc 8.1.0 via homebrew and added /usr/local/Cellar/gcc/8.1.0/bin/ to my PATH and added /usr/local/Cellar/gcc/8.1.0/bin/gcc-8 to the linter-gcc setting inside Atom. I aslo try to run ln -s gcc-8 gcc but nothing happened, linting on-the-fly still not working.

Anybody can help me with this problem ? Thanks you

@lamhoangtung
After installing gcc from homebrew and linking gcc-8 to gcc, I added /usr/local/bin/gcc to the GCC Executable Path setting for the package. However, it does look like there might be an issue with lint on-the-fly and using the current directory in the include path; easy work around seems to be to make a dedicated include folder with everything in it and add that to the include path.

And for any MacOS users that have made it this far and are still getting a clang error with all the correct linter and path settings, add the -o /dev/null argument to the C flags settings.

I wanted to use this package for linting C files so I installed gcc with hombrew.
After brew install gcc, gcc still points to the XCode clang thing (/usr/bin) but gcc-8 (in my case - I guess the version number may differ) points to what homebrew installed ($(brew --prefix)/bin/gcc-8).

Thus I set gcc-8 as GCC Executable Path in the package settings. Atom's Settings GUI did not work for me so I used Atom > Config... to edit my config directly by setting execPath:

"*":
    # ...
    "linter-gcc":
        execPath: "gcc-8"
    # ...

I believe that the following sentence could make sense.
PATH=$PATH:/usr/local/Cellar/gcc/8.2.0/bin/gcc-8

Still cannot get linter-gcc to work on Mac OS X . Is there a step by step instuction for noobs :))

thx

Linter-gcc doesn't work at all, Mac OS or not, try with this one : Linter-gcc2

@brankoto I know this is really late, but i had the same issue this week, just add the flag -fsyntax-only to your C and C++ flags in the package settings and it should work.