Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-19 Thread Wojciech Puchar


Can anyone tell how do we handle this situation???

Is there any way or i have to compile my code on 64 bit machine??


what's a problem to compile on 64-bit machine?


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-19 Thread Heiko Wundram (Beenic)
Am Dienstag, 19. Februar 2008 15:08:12 schrieb Wojciech Puchar:
  Can anyone tell how do we handle this situation???
 
  Is there any way or i have to compile my code on 64 bit machine??

 what's a problem to compile on 64-bit machine?

Ugh, there can be lots of problems, at least if the original programmers 
weren't careful enough to avoid the many pitfalls of inter-architecture 
development.

For example, in C, the long type is 32-bits wide on i386, and 64-bits wide on 
amd64, whereas int is 32-bits wide on both.

Take the following code:

#include stdio.h

int main(int argc, char** argv)
{
int x;
unsigned long y = (unsigned long)x;

printf(%x\n,y);
return 0;
}

The formatting code %x expects an unsigned integer, but is given an unsigned 
long (which is always big enough to fit an address, that's mandated by the C 
standard, and so will contain the memory address of x). gcc only warns about 
the non-matching format-string argument when run with -Wall.

On i386, this doesn't matter, as sizeof(int)==sizeof(long).
On amd64, this does matter, as printing a %x will only print the low-order 
four bytes of the memory address, and not the upper four bytes, so that the 
output string will no longer be unique for object x, depending on how the 
virtual memory space is partitioned.

Now, I've seen quite a good deal of software who do stuff similar to this (at 
least in spirit, by casting an address to an unsigned integer) to build 
(hash) tables, and they all miserably fail when compiled on amd64, simply 
because they presume that sizeof(int) == sizeof(long), which isn't true on 
amd64 anymore.

If the OP's development team haven't taken care to avoid these pitfalls from 
the start (which I guess they didn't, simply because they are only used to 
developing on i386), they can be in for a real treat when trying to compile 
_and run_ their application on amd64. I know I've had my fair share of 
(re-)learning to do when initially compiling my (personal use) C++ programs 
on amd64.
 
-- 
Heiko Wundram
Product  Application Development
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-19 Thread navneet Upadhyay
a machine will be required (always) , i think i figured it out , ineed to
compile them using *amd64  *instead of i386 .




On 2/19/08, Wojciech Puchar [EMAIL PROTECTED] wrote:

 
  Can anyone tell how do we handle this situation???
 
  Is there any way or i have to compile my code on 64 bit machine??

 what's a problem to compile on 64-bit machine?



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread Norman Maurer

Am Montag, den 18.02.2008, 20:42 +0530 schrieb navneet Upadhyay:
 it and 64 bit RHEL.
 
 We are porting the product to FreeBSD and when we tried the same,
 i.erunning binaries compiled on 32 bit FreeBSD
 6.2 on 64 bit FreeBSD system they produce *core dump.*
 
 
 Any known reasons, do we have to compile binaries on 64 bit machine.
 
 Thanks,

Do you have the lib32's installed ?

bye
Norman


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread Dominic Fandrey

navneet Upadhyay wrote:

Hi ,
For our product we generally compile the binaries on 32 bit systems
and use them for both 32 and 64 bit systems. like we have same binaries for
32 bit and 64 bit RHEL.

We are porting the product to FreeBSD and when we tried the same,
i.erunning binaries compiled on 32 bit FreeBSD
6.2 on 64 bit FreeBSD system they produce *core dump.*


Any known reasons, do we have to compile binaries on 64 bit machine.


This should not happen. I would blindly guess at a linking problem. Are you 
using any shared libraries that do not belong to the base system?

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread navneet Upadhyay
I checked in usr/local/ and didnt find the lib32 folder, so i guess they are
nt installed .

Why do i need them ? can u put some light on it ?


On 2/18/08, Norman Maurer [EMAIL PROTECTED] wrote:


 Am Montag, den 18.02.2008, 20:42 +0530 schrieb navneet Upadhyay:
  it and 64 bit RHEL.
 
  We are porting the product to FreeBSD and when we tried the same,
  i.erunning binaries compiled on 32 bit FreeBSD
  6.2 on 64 bit FreeBSD system they produce *core dump.*
 
 
  Any known reasons, do we have to compile binaries on 64 bit machine.
 
  Thanks,

 Do you have the lib32's installed ?

 bye
 Norman



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread navneet Upadhyay
Yes i am using few libs not built on FreeBSD but they work fine on 32 bit
freeBSD , so in principle they shud have the same behavior on 64 one.

On 2/18/08, Dominic Fandrey [EMAIL PROTECTED] wrote:

 navneet Upadhyay wrote:
  Hi ,
  For our product we generally compile the binaries on 32 bit
 systems
  and use them for both 32 and 64 bit systems. like we have same binaries
 for
  32 bit and 64 bit RHEL.
 
  We are porting the product to FreeBSD and when we tried the same,
  i.erunning binaries compiled on 32 bit FreeBSD
  6.2 on 64 bit FreeBSD system they produce *core dump.*
 
 
  Any known reasons, do we have to compile binaries on 64 bit machine.

 This should not happen. I would blindly guess at a linking problem. Are
 you
 using any shared libraries that do not belong to the base system?

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread Bill Moran
In response to navneet Upadhyay [EMAIL PROTECTED]:

 I checked in usr/local/ and didnt find the lib32 folder, so i guess they are
 nt installed .
 
 Why do i need them ? can u put some light on it ?

I'm not sure of the details why you need them, but no ia32 program that
I've seen runs properly on amd64 without.

If you're running a release version, you can run sysinstall, then go to
configuration - distributions and select to install.

You can also build/install world and this should grab them by default.

 
 
 On 2/18/08, Norman Maurer [EMAIL PROTECTED] wrote:
 
 
  Am Montag, den 18.02.2008, 20:42 +0530 schrieb navneet Upadhyay:
   it and 64 bit RHEL.
  
   We are porting the product to FreeBSD and when we tried the same,
   i.erunning binaries compiled on 32 bit FreeBSD
   6.2 on 64 bit FreeBSD system they produce *core dump.*
  
  
   Any known reasons, do we have to compile binaries on 64 bit machine.
  
   Thanks,
 
  Do you have the lib32's installed ?
 
  bye
  Norman
 
 
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]


-- 
Bill Moran
http://www.potentialtech.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread Wojciech Puchar

and use them for both 32 and 64 bit systems. like we have same binaries for
32 bit and 64 bit RHEL.

We are porting the product to FreeBSD and when we tried the same,
i.erunning binaries compiled on 32 bit FreeBSD
6.2 on 64 bit FreeBSD system they produce *core dump.*


no idea. i use it but rarely, having no problems.

consider adding extra logs (printfs, etc.) to get know when it crashes and
fill a problem report




Any known reasons, do we have to compile binaries on 64 bit machine.


you should, as is it not a problem but performance is much better.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread Dominic Fandrey

navneet Upadhyay wrote:
  On 2/18/08, Dominic Fandrey [EMAIL PROTECTED] wrote:

navneet Upadhyay wrote:

Hi ,
For our product we generally compile the binaries on 32 bit

systems

and use them for both 32 and 64 bit systems. like we have same binaries

for

32 bit and 64 bit RHEL.

We are porting the product to FreeBSD and when we tried the same,
i.erunning binaries compiled on 32 bit FreeBSD
6.2 on 64 bit FreeBSD system they produce *core dump.*


Any known reasons, do we have to compile binaries on 64 bit machine.

This should not happen. I would blindly guess at a linking problem. Are
you
using any shared libraries that do not belong to the base system?




 Yes i am using few libs not built on FreeBSD but they work fine on 32 bit
 freeBSD , so in principle they shud have the same behavior on 64 one.

I suppose you are aware that they have to be 32-Bit libraries as well, for 
your 32-Bit application to work?

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread navneet Upadhyay
I didnt get what do you mean.

Do you mean :

I should install lib32 on freeBSD and then rebuild my applications in order
to make it work on 32 and 64 bit systems .

rite now I have built my app on 32 bit system (which is not having lib32
installed), it works on 32 bit freebsd but fails on 64 bit system.


On 2/18/08, Dominic Fandrey [EMAIL PROTECTED] wrote:

 navneet Upadhyay wrote:
  On 2/18/08, Dominic Fandrey [EMAIL PROTECTED] wrote:
  navneet Upadhyay wrote:
  Hi ,
  For our product we generally compile the binaries on 32 bit
  systems
  and use them for both 32 and 64 bit systems. like we have same
 binaries
  for
  32 bit and 64 bit RHEL.
 
  We are porting the product to FreeBSD and when we tried the same,
  i.erunning binaries compiled on 32 bit FreeBSD
  6.2 on 64 bit FreeBSD system they produce *core dump.*
 
 
  Any known reasons, do we have to compile binaries on 64 bit machine.
  This should not happen. I would blindly guess at a linking problem. Are
  you
  using any shared libraries that do not belong to the base system?
 
 
  Yes i am using few libs not built on FreeBSD but they work fine on 32
 bit
  freeBSD , so in principle they shud have the same behavior on 64 one.

 I suppose you are aware that they have to be 32-Bit libraries as well, for
 your 32-Bit application to work?

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 32 bit and 64 bit freebsd binary compatiblty

2008-02-18 Thread Dominic Fandrey

navneet Upadhyay wrote:

On 2/18/08, Dominic Fandrey [EMAIL PROTECTED] wrote:

navneet Upadhyay wrote:

On 2/18/08, Dominic Fandrey [EMAIL PROTECTED] wrote:

navneet Upadhyay wrote:

Hi ,
For our product we generally compile the binaries on 32 bit

systems

and use them for both 32 and 64 bit systems. like we have same

binaries

for

32 bit and 64 bit RHEL.

We are porting the product to FreeBSD and when we tried the same,
i.erunning binaries compiled on 32 bit FreeBSD
6.2 on 64 bit FreeBSD system they produce *core dump.*


Any known reasons, do we have to compile binaries on 64 bit machine.

This should not happen. I would blindly guess at a linking problem. Are
you
using any shared libraries that do not belong to the base system?


Yes i am using few libs not built on FreeBSD but they work fine on 32

bit

freeBSD , so in principle they shud have the same behavior on 64 one.

I suppose you are aware that they have to be 32-Bit libraries as well, for
your 32-Bit application to work?


I didnt get what do you mean.

Do you mean :

I should install lib32 on freeBSD and then rebuild my applications in order
to make it work on 32 and 64 bit systems .

rite now I have built my app on 32 bit system (which is not having lib32
installed), it works on 32 bit freebsd but fails on 64 bit system.


The app needs 32-Bit libraries tu run on 64 Bit. I suggest you link your 
program statically against libraries that are not part of the base system. 
That way everything should run just fine.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]