Re: compiling and linking problems on 64-bit (casting & alignment)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mitja Ursic wrote:
> Hello,
> 
> I have a problem when compiling and linking a program with several hundred C++ 
> and FORTRAN files (not done by me:-). I am using GCC version 3.4.6. The 
> computer is 64 bit. 
It doesn't matter about the 64-bitness of the computer.  You could be
running a 32-bit OS.
> 
> For compiling I am using:
> C++: g++ -Dmacros -O -Wno-deprecated -I.   Ipaths  -c yy.cc
> FORTRAN: g77 –Dmacros -fno-underscoring -O -Wall -I. Ipaths   -c xx..f
> 
> Linking is done with:
> g++ aa.o bb.o cc.o -o dd.exe –Lpath  -llibs -lg2c -lstdc++ -lm  
g++ implies -lstdc++ -lm.  If you need those options, something is wrong.
> 
> If I compiled as described I received “Warning: cast from pointer to integer of 
> different size”, nevertheless linking was successful.
> By using the switch –m32 in compiling process the warning was gone. But on the 
> other hand I received »Warning: alignment 8 of symbol `s1' in libCpp.a(xx.o) is 
> smaller than 16 in libFortran.a(YY.o)« when I was linking (also with –m32).
You can't mix ingredients built with -m64 (default on 64-bit g++/g77)
with those built with -m32 (which would be the default if you have
32-bit OS).  I too would worry somewhat about mixing builds with
different alignments.  In my experience, the alignment conflict would
mean either that you have something built with much older tools, or with
different options, such as -Os (or perhaps explicitly using
-mpreferred-stack-boundary=3).  The alignment 8 would break any use of
parallel SSE, including vectorization, in callees (you may not have any
such).

> Could anyone give me at least advice how to compile and link on 64-bit computer 
> without warnings I gave?
> 
A lot of this depends on what you are trying to do, which you haven't
specified.  Some of us might advise you to use a current g++ and
gfortran in place of g77, and to avoid tinkering with the Fortran
underscoring model, in addition to figuring out your OS version, and
whether you want 32- or 64-bit compilation, I don't trust any 64-bit g77.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux