c++ - Are Linux programs as portable as Windows programs? -


maybe dumm question, it's 1 of these 1 learns people talking here , there, , i'd happy if pro described situation correctly.

talking standard desktop computers, see windows programs portable can get. compile 32-bit software static library linking, , put software on flash-drive, , it'll work on computer in world that's 32-bit or 64-bit. have programs on 10 years old, , still work without single problem.

now program linux too, don't have picture in mind when doing linux programs. have picture should compiled in every system program has used. colleague told me 1 it's wrong run same software on 2 computers blindly among 2 linux computers. but... on windows static executables. can in linux two?

so summarize question: limitations creating portable software on linux, people on windows? of course, assuming target computer has no libraries @ other glibc of arbitrary version. libraries should static in model have in mind.

in linux world, binary compatibility not considered important source compatibility, since majority of ecosystem around linux open source. when binary compatibility breaks, can still run old programs after compiling them again. in windows ecosystem, not possible: software closed-source, user depend on software vendor update software new os version. since never happens, windows places lot of emphasis on maintaining binary-level backcompat, point 20 year old binaries can still run.

linux has specification called linux standard base (lsb) tries provide stable application programming interface (api) source compatibility , more limited application binary interface (abi) binary compatibility. based on posix , single unix specification. however, linux distros don't implement lsb. red hat-related group of distros seem follow more closely debian- , ubuntu-related distros.

so unfortunately, linux ecosystem not feature hard guarantees regarding binary compatibility between different distributions or between different versions. in practice though, there's reasonable amount of compatibility going on. in particular, individual distributions might provide stronger compatibility guarantees. , binaries compiled on 1 installation of specific distro version can used on installation of version, provided have same architecture – package managers on linux use packages such precompiled binaries. note these packages compiled on reference installations tightly controlled dependencies.

in cases, boundaries of architecture, executable format, , os abi can crossed. e.g. wine interface layer has implementation of windows' “portable executable” format, , reimplements significant parts of windows abi, leading limited windows→linux binary compatibility. architecture boundaries can crossed using emulators (e.g. can't use software compiled sparc on amd64 system, when using same os version).

the compatibility x86 binaries on amd64 architectures special case. amd64 instruction set engineered backwards-compatible x64 (which why it's successful). operating systems still need provide special kernel-level support running x86 binaries (which feature 32-bit pointers) on amd64 system (which 64-bit), serious operating systems provide support.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -