From: Alan W. I. <ir...@be...> - 2002-12-07 21:29:00
|
I have just finished implementing the configuration of static drivers using autotools. The tough part was figuring out how I wanted to link everything together (see below). The easy part (couple of hours work) was implementing my linking ideas using autotools. Just to let you know that the autotools effort has already more than paid off, that part would have been much more difficult (= virtually impossible for someone with my skill set) with the previous autoconf approach. Here is the linking situation with dynamic drivers. The arrows indicate the linking direction that must occur in order to satisfy the undefined symbols in a given library on the left. Those symbols are resolved by referring to the libraries on the right using the usual -l syntax during each library link step. (1) libplplottcltk ==> libplplot, libtclmatrix (2) libtclmatrix ==> (3) libplplotcxx ==> libplplot (4) libplplotf77 ==> libplplot (5) plplotc_module.so ==> libplplot (6) libplplotjava ==> libplplot (libplplotjava not done yet) (7) libplplot ==> (8) tk_drv.so ==> libplplottcltk (9) tk_drv.so ==> libplplottcltk (10) ps_drv.so ==> libplplot This all works with dynamic drivers because libplplot dlopens the pre-linked driver tk_drv.so (or tkwin_drv.so). Also, libplplot is small which is an advantage since that is the one most applications and libraries link to. Also note that a tcl application only needs to link to libplplottcltk, and everything else is automatically linked in as required. However, with static linking you cannot naively use the same scheme since you get a circular chain. All driver codes are now put inside libplplot. That satisfies linking requirement for most drivers such as ps_drv.so, but because of tk and tkwin we have (7a) libplplot ==> libplplottcltk which becomes circular with (1) which makes a mess. Here is the solution I have implemented. To cut the circular chain, I add all the libplplottcltk and libtclmatrix objects into the convenience library that also contains the static driver objects. The configuration is set up so that libtool automatically puts all the objects in the convenience library into libplplot so libplplot ends up being self-contained as before with no additional linking required to resolve its symbols (other than the usual additional "driver" links to libraries such as libgd, etc.). Of course, libplplot is a little larger in this case, but those who use static drivers on Unix machines get what they deserve..... Note all other linking for the static drivers case is done as in the dynamic drivers case which means that tcl executables can continue to get all their symbols resolved and drivers found if they simply link to libplplottcltk as before. Similarly, normal non-tcl executables like x01c simply need to be linked to libplplot as before. I have tested these static drivers, and AFAIK they produce identical results to the dynamic drivers case. Dynamic loading under tclsh and wish still works as before from the user perspective although internally an extra search was implemented to find the initialization routines in the static drivers case since those routines appear in a different shared object location. Also, plrender, and pltcl work fine. The "works as in the dynamic driver case" also extends to -dev tk not working in exactly the same way. Since the library linking of the driver is quite changed, I believe this problem is something fundamental which has nothing to do with linking. I declare the current phase of rapid changes to our configuration as officially over. From now on, I expect to see considerably more gradual changes as the cross-platform tests start rolling in. Alan email: ir...@be... phone: 250-727-2902 FAX: 250-721-7715 snail-mail: Dr. Alan W. Irwin Department of Physics and Astronomy, University of Victoria, P.O. Box 3055, Victoria, British Columbia, Canada, V8W 3P6 __________________________ Linux-powered astrophysics __________________________ |