Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I've been starting to use gcc in fedora 8 to compile and run programs in C. I have a dual boot system going with fedora 8 and win xp. My question is, since I compile the src code into an executable binary file (a.out) in fedora 8 using gcc, and since both OS are obviously running the same cpu architecture x86, theoretically, this a.out executable binary file should run in winxp, right? I don't need a cross compiler if the program is in binary machine code that my processor can understand. Is my understanding correct?
How would I go about running a.out in winxp? Is there some command in cmd?
I believe this has to do with the linker and the instructions necessary to get your executable image loaded into memory and run. There is wine to go from Windows to Linux, and perhaps with the right libraries you might be able to run this under cygwin, but I've never tried it. I would conditionally compile the source for either OS.
I thought that since a.out is broken down into machine code(binary), that it isn't necessary to load libraries since the source code is already interpreted into machine language. Theoretically, it should work by simply loading into memory.
"a.out" is AFAIK a really old format - todays standard is "ELF"
No - a binary (or a library) compiled to run on linux is not going to run on windows.
Wether a.out or ELF - makes no difference there.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
jomen : a.out is just the object, you are getting from gcc,
when no object name is specified, still an ELF file.
I think, I read that it was changed in gcc-4.3 (released 18 days ago ?).
Though I run Gentoo I don't know much of this except that I remember now that you are saying this - you are right.
But then again - isn't this just the name?
I guess I'm confused by the text I quite often read when configuring a new kernel:
Section: Executable file formats
[*] Kernel support for ELF binaries
< > Kernel support for a.out and ECOFF binaries
<*> Kernel support for MISC binaries
the help-texts on the second:
Quote:
A.out (Assembler.OUTput) is a set of formats for libraries and
executables used in the earliest versions of UNIX. Linux used
the a.out formats QMAGIC and ZMAGIC until they were replaced
with the ELF format.
The conversion to ELF started in 1995. This option is primarily
provided for historical interest and for the benefit of those
who need to run binaries from that era.
Most people should answer N here. If you think you may have
occasional use for this format, enable module support above
and answer M here to compile this support as a module called
binfmt_aout.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.