Author Topic: Problems with codeblocks compiles not running on the Zero  (Read 5101 times)

overlord (OP)

  • *
  • Posts: 7
Problems with codeblocks compiles not running on the Zero
« on: January 25, 2014, 12:00:27 am »
    Hi, I'm new here just got my Zero and while I'm not much of a developer I'm very interested in starting out. I have the toolchain installed to my /opt directory, using Arch linux BTW. I have Codeblocks 13.12 installed and I think I have all the compiler options set correctly. Though my code compiles without errors I get seg faults and line errors when trying to execute the binary on the Zero. So I made a simple 'Hello World' console app to test, still no joy. It seg faults as well.

    I saw on a thread here where johnnyonflame show how to link the compiler in Codeblocks. http://boards.dingoonity.org/gcw-development/need-help-with-toolchain/ My version is a bit different as my debugger is in a different menu. but none the less I set it correctly I believe.

    I should also add that using the compiler in commandline it compiles and runs just fine. Any ideas as to what could be happening. I could always use codeblocks to write and just compile in commandline I suppose.

    Also, while I haven't much coding prowess I'm very familiar with linux and have used it since the late 90's. I'd just like to be able to develop in the IDE as much as possible. More newb friendly lol.

pcercuei

  • ***
  • Posts: 1429
    • My devblog
Re: Problems with codeblocks compiles not running on the Zero
« Reply #1 on: January 25, 2014, 12:04:34 am »

overlord (OP)

  • *
  • Posts: 7
Re: Problems with codeblocks compiles not running on the Zero
« Reply #2 on: January 25, 2014, 12:07:37 am »
Yes, that's identical to the one in the thread I linked. The difference is my debugger is on a different tab, I have a newer version of codeblocks. I'll try to link pics just give me a bit.



« Last Edit: January 25, 2014, 12:23:35 am by overlord »

Kloppix

  • *
  • Posts: 36
Re: Problems with codeblocks compiles not running on the Zero
« Reply #3 on: June 13, 2014, 03:12:00 am »
Hi. is this issue already fixed? I'm having the same problem.

1) I downloaded the last toolchain from http://www.gcw-zero.com/develop.php and copied it to /opt

2)  I configured code blocks like said at http://wiki.surkow.com/Tutorials:CodeBlocks. My version is also different, so I include a couple of screenshots.



3)Doing a HelloWorld program in C compiles, but in the Zero launches: ./HelloZero: line 1: syntax error: unexpected "("


Doing a Helloworld program in C++ doesn't even compile > Syntax error: word unexpected (expecting ?)?)

zear

  • * Moderator
  • Posts: 2379
Re: Problems with codeblocks compiles not running on the Zero
« Reply #4 on: June 13, 2014, 09:44:59 am »
3)Doing a HelloWorld program in C compiles, but in the Zero launches: ./HelloZero: line 1: syntax error: unexpected "("
That hints you're compiling host platform native binaries (x86) and not GCW0 (MIPS) ones.
Pass your binary to a "file" command to reveal if this is indeed the case.

Kloppix

  • *
  • Posts: 36
Re: Problems with codeblocks compiles not running on the Zero
« Reply #5 on: June 13, 2014, 01:34:56 pm »
Thank you Zear.

I started from scratch, sorry. Both codes compiles now, but I cannot execute them.

I made 2 Hello World Programs. (C & C++)

opendingux:/media/data/borrar # ./test-c
./test-c: can't load library 'ses'

opendingux:/media/data/borrar # file test-c
test-c: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked (uses shared libs), stripped

opendingux:/media/data/borrar # ./test-cpp
./test-cpp: can't load library 'D1Ev'

opendingux:/media/data/borrar # file test-cpp
test-cpp: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked (uses shared libs), stripped

mth

  • *
  • Posts: 298
Re: Problems with codeblocks compiles not running on the Zero
« Reply #6 on: June 13, 2014, 04:19:47 pm »
What does "ldd test-cpp" show on the Zero? That should list the libraries it uses.

Kloppix

  • *
  • Posts: 36
Re: Problems with codeblocks compiles not running on the Zero
« Reply #7 on: June 13, 2014, 06:55:49 pm »
opendingux:/media/data/borrar # ldd test-c
        ses => not found
        _RLD_MAP => not found
        T_TABLE_ => not found
        c_s.so.1 => not found

opendingux:/media/data/borrar # ldd test-cpp
        D1Ev => not found
        _MAP => not found
        BLE_ => not found
        so.1 => not found

endercraft4

  • *
  • Posts: 35
Re: Problems with codeblocks compiles not running on the Zero
« Reply #8 on: June 14, 2014, 03:45:36 am »
opendingux:/media/data/borrar # ldd test-c
        ses => not found
        _RLD_MAP => not found
        T_TABLE_ => not found
        c_s.so.1 => not found

opendingux:/media/data/borrar # ldd test-cpp
        D1Ev => not found
        _MAP => not found
        BLE_ => not found
        so.1 => not found

Are you running it from the zero's menu?
Have you selected the zero's compilerfrom the list when you make a new project?
If it runs on the pc I think you haven't set it up right.
Correct me if I'm wrong.

I also run linux (Mint) and I make C++ programs for the zero.

mth

  • *
  • Posts: 298
Re: Problems with codeblocks compiles not running on the Zero
« Reply #9 on: June 14, 2014, 05:58:12 am »
opendingux:/media/data/borrar # ldd test-c
        ses => not found
        _RLD_MAP => not found
        T_TABLE_ => not found
        c_s.so.1 => not found

opendingux:/media/data/borrar # ldd test-cpp
        D1Ev => not found
        _MAP => not found
        BLE_ => not found
        so.1 => not found
Can you compare the checksum (SHA1 for example) between your build machine and the Zero? Because that output doesn't make any sense at all; it seems that the binary got corrupted. Maybe you FTP-ed it in ASCII mode?

Kloppix

  • *
  • Posts: 36
Re: Problems with codeblocks compiles not running on the Zero
« Reply #10 on: June 14, 2014, 12:41:37 pm »
Are you running it from the zero's menu?
Have you selected the zero's compilerfrom the list when you make a new project?
If it runs on the pc I think you haven't set it up right.

1) I'm running it directly via Telnet
2) Yes. I'm using the Zero compiler.
3) Nope. → bash: ./test-c: cannot execute binary file

--- SOLVED ---

Can you compare the checksum (SHA1 for example) between your build machine and the Zero? Because that output doesn't make any sense at all; it seems that the binary got corrupted. Maybe you FTP-ed it in ASCII mode?

Thank you! You found the problem! The checksum was different.

I used FileZilla to copy the files and the transfer mode was set to auto. I set it to Binary and now it works :)

 

Post a new topic