Jump to content
Excelsior Forums
Sign in to follow this  
ulli

xds-x86: Building libxds.a on x86_64

Recommended Posts

I tried to build the libxds.a on Debian4.0 (etch) and Debian5.0(lenny). I have no problem with

Debian4.0 on i386. Then I tried on Debian4.0 on AMD64. The system is (almost) the same (it's built from a

automatic procedure), same kernel version, same glibc - but it is installed as a full 64bit system with 64bit

kernel and 64bit userland.

My question is: What I have to do to get xds-x86 running in a 64bit environment?

Here are the error message I've got on a Debian4.0 (etch) with kernel 2.6.18 with gcc-4.1.2:

gcc  -D_unix -D_linux -DX2C_no_spawn -DX2C_strcmp -DX2C_native_library -O2 -fno-

strength-reduce -I../../include -c -o ../../C/X2C.o ../../C/X2C.c

In file included from /usr/include/asm/sigcontext.h:8,

                from ../../C/X2C.c:193:

/usr/include/asm-x86_64/sigcontext.h:10: error: redefinition of 'struct _fpstate'

/usr/include/asm-x86_64/sigcontext.h:24: error: redefinition of 'struct sigcontext'

As recommended in another post I commented out line 193 in X2C.c

/* #include <asm/sigcontext.h> */

leading to the following warnings and error messages:

*/../../C/X2C.c: In function 'Ini_Aligment':

../../C/X2C.c:362: warning: cast from pointer to integer of different size

../../C/X2C.c: In function 'Set_Stack':

../../C/X2C.c:427: warning: cast from pointer to integer of different size

../../C/X2C.c: In function 'sp_offs_ok':

../../C/X2C.c:600: warning: cast from pointer to integer of different size

../../C/X2C.c: In function 'fp_error':

../../C/X2C.c:797: error: 'struct user_i387_struct' has no member named 'fcs'

../../C/X2C.c: At top level:

../../C/X2C.c:818: warning: 'struct sigcontext_struct' declared inside parameter list

../../C/X2C.c:818: warning: its scope is only this definition or declaration, which is probably not what you want

../../C/X2C.c:818: error: parameter 2 ('cntxt') has incomplete type

../../C/X2C.c: In function 'X2C_SIGSEGV_handler':

../../C/X2C.c:821: warning: passing argument 2 of 'signal' from incompatible pointer type

../../C/X2C.c: In function 'X2C_BEGIN':

../../C/X2C.c:908: warning: passing argument 2 of 'signal' from incompatible pointer type

make: *** [../../C/X2C.o] Error 1

Next I include a line

unsigned short  fcs;

in /usr/include/asm-x86_64/user.h

Then the error message about line 797 vanishs - but I have no idea how to fix the problem with line 818.

The messages for Debian5.0(lenny), kernel 2.6.26, gcc-4.3 are similar (after changing line 192 in X2C.c

from include linux/user.h to sys.user.h) both for i386 and x86_64:

i386:

../../C/X2C.c: In function 'fp_error':

../../C/X2C.c:797: error: invalid use of undefined type 'struct user_i387_struct'

../../C/X2C.c:798: error: invalid use of undefined type 'struct user_i387_struct'

../../C/X2C.c: In function 'X2C_SIGSEGV_handler':

../../C/X2C.c:821: warning: passing argument 2 of 'signal' from incompatible pointer type

make: *** [../../C/X2C.o] Error 1

x86_64:

../../C/X2C.c: In function 'Ini_Aligment':

../../C/X2C.c:362: warning: cast from pointer to integer of different size

../../C/X2C.c: In function 'Set_Stack':

../../C/X2C.c:427: warning: cast from pointer to integer of different size

../../C/X2C.c: In function 'sp_offs_ok':

../../C/X2C.c:600: warning: cast from pointer to integer of different size

../../C/X2C.c: In function 'fp_error':

../../C/X2C.c:797: error: invalid use of undefined type 'struct user_i387_struct'

../../C/X2C.c:798: error: invalid use of undefined type 'struct user_i387_struct'

../../C/X2C.c: At top level:

../../C/X2C.c:818: warning: 'struct sigcontext_struct' declared inside parameter list

../../C/X2C.c:818: warning: its scope is only this definition or declaration, which is probably not what you want

../../C/X2C.c:818: error: parameter 2 ('cntxt') has incomplete type

../../C/X2C.c: In function 'X2C_SIGSEGV_handler':

../../C/X2C.c:821: warning: passing argument 2 of 'signal' from incompatible pointer type

make: *** [../../C/X2C.o] Error 1

Any help or hint is welcome!

Ulrike Nitzsche

Share this post


Link to post
Share on other sites

Thank you for your fast answer. Doing this I can run ./apisyms-x86 without errors.

But if I try to build the samples on the 64bit machine I get a lot of messages like

/usr/bin/ld: warning: i386 architecture of input file `linnew.o' is incompatible with i386:x86-64 output

/usr/bin/ld: warning: i386 architecture of input file `/usr/local/xds-x86/lib/x86/libxds.a(ConvTypes.o)' is incompatible with i386:x86-64 output

...

and if I call "bench/linnew" a segmentation fault occurs.

Here we have the situation of the same Debian version (Etch) but on different hardware architecture (i386 where all works fine and x86_64).

I assume building the libxds.a on the x86_64 architecture would help but I need some help to do this.

Best regards,

Ulli

Share this post


Link to post
Share on other sites

I assume building the libxds.a on the x86_64 architecture would help but I need some help to do this.

No, you need to force the linker to create a 32-bit executable. Figure out the respective gcc command-line parameter and patch the LFLAGS definition in [tt]bin/xc.tem[/tt] under your Native XDS-x86 directory.

If you succeed, please post your results here for the benefit of others.

Share this post


Link to post
Share on other sites

Thank you for the hint. I changed bin/xc.tem as follows:

! "CF\t= -O2 -g -I$(INCL) -c\n"

to

! "CF\t= -m32 -O2 -g -I$(INCL) -c\n"

! "LFLAGS\t= -static\n"

to

! "LFLAGS\t=  -m32 -static\n"

! "LFLAGS\t=\n"

to

! "LFLAGS\t= -m32\n"

Because on my 64bit system I have no 32bit-openmotif but 32bit-lesstif2 I changed an additionally line:

! "XLIBS\t= -L/usr/lib -L/opt/openmotif/lib -lXm -lXt -lX11\n"

to

! "XLIBS\t= -L/usr/lib -L/opt/openmotif/lib -lXm -lXp -lXmu -lXt -lX11\n"

Please check if you have all necessary 32bit libraries in /emul/ia32-linux/usr/lib.

These changes works with Debian/Lenny too.

Thanks for the help again,

Ulli

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×