简体   繁体   中英

Run a linux executable on windows

I got an executable file created with linux. I also have the files and libraries that created this exe linux file.

Two questions:

Is there a way to run this linux exe in windows or it has to be done with linux?

The files are from around 15 to 18 years ago. If can't run it from windows, would linux be able to run it even if the files are somewhat old?

Could someone advice? Thanks

You can use WSL available on Windows 10 and 11.

You can also setup a Linux virtual machine using Virtual Box , Hyper-V , VMware Workstation Player , or any other virtualization solution, copy your files to the VM and execute there.

Another option is to install and use Docker . With docker you could run a command like this: docker run -it --rm -v $PATH_TO_EXE_DIRECTORY:/app ubuntu:latest /app/name_of_your_exe from command line.

Will it actually run if it's old? Your mileage may vary. It depends if it's a statically linked executable or dynamically linked executable. Statically linked executable may run, or may complain about incompatible kernel version (I've seen it once). Dynamically linked executable may fail to run due to missing dependent libraries or incompatible versions.

To check if the file is dynamically linked you can use Linux file command file name_of_your_exe , it will print the information regarding the data in the file, including whether it's dynamically or statically linked. To investigate the dependencies you can use Linux command ldd name_of_your_exe which will print the list of libraries ( .so extension per Linux convention) your executable is dependent upon.

Your best option to ensure that it will run is to try and figure out which Linux distribution and version it was intended for and find its VM image or installation media online (it should still be possible, IMO), setup a VM and try to run it there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM