I have a very complex bunch of libs and executables taken over (Linux). The whole system was developed using static libraries in the past, then a couple years ago the libs are migrated to be shared libraries (-fPIC etc). Checking the dependencies I found out, that there are two shared libs: libA and libB:
- libA calls some functions from libB
- libB calls some functions from libA
I would like to build the libs having proper dependencies: libA depends on libB and libB depends on libA. But I can't give "-llibB" to the linker, because the lib is not yet existing at the build time of libA
If I build libA without the dependancy of libB (creating unresolved symbols), I have to keep in mind if I use libA I have to link libB also, because of undefined symbols in libA. That's annoing!
What I'm looking for is a possibility to build libA and telling to the linker to create dependancy to libB WITHOUT having libB at this time, is that possible?
How can I solve my problem without merging libA and libB together?
Regards, peters
Edit: I found out, that I can directly generate an empty lib (without writing a source code):
gcc -shared -Wl,-soname,libB.so.$(MAJOR) -o libB.so
then I can build libA adding: -lB to the build command. After that I removed the libB.so. Finally, after installation the libB refers to libA and libA refers to libB.
Of course the MAJOR number must match the MAJOR of the libB, this is so, because the major number is common for all libs.
I'm just asking myself if there is more suitable way to do it?