The error means you are trying to link a 64 bit library with a 32 bit one, at link time (the error comes from ld, which is the linker).
Setting -L in CFLAGS sets /usr/sfw/lib/sparcv9 at compile (not link time) Setting -R in CFLAGS sets /usr/sfw/lib/sparcv9 at run time. None of these help with link time, you need to use -m64 at link time also (LDFLAGS) to link with 64 bit system libraries, and also set LD_LIBRARY_PATH=/usr/sfw/lib/sparcv9 in your shell (at minimum) All solaris tool sets default to 32 bit compile and link, unless you specify otherwise. Sigh. You dont need to set LD_LIBRARY_PATH in your compile shell if you have the luxury of being able to set the system default to look in /usr/sfw/lib/sparcv9 (man crle), but there are several reasons why this may not be possible or advisable with third party libraries, especially if you have several different versions of a library on a system, someone will end up getting the wrong library eventually. Personally i think adding paths such as /usr/sfw/lib/sparcv9 as s system default is reasonable, as it is a solaris provided (not third party) library. I dont comprehend why sun dont configure solaris to use thier own libraries by default. But having said all that, you probably need to make sure Perl was compiled with the correct 64 bit options in the first place, as most perl modules with native code will either use these by default, or will later have link issues if you don't already. In other words you need to use the 64 bit compile and link options for all options that need to link together or share libraries. Cheers Brett On Wed, Dec 8, 2010 at 11:25 PM, Stas, Kamil <kamil.s...@t-systems.sk>wrote: > Hello, > > > > I am trying to compile mod_perl-2.0.4 for Apache httpd-2.2.17 on Solaris10 > SunOS 5.10 Generic_141414-10 sun4v sparc SUNW,SPARC-Enterprise-T5120 > > > > I am facing ld: wrong ELF class: ELFCLASS64 problem. > > Everyting was compiled in m -64 mode, generated .so 64bit, with export > CC="gcc -m64" > > > > When compiling mod_perl it looks its trying to compile in 32bit mode, dont > understand why. > > How to forse it to compile in 64bit mode? Till now gcc -m64 was good to > use, with exported LD_LIBRARY_PATH and PATH for sparcv9 > > CFLAGS=“-L/usr/sfw/lib/sparcv9 -R/usr/sfw/lib/sparcv9“ > > Perl Version: perl-5.12.2 > > > > Can you advise, please? > > > > No error log under t/logs/error_log > > > > > > ld: fatal: file > /pkg/products/httpd_test/httpd/httpd-2.2.17a/apr-util//lib/libaprutil-1.so: > wrong ELF class: ELFCLASS64 > > ld: fatal: file > /pkg/products/httpd_test/httpd/httpd-2.2.17a/apr-util//lib/libexpat.so: > wrong ELF class: ELFCLASS64 > > ld: fatal: file > /pkg/products/httpd_test/httpd/httpd-2.2.17a/apr/lib/libapr-1.so: wrong ELF > class: ELFCLASS64 > > ld: fatal: File processing errors. No output written to > ../../../blib/arch/auto/APR/APR.so > > collect2: ld returned 1 exit status > > *** Error code 1 > > make: Fatal error: Command failed for target > `../../../blib/arch/auto/APR/APR.so' > > Current working directory > /home/admin/kstas/httpd/modules/mod_perl/mod_perl-2.0.4/xs/APR/APR > > *** Error code 1 > > The following command caused the error: > > cd APR && make -f Makefile all LIBPERL_A="libperl.a" LINKTYPE="dynamic" > OPTIMIZE="-fPIC" PREFIX="/pkg/products/perl/perl-5.12.2" PASTHRU_INC="" > > make: Fatal error: Command failed for target `subdirs' > > Current working directory > /home/admin/kstas/httpd/modules/mod_perl/mod_perl-2.0.4/xs/APR > > *** Error code 1 > > The following command caused the error: > > cd APR && make -f Makefile all LIBPERL_A="libperl.a" LINKTYPE="dynamic" > OPTIMIZE="-fPIC" PREFIX="/pkg/products/perl/perl-5.12.2" PASTHRU_INC="" > > make: Fatal error: Command failed for target `subdirs' > > Current working directory > /home/admin/kstas/httpd/modules/mod_perl/mod_perl-2.0.4/xs > > *** Error code 1 > > The following command caused the error: > > cd xs && make -f Makefile all LIBPERL_A="libperl.a" LINKTYPE="dynamic" > OPTIMIZE="-fPIC" PREFIX="/pkg/products/perl/perl-5.12.2" PASTHRU_DEFINE="" > PASTHRU_INC="" PERL="/pkg/products/perl/perl-5.12.2/bin/perl" > DEFINE="-DMP_HAVE_APR_LIBS" > > make: Fatal error: Command failed for target `subdirs' > > >