fopetesl
Posts: 44
Joined: Tue Oct 20, 2015 8:08 am

Yesterday it ran. Today "permission denied" even as root

Tue Nov 24, 2015 11:36 am

SPI_check.c

Code: Select all

gcc -Wall -c -o SPIck SPI_Check.c -l bcm2835
No errors.
Same yesterday except yesterday it ran. No code change.
Today ./SPIck "permission denied" even as pi user, sudo or as root.

However. If I

Code: Select all

gcc SPI_Check.c -l bcm2835
./a.out
I get no errors and it runs :)
So If I look at mode I see that a.out is executable but SPIck isn't.
So it's my gcc switches?
:?:

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Yesterday it ran. Today "permission denied" even as root

Tue Nov 24, 2015 11:38 am

An if you do:

Code: Select all

chmod u+x SPIck
to make it executable ?

fopetesl
Posts: 44
Joined: Tue Oct 20, 2015 8:08 am

Re: Yesterday it ran. Today "permission denied" even as root

Tue Nov 24, 2015 12:04 pm

Did that and chown'd.
Still permission denied.
Now I cannot alter or delete the file, says cannot be found :(

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Yesterday it ran. Today "permission denied" even as root

Tue Nov 24, 2015 12:23 pm

ls -la
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

SteveSpencer
Posts: 357
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: Yesterday it ran. Today "permission denied" even as root

Tue Nov 24, 2015 12:28 pm

There are a number of possible avenues to explore.

First, unless you alter your PATH to include the current folder, you have to prefix the executable with ./, such as
./SPIck

Secondly, in the first version of your compile command line, you use both -c and -o. This leaves you with an unlinked object file (that is, ld has not been run) named SPIck.

Remove the -c flag and retry.
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

fopetesl
Posts: 44
Joined: Tue Oct 20, 2015 8:08 am

Re: Yesterday it ran. Today "permission denied" even as root

Wed Nov 25, 2015 9:19 am

SteveSpencer wrote:There are a number of possible avenues to explore.
First, unless you alter your PATH to include the current folder, you have to prefix the executable with ./, such as
./SPIck
Did that. See original post, please.
SteveSpencer wrote:Secondly, in the first version of your compile command line, you use both -c and -o. This leaves you with an unlinked object file (that is, ld has not been run) named SPIck.
Remove the -c flag and retry.
Got it! Sorted :) Thank you.

Return to “C/C++”