Thread: Portability of executalbe and library files

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    159

    Portability of executalbe and library files

    Hi,
    After a little while of programming experience, I find myself still not clear about some basic:
    1. if I build from my code an executable with static linking, will that executable be portable to another machine with same OS? How about from 32bit to 64bit hardware (or OS) or the other way around? I really have done successfully from 32 bit Ubuntu to 64bit Unix.
    2. if I build from a C++ library' s source code its library files(.a and/or .so), are those .a and .so files portable to another system with same OS?
    3. if the answers are no in general, why are so many softwares and libraries have precomplied distributions besides source distribution? Is "binary distribution" the same thing as "precompiled distribution"
    Thanks!
    Last edited by lehe; 03-05-2009 at 08:13 PM.

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    if I build from my code an executable with static linking, will that executable be portable to another machine with same OS?
    Yes.

    How about from 32bit to 64bit hardware (or OS) or the other way around?
    32-bit binary on 64-bit machine is okay (assuming x86-64, not true for "pure" 64-bit machines), but running 64-bit binaries on 32-bit OS obviously won't work.

    Is "binary distribution" the same thing as "precompiled distribution"
    Yes.

Popular pages Recent additions subscribe to a feed