[Developers] Detecting duplicate symbols

Erik Schnetter schnetter at cct.lsu.edu
Fri Aug 14 09:20:09 CDT 2009

If two thorns define the same routine or the same global variable,  
then this is very difficult to detect.  This can happen easily, e.g.  
when one copies a thorn to modify it – this may be one of the first  
steps a beginner takes.

The enclosed patch analyses the thorn libraries before the final  
executable is built.  It checks for duplicate symbols and aborts if it  
finds them.  It also emits warnings about thorns using symbols from  
other thorns without declaring this to the flesh (via  

Please give it a try.  It may not work on all systems (e.g. when the  
"nm" command cannot be found), and in this case the check should be  
omitted; this should not abort the build.


Erik Schnetter <schnetter at cct.lsu.edu>   http://www.cct.lsu.edu/~eschnett/

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from <http://pgp.mit.edu>.

Index: make.configuration
RCS file: /cactusdevcvs/Cactus/lib/make/make.configuration,v
retrieving revision 1.89
diff -u -r1.89 make.configuration
--- make.configuration	25 Jan 2008 15:03:12 -0000	1.89
+++ make.configuration	14 Aug 2009 14:19:29 -0000
@@ -126,6 +126,7 @@

  # Build the executable
  $(EXEDIR)$(DIRSEP)$(EXE): $(CONFIG)/make.thornlist $(CONFIG)/ 
cctki_version.h $(patsubst %,$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$ 
+	$(PERL) -s $(CCTK_HOME)/lib/sbin/CheckThornLibs.pl $(EXE) $(THORNS)
  	@echo Creating $(EXE) in $(EXEDIR) from $(THORNS)
  	datetime=`/bin/date +'%Y-%m-%dT%H:%M:%S%z' 2>&1` ; \
  	if [ $$? != 0 ]; then datetime=`/bin/date` ; fi ; \

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CheckThornLibs.pl
Type: text/x-perl-script
Size: 6969 bytes
Desc: not available
Url : http://www.cactuscode.org/pipermail/developers/attachments/20090814/b03f2b2f/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: This is a digitally signed message part
Url : http://www.cactuscode.org/pipermail/developers/attachments/20090814/b03f2b2f/attachment-0001.bin 

More information about the Developers mailing list