diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-07-11 16:38:40 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-07-11 16:38:40 +0000 |
commit | 260b979f161071c273803138789810305a26e775 (patch) | |
tree | ad5bed9886a261bbd571cb4fba3abdc30a108882 /lib/sbin | |
parent | e5b26b8f2f7f297dd40dcea10238ce1efd051dee (diff) |
Build a sorted list of all thorns' libraries which is minimal if there are
no cross-dependencies - otherwise it will fall back to the old scheme
of putting every lib twice on the linker command line.
This should fix problems with unresolved symbols for configurations with
thorns which indirectly depend on other thorns
(.eg. IOStreamedHDF5 -> IOHDF5Util -> PUGHSlab).
Closes PR Cactus 658 and Cactus-722.
You need to also update lib/make/make.configuration and then rebuild your
configuration in order to use the new liblist.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2283 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r-- | lib/sbin/CST | 96 |
1 files changed, 90 insertions, 6 deletions
diff --git a/lib/sbin/CST b/lib/sbin/CST index f93fbf3f..7080dafe 100644 --- a/lib/sbin/CST +++ b/lib/sbin/CST @@ -6,7 +6,7 @@ # @desc # Parses the the configuration files for thorns. # @enddesc -# @version $Header: /mnt/data2/cvs2svn/cvs-repositories/Cactus/lib/sbin/CST,v 1.41 2001-05-12 18:33:16 allen Exp $ +# @version $Header: /mnt/data2/cvs2svn/cvs-repositories/Cactus/lib/sbin/CST,v 1.42 2001-07-11 16:38:40 tradke Exp $ #@@*/ # Global parameter to track the number of errors from the CST @@ -161,7 +161,7 @@ print "Creating Thorn-Flesh bindings...\n"; &BuildHeaders($cctk_home,$bindings_dir,%interface_database); # Finally (must be last), create the make.thornlist file. -@make_thornlist = &CreateMakeThornlist(\%thorns); +@make_thornlist = &CreateMakeThornlist(\%thorns, \%interface_database); # Stop the make process if there were any errors if ($CST_errors) @@ -342,13 +342,15 @@ sub get_global_parameters sub CreateMakeThornlist { - my($thorns) = @_; + my($thorns, $interface_database) = @_; my($thorn); my($thornlist); + my($thorn_linklist); my($config_thornlist); - $thornlist = "THORNS ="; - $config_thornlist = "CONFIG_THORNS ="; + $thornlist = "THORNS ="; + $thorn_linklist = "THORN_LINKLIST ="; + $config_thornlist = "CONFIG_THORNS ="; foreach $thorn (keys %$thorns) { @@ -367,9 +369,91 @@ sub CreateMakeThornlist # Only place arrangement_name/thorn_name in the file. $config_thornlist .= " $2/$3"; } + + } + + $thorn_linklist .= ' ' . &CreateThornLinkList($thorns, $interface_database); + + return ("$thornlist", "", "$thorn_linklist", "", "$config_thornlist", ""); +} + + +#/*@@ +# @routine CreateThornLinkList +# @date Wed 22 July 2001 +# @author Thomas Radke +# @desc +# Creates the list of all thorns' libraries to link with Cactus +# @enddesc +#@@*/ +sub CreateThornLinkList +{ + my($thorns, $interface_database) = @_; + my($thorn); + my($implementation); + my($lib, $liblist, $i, $j); + my($cross_inherits); + my(@libs, @liblist); + + @libs = (); + $cross_inherits = 0; + foreach $thorn (keys %$thorns) + { + next if ($configuration_database->{"\U$thorn OPTIONS\E"} =~ m/NO_SOURCE/i || + $thorn eq "Cactus"); + + $implementation = $interface_database->{"\U$thorn\E IMPLEMENTS"}; + if ($interface_database->{"IMPLEMENTATION \U$implementation\E ANCESTORS"}) + { + push (@libs, split (' ', $interface_database->{"IMPLEMENTATION \U$implementation\E ANCESTORS"}), $implementation); + } + else + { + unshift (@libs, $implementation); + } + + if ($interface_database->{"IMPLEMENTATION \U$implementation\E FRIENDS"}) + { + $cross_inherits++; + } + } + + # build the thorn liblist from the implementation list + @liblist = (); + foreach $lib (@libs) + { + push (@liblist, split (/\s/, $interface_database->{"IMPLEMENTATION \U$lib\E THORNS"})); + } + + if ($cross_inherits == 0) + { + # remove duplicate thornlibs in the list, keeping the rightmost instance + for ($i = 0; $i <= $#liblist; $i++) + { + for ($j = $i + 1; $j <= $#liblist; ) + { + if ($liblist[$i] eq $liblist[$j]) + { + splice (@liblist, $j, 1); + } + else + { + $j++; + } + } + } + $liblist = join (' ', reverse @liblist); + } + else + { + # FIXME: Don't know how to handle cross-dependent thornlibs. + # For now we just repeat them twice on the linker line + # hoping that this will resolve all external symbols. + $liblist = join (' ', @liblist); + $liblist .= $liblist; } - return ("$thornlist", "", "$config_thornlist", ""); + return ($liblist); } #/*@@ |