Reply
Thread Tools
Posts: 53 | Thanked: 2 times | Joined on Apr 2011
#1
Recently I compiled my first c++ command line app on my Nokia N900. But I can't start it using "./". When I try to use it normally it tells me that permission is denied and then, when I use root, that command doesn't exist. Got any idea how to fix it?

Last edited by oneat; 2011-04-16 at 09:47.
 
antezz's Avatar
Posts: 172 | Thanked: 160 times | Joined on Jan 2010 @ Sweden
#2
Did you try the full path?
 
humble's Avatar
Posts: 355 | Thanked: 395 times | Joined on Dec 2009 @ USA
#3
Code:
chmod +x yourbinary 
./yourbinary
Edit:you have to be in the same dir as "yourbinary".
__________________
Would you like to Donate?

My"Current Project(s)":
[Resurrecting] DON

Last edited by humble; 2011-04-16 at 09:55.
 
Zas's Avatar
Posts: 196 | Thanked: 113 times | Joined on Jun 2010 @ Finland
#4
You can't run anything from MyDocs since its fat. Move it to /home/user or some other ext2 or ext3.
 

The Following User Says Thank You to Zas For This Useful Post:
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#5
Originally Posted by oneat View Post
Recently I compiled my first c++ command line app on my Nokia N900. But I can't start it using "./". When I try to use it normally it tells me that permission is denied and then, when I use root, that command doesn't exist. Got any idea how to fix it?
./ stands for the current directory. You want to add the executable file name to it. Assuming the binary of your compiled C++ application is called "myapp", and you copied it to the current directory (the one that is printed when entering "pwd"), you can start it using
Code:
./myapp
. You can also use the absolute path to the file, i.e.
Code:
/home/user/myapp
if the file is in your $HOME. Be aware that the MyDocs partition is mounted with noexec, so you can't execute anything on it (MyDocs is the vfat partition that you see when you connect your device to your computer using Mass Storage Mode. In addition to that, you have to set the executable flag on the file, i.e.
Code:
chmod +x myapp
if "myapp" is in the current directory, or with the full or relative path if it is not.

So basically, check the following:
  • Make sure your binary is executable, i.e. using chmod +x
  • Make sure your binary is NOT on MyDocs, as it's mounted noexec
  • Use either the relative or absolute path to your file to start it

Via SSH, you can do it like that (assuming "myapp" is on your computer in the current directory, and "n900" is the IP address/hostname of your N900):

Code:
scp myapp user@n900:
ssh user@n900
chmod +x myapp
./myapp
A good resource for learning how to use the command line is http://www.linuxcommand.org/ - it's a good read even for N900 users, although it's targetting Desktop Linux mostly.
 

The Following 2 Users Say Thank You to thp For This Useful Post:
Posts: 53 | Thanked: 2 times | Joined on Apr 2011
#6
is it possible to make MyDocs executable ?
 
Posts: 1,425 | Thanked: 983 times | Joined on May 2010 @ Hong Kong
#7
Originally Posted by oneat View Post
is it possible to make MyDocs executable ?
Unless you repartition it to ext2/3, but then your Windows would not be able to access to it by default.
 
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#8
Originally Posted by oneat View Post
is it possible to make MyDocs executable ?
Yes, if you edit /etc/fstab and apply the following changes to the MyDocs line (usually starting with /dev/mmcblk0p1):
  • Replace "noexec" with "exec" (allows execution)
  • Replace "fmask=0133" with "fmask=0033" (sets the +x bit for the owner of the file)

After the changes, you have to reboot for the changes to take effect (you could also just umount and mount it, if no application is using files on MyDocs).

This will make all files on MyDocs executable by default. This can be a security hazard. Use it with caution! If you don't know the security implications, please don't do that and simply copy files to $HOME instead. You have been warned.
 

The Following 3 Users Say Thank You to thp For This Useful Post:
Posts: 1,258 | Thanked: 672 times | Joined on Mar 2009
#9
fstab is autogenerated *after* filesystems have been mounted, to have a contents reflecting the actions taken by the init scripts. Editing it probably wont change anything
 
Posts: 1,042 | Thanked: 430 times | Joined on May 2010
#10
Originally Posted by shadowjk View Post
fstab is autogenerated *after* filesystems have been mounted, to have a contents reflecting the actions taken by the init scripts. Editing it probably wont change anything
You can actually just by editing /usr/lib/genfstab.awk using vi

I have mmcblk0p1 to mmcblk0p7 custom partitions all mounted automatically every reboot and all are automatically inserted at fstab
 

The Following User Says Thank You to Radicalz38 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 20:55.