Why a windows programe(*.exe) can't run in a Linux system?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Wim Sturkenboom says:
When you compile the c-code on a X86 machine, the compiler will generate the correct machine (binary) code for the x86; it's however very unlikely that that machine code will work on the sparc processor. You need to compile the c-code again on the machine with the sparc processor to get the correct machine code for it (or use a cross-compiler).
Quote:
billymayday says:
When you say programs run on different cpus, that's only really true where they are instruction set compatible or backwards compatible. As said previously, a totally different CPU requires a different binary that has been compiled for it.
( I don't understand. I download a game, I can run it in my computer and in my friends' computers without compling)
Quote:
pinniped says:
Sure a program has machine code in it. That's only part of the story. Programs also have tables in them indicating what other programs (libraries) they may need to use and the functions to use in those libraries. The tables also have the addresses of functions, including main() which is the one called when a program is started.
A second problem is that winduhs and Linux communicate with programs in a different way. The operating system essentially provides access to hardware, and *all* software must interact with it. One typical way of getting this done is to put information in certain CPU registers and then generate a software interrupt. Some operating systems use multiple interrupts but if I recall correctly, Linux only uses one. It just happens that winduhs and Linux use different registers and different interrupts - so even if you wrote another program to place that *.exe into memory and begin execution, the program will still not run because it can't communicate with the kernel.
Now for CPUs - different families of CPUs have different instruction sets, so you *cannot* run a program on different CPUs simply because the operating system has the same name. Linux is written in a "high-level" language, C, and can be compiled for many CPU families. Although the more abstract code (C) is mostly the same, the final executable code is very different. This is why you cannot install Linux for x86 on an ARM computer.
Quote:
ErV says:
However it is possible to write library that'll work on both systems (as long as CPU architectures and endianness will be compatible) if there is loader for it. For your information - mplayer can use *.dll files for codecs (windows "libraries), even on Linux. Please note that library is not what people normally call a program, it is collection of functions.
( I don't understand. I download a game, I can run it in my computer and in my friends' computers without compling)
Some others already gave good reasons why it might work. Another reason why it might work which I did omit on purpose (as it might have created more confusion) is that the program is written in an interpreted language or pseudo language (not sure what the official name is for the latter).
So if you downloaded a game written in an interpreted language, the interpreter that needs to be installed on your system will do the translation to the system calls and the OS while handle it from there. Examples of interpreted languages are basic, perl, tcl etc
The pseudo language I'm referring to is Java. It is compiled to a byte-code and will run in a Java Virtual Machine that needs to be installed on your machine and translates the bytecode to system calls.
Both the Java Virtual Machine as well as interpreters are different for the different HW/OS (so the one that you download for Windows on x86 will not work under Linux on x86 (see easrlier answers)).
Its an interesting question...... and the answers make me wonder what exactly an emulator program like wine "emulates". What does such a program do to a windows executable to run it in windows??
And by the way, does an application directly communicate with the hardware?? It communicates through the kernel right?? So one factor should be the difference in kernel that limits a windows application from running on Linux.....
The similarity in kernels also explains why a game that runs on a Core2 also runs on an AMD or a Pentium as long as the machines have the same OS. This is also true in the case of Linux.
I think the same reason prevents an application that runs on 32-bit OS from running on its 64 bit version. Of course measures are taken to avoid such compatibility issues, that could be why applications can run on different OSes of the same vendor..... like an application running on both XP and Vista...
Its an interesting question...... and the answers make me wonder what exactly an emulator program like wine "emulates". What does such a program do to a windows executable to run it in windows??
Its an interesting question...... and the answers make me wonder what exactly an emulator program like wine "emulates". What does such a program do to a windows executable to run it in windows??
It doesn't "emulate" things. It takes available linux system calls and wraps them in the way so the will be compatible with WinAPI, and implements some missing stuff. This is not an emulation. It is reimplementation of WinAPI (according to its specification), on GNU/linux OS.
Quote:
Originally Posted by firewiz87
And by the way, does an application directly communicate with the hardware?? It communicates through the kernel right?? So one factor should be the difference in kernel that limits a windows application from running on Linux.....
Normal program never communicates with hardware directly. It uses system calls. How exactly system calls communicate with hardware is the problem of OS developer, not software developer (well, in most cases).
Quote:
Originally Posted by firewiz87
The similarity in kernels also explains why a game that runs on a Core2 also runs on an AMD or a Pentium as long as the machines have the same OS. This is also true in the case of Linux.
Nope, in this case they run also because CPUs use similar(to certain extent) instruction set , and games sometimes detect advanced features of Core2/AMD/Pentium and change their behavior accordingly.
And by the way, does an application directly communicate with the hardware?? It communicates through the kernel right?? So one factor should be the difference in kernel that limits a windows application from running on Linux.....
On some bare systems like DOS, the software often had to communicate with hardware directly. This was really horrible and resulted in so much inconsistency. It slowly improved, but one other big problem with DOS is that any program had access to any memory (and could easily screw up any other program/driver which was running). The amusing thing is that at the same time, UNIX was in charge of the hardware and software only had to communicate with the OS.
Quote:
Originally Posted by firewiz87
I think the same reason prevents an application that runs on 32-bit OS from running on its 64 bit version. Of course measures are taken to avoid such compatibility issues, that could be why applications can run on different OSes of the same vendor..... like an application running on both XP and Vista...
Not quite. For Linux (and Visduh would have to use the same mechanism), the compatibility with 32-bit apps is provided by a 32-bit kernel interface. In the case of Linux, a 64-bit kernel will have a 64-bit interface so you need to explicitly build the 32-bit interface if you want to support 32-bit code. Otherwise the pointers being passed to the kernel will have the wrong size and alignment and some other data types may also have the wrong size and alignment.
yes it is true windows and linux architecture both are different
but i think some of the compatible things available with startoffice and ms office. we can exchange file with those office packages.
but i would like to know how to convert any exe of microsoft be used linux compatible?
but i think some of the compatible things available with startoffice and ms office. we can exchange file with those office packages.
but i would like to know how to convert any exe of microsoft be used linux compatible?
but i think some of the compatible things available with startoffice and ms office. we can exchange file with those office packages.
but i would like to know how to convert any exe of microsoft be used linux compatible?
File formats like .doc are not software. They only contain data for executables like Microsoft Office or OpenOffice. Think of it this way:
Operating System <- Word Processor <- file.doc
File formats are operating system independent because they are read by software instead of being executed by the OS itself.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.