consolidate the minimum compilation environment into a single file

Asked 2 years ago, Updated 2 years ago, 104 views

Can I consolidate the minimum environment required for compilation into a single executable file?

I would like to have a C compiler environment that can be carried in USB memory, and I would like to reduce the number of files to be moved from USB memory as much as possible, so I would like to combine them into one file.
I want to compile and execute the code for C, so I need libc, header files, linkers, etc.
Is there any way to put them together in one executable file?
We expect to create a file that can be run on Windows and Linux respectively and run on x64.
Files can be separated by operating system.

Is this possible?
Also, what should I do if possible?

linux windows c gcc compiler

2022-09-30 21:42

1 Answers

When the shared library libhoge.so that you want to use for your own program is in Machine A but not in Machine B, even if the development environment is portable, it seems difficult to run the finished program in Machine B.Also, even if you put a specific version of the shared library in its USB memory to accommodate a machine that is not installed, it is likely that another machine already has another version of the shared library installed and does not work due to a different version.
(If you already have a vulnerable new version in your environment, but you have a vulnerable old version in your USB memory, you are not happy to use the old version.)

Even if there is an agenda (=carrying development environment), I feel that the program that can be created by it is only HelloWorld with minimal functionality.

To avoid worrying about these "running environmental differences", it's easy to "carry a set of development and running environments" = It's better to build a Linux OS on USB memory and run it on a virtual machine.

From a practical point of view, it is highly assumed that even if you try to use cheap USB memory like a hard disk, the reading and writing performance is too low to be practical.

In conclusion,

  • Even if you can only carry your development environment in a portable way, it may not be practical
  • Take development and execution environments with virtual machines
  • If you want to do that, it would be less troublesome to put the development environment in the target machine


2022-09-30 21:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.