0

I was trying to cross compile a simple hello world program for ARM using an x86-64 PC. The board has linux kernel version 2.6.35, so kernel too old error occurs for programs that are for GNU/Linux 3.x.x.

When using gcc, file a.out shows info for GNU/Linux 2.6.32. While using arm-linux-gnueabi-gcc, file a.out shows info for GNU/Linux 3.2.0.

Is there a way of specifying what kernel version a gcc-compiled program is for? If so, how could I achieve that? Thank you in advance.

  • Refer this [post](https://unix.stackexchange.com/questions/52677/compile-software-with-older-version-of-gcc-and-linux-kernel) on Unix and Linux StackExchange. – Gaurav Pathak Jan 24 '18 at 11:13
  • Thanks for your information. In my case, both `gcc` and `arm-linux-gnueabi-gcc` show the same version number: `(Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609`, but the output programs target different kernel version. – Jiahao Cao Jan 24 '18 at 11:33
  • You have to use an older version of `glibc` for Linux kernel 2.6.35. Download an older glibc perhaps version 2.3.4 version of glibc should work. – Gaurav Pathak Jan 24 '18 at 11:52
  • I have come cross this hint, but don't know how to work it out. Do you have any resource or tutorial for changing the glibc version gcc uses? Sorry I am quite new to Linux; thank you for your help. – Jiahao Cao Jan 24 '18 at 12:04
  • Maybe this should help you [How can I link to a specific glibc version?](https://stackoverflow.com/questions/2856438/how-can-i-link-to-a-specific-glibc-version). – Gaurav Pathak Jan 24 '18 at 12:08
  • That seems promising, I'll try it out. thank you. – Jiahao Cao Jan 24 '18 at 12:18
  • There's another simple solution => static compile. If the size of your program is not that huge, static compile allows you to ignore a synchronization issue in ABI (library level). :) – Joonsung Kim Jan 31 '18 at 12:36

0 Answers0