HI, Ernst,

The problem is one of data type size differences between the 64 and 32 bit compilers, I think. See below for details.

I have checked and found my email regarding 64 bit Ubuntu and Linrad from last September, and my error messages on compiling Linrad were identical to yours [slight difference in line numbers due to different versions of Linrad]. My notes at the time included:

-----start quote from September 2006:

First errors [in a long list] noted:

calibrate.c: In function ?final_filtercorr_init?:
calibrate.c:401: warning: format ?%d? expects type ?int?, but argument
3 has type ?long unsigned int?
calibrate.c:401: warning: format ?%d? expects type ?int?, but argument
4 has type ?long unsigned int?

The statement in question [401] is:

sprintf(s,"File size reduced from %d to %d bytes",
              5*fft1_size*sizeof(float)+20*sizeof(int),
              5*siz*sizeof(float)+20*sizeof(int));

I imagine this will be occurring at other spots as well.

I tried a quick [and potentially dangerous] fix by 'casting' the
integer as follows:

sprintf(s,"File size reduced from %d to %d bytes",
             (int)(5*fft1_size*sizeof(float)+20*sizeof(int)),
             (int)(5*siz*sizeof(float)+20*sizeof(int)));

This of course just got me the warning:
cc1: warnings being treated as errors
buf.c: In function ?init_blanker?:
buf.c:1364: warning: cast from pointer to integer of different size
buf.c:1364: warning: cast to pointer from integer of different size

because the compiler didn't like tha cast that was done at:

   blanker_refpulse=(void*)(((int)(blanker_handle)+15)&0xfffffff0);

-----end of note from September 2006.

My kernel version and gcc version used at that time are as follows:

[EMAIL PROTECTED]:~# uname -a
Linux w3sz-amd64 2.6.15-27-amd64-generic #1 SMP PREEMPT Sat Sep 16 01:50:50 UTC 2006 x86_64 GNU/Linux

[EMAIL PROTECTED]:~# gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
[EMAIL PROTECTED]:~#

Note that Leif indicated to you that Linrad compiled OK for him with gcc version as recent as 4.1.2 20061115 (Debian). This is newer than the gcc version that failed under 64 OS, so it is not just that our versions of gcc are 'too recent'. The problem is the 64 bit compilation.

Leif and I exchanged emails back in September and he pointed out that Linrad assumes the following variable sizes [ILP32]:

char: 1
short = short int: 2
int: 4
long = long int: 4 .

A little test program he sent me to run showed that the 64 bit gcc compiler I was using [see above for version number] uses the following sizes [LP64]:

char 1
short int 2
int 4
long int 8
long unsigned int 8 .

I believe this is the problem preventing the compilation of Linrad.

Here are a couple of links related to this problem and the porting of C applications from 32 to 64 bits:

http://www-128.ibm.com/developerworks/library/l-port64.html
http://www.unix.org/version2/whatsnew/lp64_wp.html

While in theory one can just tell the gcc compiler to run in 32 bit mode by giving the flag -m32, using the -m32 flag to make the compiler revert to 32 bit mode does NOT work with my gcc/hardware combo. I get the following when I use the -m32 flag:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/bin/../lib/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/bin/../lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/usr/bin/ld: cannot find -lc

The -m64 bit flag works fine, e.g.

"gcc -m64 test.c"

works fine [if you want 64 bit code].

It may be that the Ubuntu gcc 64 bit compiler in version 4.0.3 doesn't work in 32 bit mode when automatically installed via apt-get or Synaptic. It may be that it needs to be compiled from scratch, as it were.

I have spent the evening looking for a solution and have come up with zilch. I will keep looking, and will let you and the list know what I find. Please let me know if you find a solution.



Roger Rehr
W3SZ
http://www.nitehawk.com/w3sz


Roger Rehr
W3SZ
http://www.nitehawk.com/w3sz


#############################################################
This message is sent to you because you are subscribed to
 the mailing list <linrad@antennspecialisten.se>.
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
To switch to the DIGEST mode, E-mail to <[EMAIL PROTECTED]>
To switch to the INDEX mode, E-mail to <[EMAIL PROTECTED]>
Send administrative queries to  <[EMAIL PROTECTED]>

Reply via email to