64 bit OS environment variable

Borg, Rodney Rodney.Borg at dsto.defence.gov.au
Thu Nov 15 01:05:42 UTC 2007


>You probably can mention the same in Makefile. I.e. You may have to
>specify /lib64 inside Makefile where it uses libraries instead of /lib.

>
>Thanks, 
>Krishnaprasad 

Yes, this is exactly what I need to do but I was asked if there was some
way to choose the right one based on something (like an environment
variable) so that the correct compilation/linking occurs whether the
machine is a 32 or 64 bit architecture.

>What are you trying to do?
>
>If you have a 64bit platform the default compilation/linking will link 
>to 64bit libraries. If you specify the -m32 compiler option (and use
the 
>compiler to generate the link commands) then a 32bit application will
be 
>built using 32bit libraries. A 32bit platform will use 32bit libraries,

>and can't build 64bit apps.
>
>There is a variable (not environment) called MACHTYPE which you should 
>be able to use to differentiate between a 32bit and 64bit environment, 
>or the output of the command "arch".
>
>-- 
>Nigel Wade, System Administrator, Space Plasma Physics Group,
>             University of Leicester, Leicester, LE1 7RH, UK
>E-mail :    nmw at ion.le.ac.uk
>Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

I was trying to build an application and I eventually realised I needed
to modify the supplied Jamfile for my 64 bit architecture (this involved
changing cc flags and link the right X11 libraries).  So yes I needed to
change the -m32 to -m64 and also link to the X11 libraries under
/usr/X11R6/lib64/.  When I told the original author, he asked me if
there was something he could use to detect 32/64 bit architecture and
build that into the jamfile so that it would compile correctly for 32 or
64 bit architecture.  Hence my question.
It turns out that Jam has it's own internal variables.  One is called
OSPLAT and this should allow you to determine the architecture.
However, on my system it comes up blank.  I suspect jam needs to be
updated to set OSPLAT correctly for newer systems.  

Thank you both for your suggestions.  I'll let the original developer
know what I have found.

Regards


Rodney Borg
Maritime Platforms Division
Defence Science and Technology Organisation
506 Lorimer Street
Fishermans Bend 3207
Australia

Tel: +61 3 96268228
Fax: +61 3 96268181

IMPORTANT: This email remains the property of the Australian Defence
Organization and is subject to the jurisdiction of section 70 of the
Crimes Act 1914.  If you have received this email in error, you are
requested to contact the sender and delete the email.



IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914.  If you have received this email in error, you are requested to contact the sender and delete the email.





More information about the redhat-list mailing list