Omnimaga

Calculator Community => TI Calculators => Calculator C => Topic started by: sammyMaX on August 14, 2011, 12:17:29 pm

Title: Setting Up Ndless C Compiler
Post by: sammyMaX on August 14, 2011, 12:17:29 pm
I posted this in the "Tutorial - Setting up C Development Environment for the TI-Nspire" section, but the topic hasn't been active for several months so I started a new one.

Anyways, here's my problem: I've added ...blah/ndless2/sdk/bin to my PATH variable (in Ubuntu) but when after typing in "make" in the hello sample folder, I get this error: "make: execvp: nspire-gcc: Permission denied." If I type in "sudo make", I get "make: nspire-gcc: Command not found." What's wrong?
Title: Re: Setting Up Ndless C Compiler
Post by: apcalc on August 14, 2011, 12:22:04 pm
Though it probably is outdated at this point, that tutorial was meant for setup in Windows.  I think some steps must be performed differently when setting up on Linux, but since I don't use Linux, I can't be of any help. :(

Sorry. :(
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 15, 2011, 05:48:18 pm
I've received some help from Lionel Debroux back in the main "Setting up the Development Environment" topic, although I'm still having some problems (and he hasn't responded yet  :o) Hopefully I can still get this thing going in Linux. I do also have Windows 7 installed, and I'll install YAGARTO as a last resort. Meanwhile, if you're interested, I'm making a bignum program (currently very slow but operational in Lua) that I'm porting over to C as soon as this is done: http://ourl.ca/12521 (http://ourl.ca/12521)
Title: Re: Setting Up Ndless C Compiler
Post by: ExtendeD on August 15, 2011, 05:55:09 pm
Please take the time to update the tutorial on Hackspire with any additional setup required for your Linux installation: http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 15, 2011, 06:01:42 pm
I haven't gotten the toolchain to actually work yet... it still doesn't compile samples. I'm waiting on Lionel Debroux (or anyone with knowledge) to help me through this...
Title: Re: Setting Up Ndless C Compiler
Post by: fb39ca4 on August 15, 2011, 06:03:02 pm
What error(s) do you get when you try to compile the samples?
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 15, 2011, 06:09:42 pm
The terminal gives me "make: nspire-gcc: Command not found."
The line after, it gives error 127 with "command not found."
Title: Re: Setting Up Ndless C Compiler
Post by: fb39ca4 on August 15, 2011, 06:21:40 pm
for that, you need to add [ndless directory]/sdk/bin to your path
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 15, 2011, 06:27:07 pm
Yeah, I did :( I also installed the package gcc-4.5-arm-linux-gnueabi, but Lionel told me it was better to use the script he posted for non-Ubuntu versions of Linux, found here: http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction (http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction) I ran the script and got an error while installing gcc.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 15, 2011, 08:09:13 pm
Sorry for the double post, but I found something REALLY weird. I type in "nspire-gcc" into the console, and it gives me "/home/anonymous/ndless2/sdk/bin/nspire-gcc: 26: : Permission denied." It knows where nspire-gcc is!!! But then, I type "sudo nspire-gcc," and then it can't find the command!

My guess is that the PATH variable doesn't include /sdk/bin folder for the root user, but for the normal user PATH does include the bin folder. Does anyone have any ideas?

EDIT: I also tried copying and pasting the contents of my sdk/bin folder into /user/bin, since it's in the PATH variable no matter what, but now I get a permission error even with sudo...
Title: Re: Setting Up Ndless C Compiler
Post by: fb39ca4 on August 15, 2011, 09:10:59 pm
Try changing the permissions of the bin directory, so that anyone can execute.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 16, 2011, 01:30:23 pm
How do I change the permissions of a folder? (chmod on a folder?)
Title: Re: Setting Up Ndless C Compiler
Post by: fb39ca4 on August 16, 2011, 02:56:52 pm
Try "sudo chmod 777" in that directory.
Or, you can run a file browser as root, and in the properties of that folder, change the permissions there. You may also have to do this for the files in that folder, I'm not sure if they inherit permissions from their parent or not.
Title: Re: Setting Up Ndless C Compiler
Post by: Goplat on August 16, 2011, 03:17:34 pm
Try "sudo chmod 777" in that directory.
Or, you can run a file browser as root
It should not be necessary to use sudo or run anything as root in order to change the permissions on a directory that you created.

Edit: On Linux, read permission on a directory means being able to list the files in it, while execute permission means being able to access the files in it (provided you also have access to the individual files). These are probably already both set. It's execute permission on the nspire-gcc file that might be missing.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 16, 2011, 03:21:44 pm
I still can't get it to work, even after changing permissions. :( I guess installing MSYS and YAGARTO are my only options...
EDIT: Could the Nspire-gcc errors be due to the ARM toolchain not being set up correctly? I installed an arm-linux-gnueabi instead of the recommended arm-none-eabi.
Title: Re: Setting Up Ndless C Compiler
Post by: Goplat on August 16, 2011, 03:24:58 pm
Sorry for the double post, but I found something REALLY weird. I type in "nspire-gcc" into the console, and it gives me "/home/anonymous/ndless2/sdk/bin/nspire-gcc: 26: : Permission denied." It knows where nspire-gcc is!!!
26 could mean line 26, the last line of the nspire-gcc script, where it calls gcc. Maybe it's the permissions on gcc that are wrong?

Try running
which arm-elf-gcc arm-none-eabi-gcc arm-linux-gnueabi-gcc
to find the ARM gcc, and check that that's executable.
Title: Re: Setting Up Ndless C Compiler
Post by: fb39ca4 on August 16, 2011, 03:29:20 pm
That may me the case. Can you try using arm-none-eabi-gcc? Or, you could change the nspire-gcc script to use the version you have.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 16, 2011, 03:31:42 pm
Yes, the last line of the script is definitely the problem. Nspire-gcc should be able to run without elevated privileges, right?
Too many posts at once! Yes, I will try installing gcc as arm-none-eabi.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 16, 2011, 05:50:36 pm
Uhmm... how do you configure gcc to be arm-none-eabi? I downloaded the source and I have no idea what to do. In the meantime, I will be installing MSYS and YAGARTO.
Title: Re: Setting Up Ndless C Compiler
Post by: fb39ca4 on August 16, 2011, 07:28:23 pm
Odd, the nspire-gcc i have is configured to work with both versions of gcc.
Title: Re: Setting Up Ndless C Compiler
Post by: ExtendeD on August 17, 2011, 04:23:25 pm
I still can't get it to work, even after changing permissions. :( I guess installing MSYS and YAGARTO are my only options...

Could just show us what a ls -l outputs in Ndless's bin/ directory to be sure?
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 17, 2011, 05:23:22 pm
The console outputs:
total 4
drwxrwxrwx 6 philip philip 4096 2011-08-15 20:16 sdk

EDIT: Finished installing toolchain in Windows.
Title: Re: Setting Up Ndless C Compiler
Post by: ExtendeD on August 18, 2011, 08:54:13 am
Could you please do the same in the bin/ directory containing the nspire-* scripts?
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 18, 2011, 01:42:19 pm
The terminal outputs:
total 36
-rwxrwxrwx 1 philip philip 20715 2011-06-11 09:55 MakeLoader.exe
-rwxrwxrwx 1 philip philip   872 2011-06-11 09:55 nspire-as
-rwxrwxrwx 1 philip philip  1029 2011-08-16 15:32 nspire-gcc
-rwxrwxrwx 1 philip philip  1935 2011-06-11 09:55 nspire-ld

I noticed the "d" in the front when I did this for the ndless2 folder disappeared. What does the "d" represent?
Title: Re: Setting Up Ndless C Compiler
Post by: Lionel Debroux on August 18, 2011, 02:50:04 pm
d = directory, l = symlink.
Title: Re: Setting Up Ndless C Compiler
Post by: ExtendeD on August 19, 2011, 04:29:22 am
And if you just run "./nspire-gcc" from this folder, what happens?
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 19, 2011, 09:28:27 pm
Hmmm... I still get permission denied... as sudo.
Edit: and as a standard user.
Title: Re: Setting Up Ndless C Compiler
Post by: ExtendeD on August 20, 2011, 01:35:09 am
Ok.
And now what does this returns from the same folder: sh -x ./nspire-gcc ?

Sorry for all these tests, but I can't see any other way.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 20, 2011, 04:17:23 pm
I don't mind these tests at all! As long as you're trying to help, it's fine.
The console outputs:
+ uname -s
+ tr [A-Z] [a-z]
+ UNAME=linux
+ dirname ./nspire-gcc
+ DIRNAME=.
+ which readlink
+ readlink ./nspire-gcc
+ [ linux = cygwin ]
+ GCC=
+  -mcpu=arm7tdmi -I ./../include -fpic -fno-builtin
./nspire-gcc: 1: : Permission denied
Title: Re: Setting Up Ndless C Compiler
Post by: AngelFish on August 20, 2011, 04:23:06 pm
Hmmm... I still get permission denied... as sudo.
Edit: and as a standard user.

Are you running this from a device with a FAT filesystem? Linux will tend to return permission denied when the filesystem doesn't properly support permissions.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 21, 2011, 10:18:02 am
I installed Linux under the default file system (I'm pretty sure this is ext4)
Title: Re: Setting Up Ndless C Compiler
Post by: ExtendeD on August 22, 2011, 10:29:04 am
EDIT: Could the Nspire-gcc errors be due to the ARM toolchain not being set up correctly? I installed an arm-linux-gnueabi instead of the recommended arm-none-eabi.
Ok:
- Make sure "which arm-linux-gnueabi-gcc" returns something in a console
- Replace all the occurences of "arm-linux-gnueabi-gcc" with "arm-linux-gnueabi-gcc" in the scripts nspire-gcc, nspire-as and nspire-ld.
Title: Re: Setting Up Ndless C Compiler
Post by: sammyMaX on August 25, 2011, 09:09:23 pm
Okay, I found the problem. I typed in which "arm-linux-gnueabi-gcc" and got nothing back, so I went into Synaptic and found out that while I had packages like "gcc-4.5-arm-linux-gnueabi" and "gcc-4.5-arm-linux-gnueabi-base", I never installed "gcc-arm-linx-gnueabi" because I thought it was the same thing. I already got the environment set up in Windows, but thanks so much for helping me through this!