• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Fixed Erro: sh: ./gradlew: Permission denied

zuibaf

Member
Joined
Sep 29, 2017
Messages
61
Hi, I try compile a example what Is distributed with Cerberus, this example:
Cerberus/examples/mojo2/bouncyaliens.
Then, I try compile, I noted what the folder template android, what it is in
Cerberus/targets have been copied for a folder inside of folder
Cerberus/examples/mojo2/bouncyaliens/bouncyaliens.buildv2017-07-31.
But, Cerberus not compiled, it is appeared this error message:
Erro: sh: ./gradlew: Permission denied
I make many tests, then I discovered what the file gradlew what it is inside gradetemplate, what have been copied for the folder of build, fault the permission for execute, I realize the change, after this, the compilation work!!!
Then, I resolved, to go in folder of name target and change permission of file gradlew for permiting execute but I try compile other example, however, the permissions que I realized are not copied for folder build.
Then, I have to go on the folder builder, and change the permission of file gradlew for compilation have successing.
How do I fix it for have not what
Perform this manually.
[Sorry for English. I speak Portuguese natively but English only read almost fluently, I do not write very well yet.]
 
Is it Linux? If so, no idea, it works for me out-of-box, I run everything inside of my home folder...
 
Apple user by any chance?.
Use
sudo chown -R your_user_name path_to_cerberus_directory
sudo chmod -R 755 path_to_cerberus_directory

Or use the Get Info dialog on the Cerberus directory to set users. Don't forget to click the little gear wheel and select apply to enclosed items.
 
Hi, my Operational System is Linux Fedora 25.
Now, I changed the permission of all folder pra rwxrwxrwx and changed the path of installation for the folder home of my user.
I try compile a example, this message of error appears again.

I noticed Cerberus when copying the folder 'gridtemplate' to the 'build' folder, changing the permission of the file 'gradlew' from 'rwxrwxrwx' to 'rw-rw-r--'. So, if I go there and change the permission to run 'x', the build process normally occurs.
 

Attachments

  • cerberus_1.png
    cerberus_1.png
    67.2 KB · Views: 483
  • cerberus_2.png
    cerberus_2.png
    95 KB · Views: 634
  • cerberus_3.png
    cerberus_3.png
    157.1 KB · Views: 556
@Martin: Mark this down as a bug.
When the template is copied the gradlew shell scripts execute permissions are not being set, plus Windows CRLF line endings are getting in the way, gives error /usr/bin/env 'bash\r. Could be a Windows git clone thing.
Using find . -type f -print0 | xargs -0 dos2unix in the Android template root directory before compressing should get rid of them.

Edit: Will add a link to a new transcc_linux soon.
 
Last edited:
@zuibaf: OK. Back up your current transcc_linux then download and extract this in it's place. This was compiled on Fedora Workstation 26 64bit.
Open a command line terminal and change directory into the directory
Cerberus/targets/android/template
and then execute the line below
find . -type f -print0 | xargs -0 dos2unix
 
Thanks dawlane, will keep it in mind for the next release.
 
Thanks dawlane, will keep it in mind for the next release.
@Martin : find . -type f -print0 | xargs -0 dos2unix will affect all file ending and not just those for Linux text files. It's usually smart enough to tell the difference between files, but its not infallible. You should never run any tools that make these kinds of alteration directly on your main repository. Always make work on a copy.

This command example allows you to exclude files via blob.
find . -type f ! \( -name '*.jar' -o -name '*.zip' -o -name '*.class' \) -exec dos2unix {} {} \;
 
Last edited:
@MikeHart @Martin
I compile for a new version 2018-03-02.
In this version 2018-03-02, in linux fedora version 26, transcc works for the targets desktop and html5.
But, I try compiling for target android, this error sh:./gradlew: Permission denied.
I noticed that the folder where the templates for android is stored: 'targets / android / template / gradletemplate' the gradlew file has the '-rw-rw-r--' permission, so compiling this permission is copied to the folder of the Android build.
So, if I modify the permission of the gradlew file in the android target's build folder, to '-rw-rw-r-x' and compile again, the compilation succeeds !!!
However, if I change the 'gradle' file from the 'targets / android / template' folder to '-rw-rw-r-x', that is, permission also to execute, so when copying the file this permission is copied in the destination directory, when checking, I see that the permissions were not copied correctly in the destination folder.
It looks like Cerberus while copying the files, does not copy the permission of 'execute' correctly into the destination directory.
 

Attachments

  • cerberus_erro_1.png
    cerberus_erro_1.png
    50.6 KB · Views: 421
  • cerberus_erro_2.png
    cerberus_erro_2.png
    107 KB · Views: 606
  • cerberus_erro_3.png
    cerberus_erro_3.png
    98 KB · Views: 458
  • cerberus_erro_4.png
    cerberus_erro_4.png
    70.3 KB · Views: 465
I did another test here, I create an file on the folder 'targets/android/template/gradletemplate', with an permission '-rwxrwxrwx', permission total.
I deleted the build folder, which was created so that Ceberus again copied the files from the 'targets/android/template/gradletemplate' folder to the build folder, however, the file I created in the template with full permission was copied with the permission changed :
'-rw-rw-r--'.
I also noticed that Ceberus copied the files and all files, except the folders, with the '-rw-rw-r--' permission.
 
A detail:
When I create a file here on the file system, it creates the default permission: '-rw-rw-r--'.
 
I did another test here, I compile a source as superuser, of this way: sudo ./rebuildall.sh.
After creating Ted and trans, the error persist for target android.
The contour I make here is to go in the build folder and change the permission to execute and then I execute the compilation again, in this case, as the folder already has the file, transcc compiles correctly.
In the template folder, unfortunately, even as superuser, if the permission is changed to run as well, when compiling for the android target, the execute permission is not copied to the destination folder.
 
So you are suggesting that transcc should set the permissiins after a build?
 
I do not think so.
The errors do not occur on other platforms because the files are passed to g++.
I think, that the problem is in the implementation of CopyFile, because, analyzing here, at line 91, of the file 'android.cxs', is where CopyFile is used.
So, in the main.cpp file, the implementation for windows and mac is using the Copy File of the platform, however, in the implementation for other platforms, the _fopen command is used to open a binary file and in the destination folder , a new file is created and copied using fread the contents of the source file to the destination.
For example, on my machine, if I create any file, for example, using touch "zuibaf.txt", the permission created by default is this, ".rw-rw-r--", just the permission that is created in the destination folder when the CopyFile command is executed.
That is, in the linux platform, a _fopen command is used to create the file, in this file it is created with the default permission '.rw-rw-r--' and then it is written using the fwrite command.
 

Attachments

  • cerberus_erro_2.png
    cerberus_erro_2.png
    188.3 KB · Views: 492
To sum it up, when on line 2407 the file is created "wb", the permission created by default is the same if I were in the directory and created an empty file, in this case ".rw-rw-r--", in this case, it uses the default permission to create file.
On the mac and windows platform, the CopyFile implementation is using the 'Copy File' api of the platform, in the case of other platforms, it is used _fopen [fopen], to create an empty file in the destination directory and then uses fread to read the source file and fwrite to save the file.
That is, when using fopen to create the file on the target, the created permission is the same if the user creates an empty file.
In the implementation of CopyFile, in windows is used 'CopyFile' and 'CopyFile' of windows copies the attributes of the source file to the destination. The same must occur in Mac, however, for other platforms, fopen is used, in this case the source file is copied bit by bit to the destination.
In this case, as I understand it, the file created in the destination does not have the same permissions as the source file, when the platform is different from windows or mac.
 
I noticed that the error is probably in the implementation of CopyFile, for different platforms of windows and mac, I did change in the file, compile the source again.
Then I compile for target android, and no error occurred.
I 've captured the permissions of the source file, then if there was no error in the stat function, I opened the target file with fopen, using, "wb", and closed it, creating an empty file, then executed the chmod function to change the permission of the file, taking the value that was returned by the stat function, if there is no error, to change the permission, I continue, now, copying the file.
 

Attachments

  • cerberus_erro_2.png
    cerberus_erro_2.png
    188.3 KB · Views: 573
I've realized this fix, however, I do not know if this is the best code to use.
For me, here, it's compiling normally for the android target.
While, there is no fix, I will use this modified transcc.
 
Back
Top Bottom