- 15th October 2013 at 9:48 am #64663
I’m having trouble running software that I have written for the minimorph in C. The program is stored on the SD card, when I navigate to “/mnt” using the terminal on my linux mint host pc connected to the minimorph and run my code using “./c_code” (c_code being the name of the file), the output I get is ” line 1: syntax error: unexpected “(” “. When I try to run the code using the codescape debugger, I get “Error: Cannot open Program File”.
I have tried running the program having booted the board from the SPI flash and with the “vmlinux.ub” file on the SD card and have had the same result.
I wrote a simple Hello, World application and compiled it using the meta-linux gcc and was able to run that just fine.
Do you know what could be wrong with my setup?15th October 2013 at 9:52 am #64672
that does sound slightly strange.
When you say “compiled it using the meta-linux gcc and was able to run that just fine“, where did you run this?
On your host, please let me know the output of
$ file c_code15th October 2013 at 10:31 am #64671
I ran the “Hello, World” application through the terminal as well using:
The output of “file c_code” is:
-sh: file: not found
The same output is returned if i type “file filename.ext” for any file in the “/mnt” directory.15th October 2013 at 10:43 am #64670
So I can better understand your situation, please could you answer all of the following questions…
- Can you list the files in /mnt from a terminal on the minimorph?
- If you do a long listing (ls -l /mnt/), is there a filesize associated with the files?
- If you edit the file using vi, is it binary or text in the file.
With a bracket on line 1, it sounds like it’s not been compiled correctly.
- Can you confirm that you compiled code_test or are you running the one provided in the SDK?
- What version of SDK do you have?
Sean.15th October 2013 at 11:00 am #64669
The result of ” ls -l” is:
-rwxr-xr-x 1 root root 27144 Sep 25 2013 X.bin
-rwxr-xr-x 1 root root 2412975 Sep 25 2013 Y.bin
-rwxr-xr-x 1 root root 16619 Oct 13 2013 c_code
-rwxr-xr-x 1 root root 9264 Oct 13 2013 code_test
-rwxr-xr-x 1 root root 897484 Sep 25 2013 test.bin
-rwxr-xr-x 1 root root 6392605 Feb 7 2013 vmlinux.ub
(The files “X.bin”, “Y.bin” and “test.bin” are files that will be used by my program.)
If I type:
$ vi c_code
Into the terminal, the output is an unintelligible sequence of symbols so (definitely not a text file)
I did not compile “code_test” from the SDK. The version of “code_test” I downloaded had no main function so I wrote my own and compiled it using the same make file (and kept the output name). My simple program uses “printf” to print “Hello, World” on the screen.
I am using V1.9 of the SDK.15th October 2013 at 11:05 am #64668
Thanks for that – all looks good.
With a copy of the c_code binary on your host system, use the file program (as discussed earlier) on your host system to identify the file type.
I really need to know this information to proceed.
Sean.15th October 2013 at 11:09 am #64667
The result of “file c_code” is:
c_code: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x67cf02c22552ee09655a5e985f15aaad78c54c6f, not stripped
15th October 2013 at 11:29 am #64666
Ok, so that’s the answer – if you run that on the included pre-compiled hello example, you’ll see something like the following:
$ file hello
hello: ELF 32-bit LSB executable, META, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
Your example is compiled for x86-64, not Meta.
You need to make sure you’ve got the CROSS_COMPILE variable setup if you are using a version of the make file detailed in the docs or ensure you run the meta gcc, not the one for building applications for your host system.
Sean.16th October 2013 at 3:56 pm #64665
I rebuilt my toolchain then re-registered the CROSS_COMPILE environment variable and was able to successfully compile my code and run it on the minimorph.
Thank you. 🙂16th October 2013 at 4:13 pm #64664
Great – good to hear you are up and running.
Forums are currently locked.