Jerry M
Jerry M

Reputation: 332

Static library portability

Short question. If I have written C++ static library and compiled it using G++ on Ubuntu, can I assume safely that it will be possible to link it using G++ on other distributions of Linux?

Upvotes: 5

Views: 1134

Answers (1)

πάντα ῥεῖ
πάντα ῥεῖ

Reputation: 1

Binaries aren't arbitrarily interchangeable amongst linux systems, no matter if executables, static libraries or shared libraries.

That's why almost all software packages are distributed as source, and your package manager system takes care of how to configure and compile these.

That said, commercial software, which should be distributed without disclosing the actual source code, is usually (cross-)compiled by the vendor for various linux distributions.

Upvotes: 4

Related Questions