IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 16 years ago

Closed 16 years ago

#1404 closed defect (fixed)

More type confusion

Reported by: Michael Wood-Vasey Owned by: magnier
Priority: normal Milestone:
Component: Ohana Version:
Severity: normal Keywords:
Cc: bills

Description

Mac Pro Intel. Mac OS 10.6.4. gcc-4.2

More type confusion in libfits. There are a number of warnings such as the following:

---
gcc-4.2 -O2 -std=gnu89 -D_DARWIN_C_SOURCE -fPIC -Wall -Werror -Wall -Werror -DHAVE_MYSQL_H -I/Volumes/data/PS1/src/ipp-2.9/Ohana/src/libfits/include -I/Volumes/data/PS1/code/ipp-2.9/mwv.darwin_x86/include -I/usr/include -I/Volumes/data/PS1/code/ipp-2.9/mwv.darwin_x86/include -I/Volumes/data/PS1/code/ipp-2.9/mwv.darwin_x86/include/mysql -Ddarwin_x86 -I/Volumes/data/PS1/src/ipp-2.9/Ohana/src/libfits/extern -c /Volumes/data/PS1/src/ipp-2.9/Ohana/src/libfits/header/F_create_H.c -o /Volumes/data/PS1/src/ipp-2.9/Ohana/src/libfits/header/F_create_H.darwin_x86.o
cc1: warnings being treated as errors
/Volumes/data/PS1/src/ipp-2.9/Ohana/src/libfits/header/F_create_H.c: In function ‘gfits_create_header’:
/Volumes/data/PS1/src/ipp-2.9/Ohana/src/libfits/header/F_create_H.c:25: warning: format ‘%jd’ expects type ‘intmax_t’, but argument 5 has type ‘long long int’
make[3]: * Volumes/data/PS1/src/ipp-2.9/Ohana/src/libfits/header/F_create_H.darwin_x86.o Error 1
make[2]:
* [libfits.install] Error 2
make[1]: * [libs] Error 1
make:
* [all] Error 1
problem building Ohana : failure in make

Change History (7)

comment:1 by Michael Wood-Vasey, 16 years ago

After libfits, next one was 'addstar'


gcc-4.2 -O2 -std=gnu89 -D_DARWIN_C_SOURCE -Wall -Werror -Wall -DHAVE_MYSQL_H -I/Volumes/data/PS1/src/ipp-2.9/Ohana/src/addstar/include -I/Volumes/data/PS1/code/ipp-2.9/mwv.darwin_x86/include -I/usr/include -I/Volumes/data/PS1/code/ipp-2.9/mwv.darwin_x86/include -I/Volumes/data/PS1/code/ipp-2.9/mwv.darwin_x86/include/mysql -Ddarwin_x86 -c /Volumes/data/PS1/src/ipp-2.9/Ohana/src/addstar/src/SkyTableFromTychoIndex.c -o /Volumes/data/PS1/src/ipp-2.9/Ohana/src/addstar/src/SkyTableFromTychoIndex.darwin_x86.o
cc1: warnings being treated as errors
/Volumes/data/PS1/src/ipp-2.9/Ohana/src/addstar/src/SkyTableFromTychoIndex.c: In function ‘SkyTableFromTychoIndex’:
/Volumes/data/PS1/src/ipp-2.9/Ohana/src/addstar/src/SkyTableFromTychoIndex.c:149: warning: format ‘%jd’ expects type ‘intmax_t’, but argument 3 has type ‘off_t’
make[2]: * Volumes/data/PS1/src/ipp-2.9/Ohana/src/addstar/src/SkyTableFromTychoIndex.darwin_x86.o Error 1
make[1]:
* [addstar] Error 2
make: * [all] Error 1

comment:2 by eugene, 16 years ago

Cc: bills added

This problem is being caused by some inconsistency in definitions.

OFF_T_FMT is currently defined as either %ld or %jd depending on the following block in Ohana/src/libohana/include/ohana.h:135:

# ifdef _LARGEFILE_SOURCE
# define OFF_T_FMT "%jd"
# endif
# ifdef lin64
# define OFF_T_FMT "%jd"
# endif
# ifdef _DARWIN_C_SOURCE
# define OFF_T_FMT "%jd"
# endif
# ifndef OFF_T_FMT
# define OFF_T_FMT "%ld"
# endif

the type is needed to match the type resolved by the off_t type.

It looks like your build has _DARWIN_C_SOURCE defined, and it looks like OFF_T_FMT is getting set to %jd because of that.

what do you get if you run the following command: getconf LFS_CFLAGS ?

could you check the size of the following types using the same cflags as the above:

off_t, intmax_t, long long int

comment:3 by Michael Wood-Vasey, 16 years ago

[serenity ~] getconf LFS_CFLAGS
getconf: no such configuration parameter `LFS_CFLAGS'

The types are all 8 characters in size.

[serenity psconfig] cat a.c
/* Checking sizes of types */

#include <stdio.h>
#include <stdint.h>

int main() {

printf("off_t: %lu\n", sizeof(off_t));
printf("intmax_t: %lu\n", sizeof(intmax_t));
printf("long long int: %lu\n", sizeof(long long int));

return(0);

}

[serenity psconfig] gcc -O2 -std=gnu89 -D_DARWIN_C_SOURCE -Wall -Werror -Wall -DHAVE_MYSQL_H -Ddarwin_x86 a.c
[serenity psconfig] ./a.out
off_t: 8
intmax_t: 8
long long int: 8

comment:4 by eugene, 16 years ago

change the line in Ohana/src/libohana/include/ohana.h

# ifdef _DARWIN_C_SOURCE
# define OFF_T_FMT "%jd"
# endif

to read:

# ifdef _DARWIN_C_SOURCE
# define OFF_T_FMT "%lld"
# endif

comment:5 by bills, 16 years ago

The results are the same on MacOS 10.5.8. The results of this are the same regardless of whether _DARWIN_C_SOURCE is defined.

comment:6 by Michael Wood-Vasey, 16 years ago

# ifdef _DARWIN_C_SOURCE
# define OFF_T_FMT "%lld"
# endif

That worked for me. I made the change, added Werror back in the Makefiles then

make clean
psconfigure
make
make install

completed fine.

comment:7 by bills, 16 years ago

Resolution: fixed
Status: newclosed

I've integrated the change

Note: See TracTickets for help on using tickets.