We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

Compile on SD-Card

asked 2014-04-03 00:52:33 +0200

MasterOfMemory gravatar image

Recently I added a (used) SD-Card into my Jolla. I used it before in my old Android device. I did NOT reformat the card. I copied one of my hobby projects remotely onto the sd card and tried to compile it which did not work because of C++11 not being supported by the given compiler version (gcc/g++ 4.6.4). I then tried to compile a little test program consisting of pretty basic C++ Code. (See below) It compiled but I could not run it. (./a.out failed) The error was:

[nemo@localhost sandbox]$ ./a.out

-bash: ./a.out: Permission denied

However executing it with devel-su did fix the error but I got no output at all. A look with ls -lis gave me:

[nemo@localhost sandbox]$ ls -lis a.out

1095 32 -rwxr-xr-x 1 nemo nemo 6837 2014-04-02 23:26 a.out

Moving the source to my home directory and compiling it there worked as usual - Compile and execute with user rights with my numbers being printed. Even moving the compiled fille to the home directory gave me my output. Is it normal that the file cannot be executed with user rights from SD-Card and if done with super user does not work (as it should?) Might it be a right management problem since the SD came from android or is that a general problem? Thanks for help.

Appendix A - Used Code

test.cpp:

#include <iostream></iostream>

int main() { for( int i = 0; i < 12; ++i ) std::cout << i << std::endl; }

Compiled with: g++ test.cpp

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
4

answered 2014-04-04 02:13:10 +0200

gcobb gravatar image

The problem is that Jolla mounts the SD card with the "noexec" option. This is quite common for removable media (reduces the risk that someone puts a malicious script or program on a card and somehow gets you to execute it - either by trickery or by exploiting some bug).

You could remount with that option turned off, but the easier solution is to copy the file to your home directory, as you found.

edit flag offensive delete publish link more

Comments

Sorry for the (very) late response. That pretty much explains it. Thank you.

MasterOfMemory ( 2014-04-24 03:23:39 +0200 )edit
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2014-04-03 00:52:33 +0200

Seen: 430 times

Last updated: Apr 04 '14