Compile parameters for MIPS based codesourcery toolchain?

怎甘沉沦 提交于 2019-12-06 13:14:47

Do you have libgcc_s.so.1 on teh file system? If not, the toolchain will have a folder to copy onto the file system. Do that.

If you do, ensure LD_LIBRARY_PATH is correctly set.

EDIT: Generic issue resolution

When you create a executable, you link to libraries. Those libraries must also be present in the environment where you run the executable. Hence in general in a embedded system 3 things must match

  1. The kernel headers
  2. The toolchain
  3. The file system

Here is how they are related

Your kernel headers are used as #include in your program in some form finally. So what headers the toolchain uses must match the actual one running and will be present in the file system.

The toolchain will consist of libraries to link to, so that the executable can be created [think libc and others]. These must be the same present in your runtime environment which is your filesystem

The toolchain must create a format agreable to your kernel. Executable format.

So in general if you don't have a file in your filesystem while trying to execute it should come from some sdk or your toolchain. If you have it in the filesystem then you can instruct your toolchain to use it from there.

One way to get around the problem if you do not have the libraries in the filesystem for some reason is to build static executables. But you must be sure you know what you are doing.

EDIT: Specific issue you are facing If you filesystem is readonly then either you already have everything on it and a sdk is provided to develop against. If you dont have that you can still develop by getting your toolchain to use libraries from your filesystem [think -I, -L].

EDIT 2: Your file system seems to be a ucLibc one. Your toolchain seems to be built against a libc. There is your mismatch.

Now you seem to have a read only file system with no development sdk. So I am not sure the following will work. Your toolchain has to be configured to use only the files from your filesystem and configured for ucLibc. If the router guys have made sure all files needed for development is available in the rilesystem its good enough. Else you need their sdk. See above edit for explanation.

Mario

I have successfully compiled this

#include <iostream>
using namespace std;

int main() {
  cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
  return 0;
}

mips-linux-gnu-g++ -muclibc -mips32  main.cpp -o main
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!