Solving link errors when linking with -non_shared
BaBar code is not typically linked with -non_shared. Consequently, some link errors will occur, which you will need to address ad hoc. Hopefully we can find a better solution later.
If the problem was a multiply defined symbol:
Link again, with options which tell you where the symbol was defined:
>gmake CXXFLAGS+=-non_shared LDGFLAGS+=-Wl,-ysymbol1,-ysymbol2 BetaUser.bin
where symbol1, symbol2, etc., are the multiply defined symbols. Note the lack of spaces in these
flags and follow them carefully. This will write to standard output all the libraries and object moduls therein in which the symbols were found. You need to remove all but one of the definitions of each symbol:
Let $lib be a library, and $obj be the object module in that library, in which the symbol was defined. Then
>ar -w $lib | grep $obj
will produce a list of all the symbols (function and global data) which are defined in $obj. If you're lucky, only in one of these libraries will $obj contain other symbols, in additional to the multiply defined
symbol. You will now create a local version of all the other libraries, from which you will remove the offending object modules. From the release directory:
>cp $lib lib/$BFARCH
>ar -d $lib $obj
Now you are ready to try and link again.
|