GiNaC list, I'm having, what I think are, problems linking to GiNaC's precompiled libraries. I'm using gcc 3.4.6, and according to the gcc msg board I will likely be unsuccessful linking to any library compiled with a different version of gcc. I haven't noticed mention of the compiler version used to build GiNaC's libraries in the GiNaC documentation and was wondering if you had this information readily available? Does this explanation sound legitimate to you? Seems to me that if this were the case there'd be widespread problems using gcc... Here's what I'm doing: c++ code, ginactest.cpp (ex. from GiNaC tutorial) ------------------------------------------------- #include <iostream> #include "ginac.h" using namespace std; using namespace GiNaC; int main() { symbol x("x"), y("y"); ex poly; for (int i=0; i<3; ++i) poly += factorial(i+16)*pow(x,i)*pow(y,2-i); cout << poly << endl; return 0; } Invocation of g++ ------------------------------ ./g++ ginactest.cpp -o ginactest.exe /usr/lib/libgslcblas.so.0.0.0 -I/home/theorist/cbouchrd/GiNaC/ginac -L/home/theorist/cbouchrd/local/lib -lcln -lginac Error messages ------------------------------- /tmp/ccojEpA1.o(.gnu.linkonce.t._ZN5GiNaC5powerC1ERKNS_2exES3_+0xa): In function `GiNaC::power::power(GiNaC::ex const&, GiNaC::ex const&)': : undefined reference to `GiNaC::power::tinfo_static' /tmp/ccojEpA1.o(.gnu.linkonce.r._ZTVN5GiNaC9containerISt6vectorEE+0x6c): undefined reference to `GiNaC::basic::has(GiNaC::ex const&, unsigned int) const' /tmp/ccojEpA1.o(.gnu.linkonce.r._ZTVN5GiNaC9containerISt6vectorEE+0x84): undefined reference to `GiNaC::basic::is_polynomial(GiNaC::ex const&) const' /tmp/ccojEpA1.o(.gnu.linkonce.t._ZN5GiNaC9containerISt6vectorE9get_tinfoEv+0x4): In function `GiNaC::container<std::vector>::get_tinfo()': : undefined reference to `GiNaC::container<std::vector>::tinfo_static' collect2: ld returned 1 exit status I've attached GiNaC's config.log. If any additional information is required please let me know. Thanks for any help/ideas! Sincerely, Chris Bouchard
Hi, Chris Bouchard schrieb:
Does this explanation sound legitimate to you? Seems to me that if this were the case there'd be widespread problems using gcc...
it seems you are using a compiled GiNaC version 1.3.x with GiNaC headers from version 1.4.x.
#include <iostream> #include "ginac.h"
Why not #include <ginac/ginac.h> ?? Did you copy ginac.h by hand somewhere? Or did you install GiNaC locally for yourself but forgot to set the correct compiler flags (so that the linking is actually done against a system-wide installation of GinaC)?
using namespace std; using namespace GiNaC; int main() { symbol x("x"), y("y"); ex poly; for (int i=0; i<3; ++i) poly += factorial(i+16)*pow(x,i)*pow(y,2-i); cout << poly << endl; return 0;
Regards, Jens
Hello, On Thu, Apr 24, 2008 at 08:45:14AM -0500, Chris Bouchard wrote:
Invocation of g++ ------------------------------ ./g++ ginactest.cpp -o ginactest.exe /usr/lib/libgslcblas.so.0.0.0 -I/home/theorist/cbouchrd/GiNaC/ginac -L/home/theorist/cbouchrd/local/lib -lcln -lginac
It looks like the headers and the library come from different (incompatible) versions of GiNaC (that is, headers from 1.4.X and library from 1.3.Y)...
Error messages ------------------------------- /tmp/ccojEpA1.o(.gnu.linkonce.t._ZN5GiNaC5powerC1ERKNS_2exES3_+0xa): In function `GiNaC::power::power(GiNaC::ex const&, GiNaC::ex const&)': : undefined reference to `GiNaC::power::tinfo_static' /tmp/ccojEpA1.o(.gnu.linkonce.r._ZTVN5GiNaC9containerISt6vectorEE+0x6c): undefined reference to `GiNaC::basic::has(GiNaC::ex const&, unsigned int) const' /tmp/ccojEpA1.o(.gnu.linkonce.r._ZTVN5GiNaC9containerISt6vectorEE+0x84): undefined reference to `GiNaC::basic::is_polynomial(GiNaC::ex const&) const' /tmp/ccojEpA1.o(.gnu.linkonce.t._ZN5GiNaC9containerISt6vectorE9get_tinfoEv+0x4): In function `GiNaC::container<std::vector>::get_tinfo()': : undefined reference to `GiNaC::container<std::vector>::tinfo_static' collect2: ld returned 1 exit status
... so some inlined methods/functions present in the headers can not be resolved from the shared library.
I'm having, what I think are, problems linking to GiNaC's precompiled libraries. I'm using gcc 3.4.6, and according to the gcc msg board I will likely be unsuccessful linking to any library compiled with a different version of gcc.
That depends (ABI changes are very platform dependent). On GNU/Linux x86 and x86_64 g++ [3.4, 4.2] seem to have compatible ABIs, so one can mix C++ libraries compiled with g++ [3.4, 4.2] (unless those libraries are incompatible for reasons other than compiler and standard library ABI changes).
I haven't noticed mention of the compiler version used to build GiNaC's libraries in the GiNaC documentation and was wondering if you had this information readily available?
Actually, we have some "know to work with" list in the `INSTALL' file.
Does this explanation sound legitimate to you?
No. Best regards, Alexei -- All science is either physics or stamp collecting.
participants (3)
-
Alexei Sheplyakov
-
Chris Bouchard
-
Jens Vollinga