Opened 18 years ago

Closed 17 years ago

Last modified 16 years ago

#84 closed defect (fixed)

Error reported by NAG Linux compiler in flib/cpusec.c

Reported by: Dave Offiler Owned by: Dave Offiler
Priority: major Milestone: 1.1
Component: ropp_utils Version: 0.8
Keywords: NAG GCC Cc: michael.rennie@…, dave.offiler@…

Description

ropp_tools configured with nag_linux running under IDL ropp_test

make[1]: Entering directory `/net/home/h03/frir/ropprepos/ropp_tools/build'
gcc -DPACKAGE_NAME=\"ropp_tools\" -DPACKAGE_TARNAME=\"ropp_tools\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"ropp_tools\ 0.9\" -DPACKAGE_BUGREPORT=\"grassaf@metoffice.gov.uk\" -DPACKAGE=\"ropp_tools\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_MODULE_TYPESIZES=1  -I. -I.  -DNAGf90Fortran -I/data/nwp1/grassaf/ropp/nag//include -I../include  -O3 -c -o cpusec.c1.o `test -f '../flib/cpusec.c1.c' || echo './'`../flib/cpusec.c1.c
In file included from /usr/include/sys/types.h:219,
                 from ../flib/cpusec.c1.c:26:
/usr/include/sys/sysmacros.h: In function `cpu_second':
/usr/include/sys/sysmacros.h:43: error: nested function `gnu_dev_major' declared `extern'
/usr/include/sys/sysmacros.h:49: error: nested function `gnu_dev_minor' declared `extern'
/usr/include/sys/sysmacros.h:55: error: nested function `gnu_dev_makedev' declared `extern'
make[1]: *** [cpusec.c1.o] Error 1

Change history (9)

comment:1 by Dave Offiler, 18 years ago

Keywords: NAG GCC added
Status: newassigned

The problem appears to be that the system file sys/sysmacros.h is completely different in the new RHEL4 gcc than the old RH9 one. This C code is only used in the NAG configure; Fortran equivalents are used for all other compilers.

One possibility would be to replace cpusec.c1.c with a dummy routine which merely returns zero values to the caller. If this routine is actually being used anywhere in the ROPP code (e.g. for timing purposes), then the downside would be no useful timing info for te NAG compiler.

A second option is to save a copy of the old sysmacros.h (which worked before RHEL4)somewhere in gcc 's -I path (ropp_tools/include, or configured <prefix>/include). At the moment its not obvious whther this should be included in the ROPP distro or not.

comment:2 by Dave Offiler, 18 years ago

Followed 2nd option.

1) In flib/cpusec.c1.c, changed #include from system <sys/sysmacro.h> to local "sysmacro,h"

2) Copied old RH9 version of sys/sysmacro.h to ropp_tools/include directory.

Checked that this allows the 'make' to compile the whole ropp_tools suite.

3) Modified include/Makefile.am to add sysmacros.h to EXTRA_DIST and re-run autoreconf and configure_nag_linux to re-build include/Makefile.in and include/Makefile

Checked that this mod includes include/sysmacros.h in the tarball.

Committed as changset [956]. Awaiting that this solves the reported problem in the ropp_test system.

comment:3 by Dave Offiler, 18 years ago

Resolution: fixed
Status: assignedclosed

Mike repoprts that the ropp_test for nag_linux now build ropp_test OK. Closing this Ticket.

NB we have not tested that this cpusec routine actually works at run time...

comment:4 by marq, 18 years ago

Cc: dave.offiler@… added
Priority: normalhigh
Resolution: fixed
Status: closedreopened

What you have done here is fixing an OS dependent issue by adding apparently outdated souces to the generic ROPP tree. Please don't do that, even if it provides a quick fix. Instead, find out why the problem ocurs, and fix it properly.

Note: The sysmacros.h header file is a system file; just using an old version which is inconsistent with the ciurrent version of thze OS might break other things. You can always work around OS specific issues with the proper preprocessing consitionals etc.. In addition, this stuff should at the very minimum be encapsulated by the proper conditionals of the automake/autoconf system.

Imagine someone else runs the NAG on another platform, but you are overwriting the equivalent system header. You will immediately break any compile there.

So please revert this ASAP and find a proper solution.

comment:5 by Dave Offiler, 18 years ago

The original issue clearly stems from the new RHEL4 desktop, since there was no problem under RH9. If/when it can be shown to be a fault in the RH distro, it will be hotlined, and hopefully fixed - but probably not in any timescale we can use for beta.

The 'fix' was only intended to see if replacing the offending system file (I'm well aware of its status) with the old one worked, in order to confirm the fault is in the new. In order to run this through the IDL/ropp_test, it needs to be in the tar package. I do not intend it to remain there for release versions (though it might be for the beta; if it does break something, the local file can simply be deleted).

At the end of the day, this affects NAG/Linux only - not fundamentally that f95 compiler but only because the C routine that needs to be linked with it instead of (apparantly) one that exosts in other compilers' own libraries. There are surely other permanant options, if we had time to investigate them. There may be conditionals or preprocessing that can be applied to the local C routine, but none of us here have the necessary C expertise.

I'm happy to leave this ticket open as a reminder that a proper fix is required, but that won't be in the immediate future if left to the development team here in Exeter.

comment:6 by Dave Offiler, 18 years ago

Version: 0.8

comment:7 by Huw Lewis, 17 years ago

Resolution: fixed
Status: reopenedclosed

NAG/Linux testing worked fine for ROPP release v1.1. Note flib dependency will be removed by v1.2. Ticket closed as no further investigation to be done.

comment:8 by (none), 16 years ago

Milestone: 1.1

Milestone 1.1 deleted

comment:9 by Huw Lewis, 16 years ago

Milestone: 1.1
Note: See TracTickets for help on using tickets.