Search code examples
c++macoseclipse-cdt

Eclipse executable arch type


I faced with issue when I trying to create executable file for linux system on my mac using Eclipse and c++ project.

I can prepare executable, but for arch x86_64

$ file <fileName>: Mach-O 64-bit executable x86_64

Sample executable that works fine on linux system before has ELF 32-bit LSB executable:

$ file <fileName_original>: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, with debug_info, not stripped

As result when I trying to run debug mode within Eclipse

root@:~# gdbserver :2345 /home/; exit Process /home/ created; pid = 1578 Cannot exec /home/: Exec format error.

Child exited with status 127 No program to debug. GDBserver exiting

So the problem is definitely in incorrect arch type.

I saw a lot of similar questions (mostly for windows platform like this or this - all of them recommend to change Binary parser in proj settings - I have tested all of them - result same, so this solution is not working for me

So my question - is there is a way to change arch type for executable generated within Eclipse on macOS?

Note: - Eclipse info:

Eclipse IDE for C/C++ Developers

Version: 2020-03 (4.15.0) Build id: 20200313-1211


Solution

  • I have found instruction how to do so (thanks to advice).

    U need to:

    • Install and setup SFTP on LinkIt Smart 7688 development board with opkg.
    • Install Eclipse C/C++ GCC Cross Compiler Support and Remote System explorer End-User Runtime. Newer versions of Eclipse may have these packages installed already.
    • Create an Eclipse C/C++ Cross GCC project.
    • Setup STAGING_DIR environment variable, tool command prefix, tool path and GDB tool path in the project settings.
    • Build and setup sign-in password to LinkIt Smart 7688 development board. The IDE will automatically build, upload and execute the resulting binary.

    Complete instruction is here.

    Also, on macOS u may also needs to install gdb and prepare eclipse for debug(remote debug), to do so - just follow another instruction.