|
From: Ishmael on 5 Jan 2007 01:25 I am trying to compile the Math::GMP module locally (not as root). I have successfully built gmp-4.2.1, but am having trouble getting the Perl wrapper to work. I am doing the following: perl Makefile.PL PREFIX=/home/kstahl/PERL/Math-GMP-2.04 Here, I receive the following messages: Note (probably harmless): No library found for -lgmp Writing Makefile for Math::GMP Now in order to point Make in the right direction to find my installation of gmp, I edited the Makefile, and added the correct path to CCFLAGS, i.e. the last entry below: CCFLAGS = -I/usr/local/include/db3 -I/usr/local/include -I/apps/supported/include -I/home/kstahl/PERL/gmp-4.2.1 Then I run make and get these messages: cc -c -I/usr/local/include/db3 -I/usr/local/include -I/apps/supported/include -I/home/kstahl/PERL/gmp-4.2.1 -O -DVERSION=\"2.04\" -DXS_VERSION=\"2.04\" -KPIC "-I/apps/gnu/perl-5.6.1/lib/sol2.sun4/CORE" GMP.c Running Mkbootstrap for Math::GMP () chmod 644 GMP.bs rm -f blib/arch/auto/Math/GMP/GMP.so LD_RUN_PATH="" cc -G -L/usr/local/lib/db3 -L/usr/local/lib -L/apps/supported/lib/sol2.sun4 GMP.o -o blib/arch/auto/Math/GMP/GMP.so chmod 755 blib/arch/auto/Math/GMP/GMP.so cp GMP.bs blib/arch/auto/Math/GMP/GMP.bs chmod 644 blib/arch/auto/Math/GMP/GMP.bs Manifying blib/man3/Math::GMP.3pm It looks like everything worked, but then I run 'make test' and get the following errors: PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/gmppm....Can't load '/home/kstahl/PERL/Math-GMP-2.04/blib/arch/auto/Math/GMP/GMP.so' for module Math::GMP: ld.so.1: /usr/local/bin/perl: fatal: relocation error: file /home/kstahl/PERL/Math-GMP-2.04/blib/arch/auto/Math/GMP/GMP.so: symbol __gmpz_init_set_str: referenced symbol not found at /apps/gnu/perl-5.6.1/lib/sol2.sun4/DynaLoader.pm line 206. at t/gmppm.t line 7 Compilation failed in require at t/gmppm.t line 7. BEGIN failed--compilation aborted at t/gmppm.t line 7. t/gmppm....dubious Test returned status 255 (wstat 65280, 0xff00) FAILED--1 test script could be run, alas--no output ever seen make: *** [test_dynamic] Error 255 I checked in the directory shown above, and GMP.so is right there, as expected. Any help with this will be greatly appreciated. Thanks!
From: Sherm Pendley on 5 Jan 2007 02:05 "Ishmael" <stahl.karl(a)gmail.com> writes: > I am trying to compile the Math::GMP module locally (not as root). I > have successfully built gmp-4.2.1, but am having trouble getting the > Perl wrapper to work. I am doing the following: > > perl Makefile.PL PREFIX=/home/kstahl/PERL/Math-GMP-2.04 > > Here, I receive the following messages: > > Note (probably harmless): No library found for -lgmp Not so harmless after all... :-/ > Writing Makefile for Math::GMP > > Now in order to point Make in the right direction to find my > installation of gmp, I edited the Makefile, and added the correct path > to CCFLAGS, i.e. the last entry below: For changes like this, it's easier to edit Makefile.PL before running it - in this case it's only 10 lines, as opposed to many lines of stuff you'd need to wade through in the generated Makefile. Also, editing Makefile.PL will make it easier to send your changes to the module's maintainer. Not that the maintainer will want this particular change of course... but next time you might find and fix a bug, who knows? Anyway, you've only done half of what you need to do - along with telling the compiler where to find the GMP headers, you also need to tell it where to find the libgmp.so binary. Does /home/kstahl/PERL/gmp-4.2.1 have include/ and lib/ subdirectories under it? If so, add an INC param to the call to WriteMakefile(), and change the LIBS param in Makefile.PL like this: 'INC' => '-I/home/kstahl/PERL/gmp-4.2.1/include', 'LIBS' => '-L/home/kstahl/PERL/gmp-4.2.1/lib -lgmp', Adjust the paths as needed if there are no include/ and/or lib/ subdirs. sherm-- -- Web Hosting by West Virginians, for West Virginians: http://wv-www.net Cocoa programming in Perl: http://camelbones.sourceforge.net
From: Ishmael on 5 Jan 2007 13:29 Thank you for the very helpful and incredibly prompt response. Everything compiled beautifully. In case someone else reads this, I should mention one other problem that I had to solve before this package finally passed 'make test'. The problem comes from the compilation of the C gmp package that the Perl code rests on. While that compilation came up error-free on my machine (even after running 'make check'), when I ran 'make test' from the Perl package, I ended up with errors along the lines of the following: ld: fatal: file /home/kstahl/PERL/gmp-4.2.1/lib/libgmp.so: wrong ELF class: ELFCLASS64 These problems apparently stem from incompatibilities in the libraries. I am running on a Unix platform with Solaris 5.8 and perl 5.6.1. I don't know what exactly the problem is, but the solution is to compile gmp in 32 bit mode, but adding the ABI=32 option when running configure. After doing this, the Perl module compiled error-free.
|
Pages: 1 Prev: Net::SSH::Perl question Next: What's happening with the last child process here???? |