I am a developer running CentOS 4 on a web server (no desktop), and am
running into what I can only imagine must be a problem with 32 bit
versus 64 bit code.
I am trying to compile an unfortunately closed-source module from a
company called Cybersource. The error message is the following:
gcc -c -I. -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -
Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m64 -
DVERSION=\"5.0.0\" -DXS_VERSION=\"5.0.0\" -fPIC "-I/usr/lib64/
perl5/5.8.8/x86_64-linux-thread-multi/CORE" SOAPI.c
In file included from SOAPI.xs:5:
ppport.h:227:1: warning: "PERL_UNUSED_DECL" redefined
In file included from SOAPI.xs:2:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:163:1:
warning: this is the location of the previous definition
Running Mkbootstrap for CyberSource::SOAPI ()
chmod 644 SOAPI.bs
rm -f blib/arch/auto/CyberSource/SOAPI/SOAPI.so
LD_RUN_PATH="/home/amiri/simapi-perl-5.0.0/lib" gcc -shared SOAPI.o -
o blib/arch/auto/CyberSource/SOAPI/SOAPI.so \
-L/home/amiri/simapi-perl-5.0.0/lib -lcybersource -lspapache -lstdc
++ -lxalan-c1_5_0 -lxerces-c \
/usr/bin/ld: skipping incompatible /home/amiri/simapi-perl-5.0.0/lib/
libcybersource.a when searching for -lcybersource
/usr/bin/ld: cannot find -lcybersource
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/CyberSource/SOAPI/SOAPI.so] Error 1
I see quite clearly that it is skipping an incompatible binary. But I
should be able to make it use the proper tool, no? I do not know how.
I have tried aliasing gcc to gcc -m32; I have tried changing my
Makefile so that LDFLAGS=-m32, and so that CC=gcc -m32, etc., but none
of that worked.
If I do use those -m32 flags, I get the following:
cp lib/libcybersource.a blib/lib/libcybersource.a
cp lib/libstdc++.so.4 blib/lib/libstdc++.so.4
cp lib/libxerces-c.so blib/lib/libxerces-c.so
cp lib/libspapache.so blib/lib/libspapache.so
cp SOAPI.pm blib/lib/CyberSource/SOAPI.pm
AutoSplitting blib/lib/CyberSource/SOAPI.pm (blib/lib/auto/CyberSource/
SOAPI)
cp lib/libxerces-c.so.21 blib/lib/libxerces-c.so.21
cp lib/libxalan-c1_5_0.so blib/lib/libxalan-c1_5_0.so
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/
perl5/5.8.8/ExtUtils/typemap -typemap typemap SOAPI.xs > SOAPI.xsc &&
mv SOAPI.xsc SOAPI.c
Please specify prototyping behavior for SOAPI.xs (see perlxs manual)
/usr/bin/gcc -m32 -c -I. -D_REENTRANT -D_GNU_SOURCE -fno-strict-
aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -
D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -
pipe -m64 -DVERSION=\"5.0.0\" -DXS_VERSION=\"5.0.0\" -fPIC "-I/usr/
lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" SOAPI.c
In file included from SOAPI.xs:5:
ppport.h:227:1: warning: "PERL_UNUSED_DECL" redefined
In file included from SOAPI.xs:2:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:163:1:
warning: this is the location of the previous definition
{standard input}: Assembler messages:
{standard input}:150: Error: bad register name `%rbp'
{standard input}:156: Error: bad register name `%rbx'
{standard input}:158: Error: bad register name `%rsp'
{standard input}:163: Error: bad register name `%rax)'
{standard input}:165: Error: bad register name `%rax'
{standard input}:168: Error: bad register name `%rax)'
{standard input}:171: Error: bad register name `%rax)'
{standard input}:173: Error: bad register name `%rax'
{standard input}:175: Error: bad register name `%rax)'
{standard input}:177: Error: bad register name `%rcx)'
There's a whole lot of those bad register name errors.
I have both i386 and x86_64 versions of glib, glib-devel, glib-2,
glibc, glibc-devel, libgcc, libstdc++, libstdc++-devel.
If I try to use gcc4 with the -m32 flags, I get the following:
/usr/bin/gcc4 -m32 -c -I. -D_REENTRANT -D_GNU_SOURCE -fno-strict-
aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -
D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -
pipe -m64 -DVERSION=\"5.0.0\" -DXS_VERSION=\"5.0.0\" -fPIC "-I/usr/
lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" SOAPI.c
In file included from SOAPI.xs:5:
ppport.h:227:1: warning: "PERL_UNUSED_DECL" redefined
In file included from SOAPI.xs:2:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:163:1:
warning: this is the location of the previous definition
Running Mkbootstrap for CyberSource::SOAPI ()
chmod 644 SOAPI.bs
rm -f blib/arch/auto/CyberSource/SOAPI/SOAPI.so
LD_RUN_PATH="/home/amiri/simapi-perl-5.0.0/lib" /usr/bin/gcc4 -m32 -
shared SOAPI.o -o blib/arch/auto/CyberSource/SOAPI/SOAPI.so \
-L/home/amiri/simapi-perl-5.0.0/lib -lcybersource -lspapache -lstdc
++ -lxalan-c1_5_0 -lxerces-c \
/usr/bin/ld: warning: i386:x86-64 architecture of input file `SOAPI.o'
is incompatible with i386 output
SOAPI.o(.text+0x11): In function `boot_CyberSource__SOAPI':
/home/amiri/simapi-perl-5.0.0/SOAPI.c:473: undefined reference to
`Perl_Gthr_key_ptr'
SOAPI.o(.text+0x18):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `pthread_getspecific'
SOAPI.o(.text+0x20):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `Perl_Tstack_sp_ptr'
SOAPI.o(.text+0x2a):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `Perl_Gthr_key_ptr'
SOAPI.o(.text+0x31):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `pthread_getspecific'
SOAPI.o(.text+0x39):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `Perl_Tmarkstack_ptr_ptr'
SOAPI.o(.text+0x4d):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `Perl_Gthr_key_ptr'
SOAPI.o(.text+0x54):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `pthread_getspecific'
SOAPI.o(.text+0x5c):/home/amiri/simapi-perl-5.0.0/SOAPI.c:473:
undefined reference to `Perl_Tstack_base_ptr'
As if the bad-register-name errors just got translated into undefined
reference errors.
Does anyone have any insight? How can I compile this stuff on my
x86_64 system?
Amiri