"undefined reference to T2Predictor_Keep"

0 votes
I had download the development branch of psrchive, but it fails to compile and generates the following error message:

libtool: link: g++ -O2 -Wall -pthread -o psredit psredit.o  -L/root/pluse/psrsoft/usr//lib -L/usr/local/lib ../../Base/.libs/libpsrbase.a ../../Util/.libs/libpsrutil.a -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../.. -L/root/pluse/psrsoft/usr//tempo2/lib -L//lib -L/root/pluse/psrsoft/usr/lib /root/pluse/psrsoft/usr/lib/libfftw3f.so -lgfortranbegin -lgfortran -lcfitsio -lpthread /root/pluse/psrsoft/usr/lib/libtempo2pred.so -ldl -lm -pthread -Wl,-rpath -Wl,/root/pluse/psrsoft/usr/lib -Wl,-rpath -Wl,/root/pluse/psrsoft/usr/lib
../../Util/.libs/libpsrutil.a(T2Predictor.o): In function `Tempo2::Predictor::keep(std::vector<MJD, std::allocator<MJD> > const&)':
T2Predictor.C:(.text+0x6be): undefined reference to `T2Predictor_Keep'
collect2: ld returned 1 exit status
make[3]: *** [psredit] Error 1
make[3]: Leaving directory `/root/pluse/psrchive/Base/Applications'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/pluse/psrchive/Base'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/pluse/psrchive'
make: *** [all] Error 2

Can someone tell me how to solve this
"undefined reference to T2Predictor_Keep"

asked Sep 11, 2014 by anonymous

1 Answer

0 votes
Hi David,

I presume that during configuration tempo2 was found as the compilation included tempo2 realted code. You can check this, e.g., in config.log (Checking for tempo2 -> yes) or in config.h (HAVE_TEMPO2 should be defined as 1) file in the root directory of psrchive.

If so, you should check if tempo2 libraries are in a location pointed to by one of the -L option in the message you quote. If they are, then most likely you are trying to link incompatible libraries.

Examples of when this can happen is for example if you compile two codes with different compilers or if you are trying to compile psrchive with '--enable-shared' and tempo2 was compiled without shared libraries enabled. In the first case you need to recompile both tempo2 and psrchive using the same compilers and in the latter simply recompile tempo2 with shared libraries enabled.


answered Sep 11, 2014 by sosl (780 points)