Home > OS >  How Linux program static link glibc related library, published applications do not rely on glibc ver
How Linux program static link glibc related library, published applications do not rely on glibc ver

Time:09-21

Recently released a Linux program run well on their own development environment, the program to the target customers will prompt a version is too low, now know enough to download the new version of glibc upgrade customer target system, but customers don't want to, hope to be able to launch a glibc related to static link library files, strives for the great god give directions, or give a demo reference, thank you!

Add that other vendors need to link a program. So the dynamic library,

CodePudding user response:

It is not difficult to you? Compile you use dynamic library to static libraries, to join you the final executable file, glibc to download the source code,,,, don't say, point now ~

CodePudding user response:

Dynamic library that is offered by other manufacturers, if really no other way to contact the manufacturer may change a static library, but glibc should be not so simple to source or compile static library to the project will be able to pass it, I have tried, but will somehow prompts some, such as program entrance didn't find and provide a reference example of great god had done

CodePudding user response:

Feeling in the customer compile more simple some similar environment, or docker.
All static compilation does not rely on running environment should be impossible

CodePudding user response:

reference CKC reply: 3/f
feeling in customer compile more simple some similar environment, or docker.
All static compilation does not rely on running environment should be impossible


Method is worth a try, or in their own environment, update with the customer the same version of glibc,

CodePudding user response:

It is easy to solve itself GCC supports half static way connection
But you need to use the makefile way
You can choose to glibc stdc++ library all use - such as the static static connection, but the third party to provide dynamic use dynamic link library
Suggest you use low version glibc compilation connection, centos7, for example, it is compiled for the GNU Linux 2.6
On the high version environment there will be no problem

CodePudding user response:

GCC how to link the standard c library on the command line?

CodePudding user response:

Compile environment and running environment, will appear this kind of situation, you rather, compile environment of GCC (glibc) version & gt; Running environment, can appear glibc version inconsistencies,

Don't change the customer environment solution
1) the container deployment, involves the docker, more complex, and depends on whether the customer agree with maneuverability does does does
2) downgrade the compiler version, according to the target machine glibc version, use the corresponding version of the compiler, can consider in your extra to a set of GCC compile environment, maneuverability does does does does does
3) glibc is forward compatible, low tip glibc version should be certain functions in your code using the latest glibc compile link, so can LDD you software files, observe strings again what functions using the latest glibc library, do the corresponding modification, makes the low version glibc can also compile and operability does does

In conclusion, method 2 feasible degree is relatively high,
  • Related