0

I've got a dead simple hello world:

#include<stdio.h>
int main()
{
  printf("hey I work and stuff!");
  return (0);
}

that I've been attempting to compile and port from a VM running Linux 5.8.0 x86_64 GNU/Linux to a machine running Linux 2.6.9-89.EL i686 i686 i386 GNU/Linux with no success. The target is 32-bit, so I've got the -m32 flag set, as well as the -static flag to bake in as much as possible into the executable. I'm in the gcc manual and the various -march options (i686, i386) don't seem to help. What am I missing here?

EDIT found this SO post that seems to speak to the issue. I checked and indeed the minimum kernel version shown when I run file is above the kernel version on the target:

$ file ./test 
./test: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, BuildID[sha1]=2d1db51d5ba184e935300681be964298a37ddb4a, for GNU/Linux 3.2.0, not stripped

it seems I need to recompile glibc. if I can make it work I'll post method and results.

snerd
  • 1,179
  • 1
  • 11
  • 27

0 Answers0