-1

I have an airgapped system with 2 linux machines, one running CentOS and one with a custom OS. The custom one does not have gcc, I can connect them with an ethernet cable and tried to scp the gcc file from /bin, the copy worked and the file is intact however when I try to run the command it shows an error saying it can't run the binary file.

1
  • Can you say more about the "custom" part? Do the boxes even have sufficiently identical CPUs? Jul 26, 2019 at 16:44

1 Answer 1

2

Most program binaries are dynamically linked against libraries on their host system. When they are executed, the relevant libraries are loaded to enable the program to run. When you copied the 'gcc' binary you did not copy all the relevant libraries, and so when you run it on your custom machine (which I suspect has non-matching libraries) it won't run. The following will show you what libraries the gcc binary is linked against (on CentOS machine):

ldd /bin/gcc

To get a working gcc on your custom system will require more work - not knowing more about your custom system, hard to know how tricky that might be. Could potentially involve cross-compiling a statically linked gcc designed for your custom system on your CentOS machine, and copying that over.

1
  • This helped me confirm that it would be nearly impossible to do - which was my goal - so thank you. Jul 26, 2019 at 17:15

Not the answer you're looking for? Browse other questions tagged .