linux - How to select that which shared library to link with the program at run time -
i have c program uses freetype library task. have 2 freetype source code directories, lets suppose freetypea , freetypeb. in freetypea did modifications , testing compiled , installed using ./configure, make , make install commands respectively, means after running these commands freetypea installed on linux os .so files in /usr/local/lib directory gave manually using ld_library_path variable. till program running fine , modifications responding accordingly.
i modified freetypeb library code , testing compiled , installed using ./configure, make , make install commands respectively , used sudo ldconfig update. should install freetypeb .so files in usr/local/lib directory , respected header files in usr/local/include , overwriting freetypea. if run same program should use freetypeb library, uses same freetypea library.
i checked dependancy of program using ldd command both freetype libraries create .so file same name cannot differentiate.
the problem related linking i.e. program how linking freetypea every time. how can solve issue. if iam missing please explain
compiled command mentioned below
ld_library_path=/usr/local/lib:$ld_library_path export ld_library_path gcc -o example example1.c -l/usr/local/lib -lfreetype -i/usr/local/include/freetype2
Comments
Post a Comment