Skip to content

Output of source_flattener.py does not compile #14

@arahlin

Description

@arahlin

Running source_flattener.py on the latest erfa release (2.0.0) creates the following errors when attempting to compile the result (this is with Apple clang 12.0 on OSX 10.15):

gcc -c -pedantic -Wall -O3 -g -fPIC -I. erfa.c -o erfa.o
In file included from erfa.c:1:
./erfa.h:634:21: error: unknown type name 'eraLEAPSECOND'
int eraDatini(const eraLEAPSECOND *builtin, int n_builtin,
                    ^
./erfa.h:635:15: error: unknown type name 'eraLEAPSECOND'
              eraLEAPSECOND **leapseconds);
              ^
./erfa.h:624:2: error: unterminated conditional directive
#ifndef _ERFA_DAT_EXTRA_H
 ^
./erfa.h:1:2: error: unterminated conditional directive
#ifndef ERFAHDEF
 ^
erfa.c:11911:10: error: use of undeclared identifier 'PACKAGE_VERSION'
  return PACKAGE_VERSION;
         ^
erfa.c:11916:10: error: use of undeclared identifier 'PACKAGE_VERSION_MAJOR'
  return PACKAGE_VERSION_MAJOR;
         ^
erfa.c:11921:10: error: use of undeclared identifier 'PACKAGE_VERSION_MINOR'
  return PACKAGE_VERSION_MINOR;
         ^
erfa.c:11926:10: error: use of undeclared identifier 'PACKAGE_VERSION_MICRO'
  return PACKAGE_VERSION_MICRO;
         ^
erfa.c:11931:10: error: use of undeclared identifier 'SOFA_VERSION'
  return SOFA_VERSION;
         ^
erfa.c:15638:21: error: use of undeclared identifier 'DBL_EPSILON'
   if ( (f-1.0) >= -DBL_EPSILON/4.0 ) {
                    ^
erfa.c:15645:13: error: use of undeclared identifier 'DBL_EPSILON'
      if ( -DBL_EPSILON/2.0 < f ) {
            ^
11 errors generated.
make[1]: *** [erfa.o] Error 1
make: *** [erfa] Error 2

It looks like the flattener creates a header file with the erfaextra.h and erfadatextra.h headers copied in the wrong order (the latter depends on the former), and with missing #endif directives (or without stripping the existing directives from the headers first). The erfa.c source file includes the version and leapsecond code, but also includes the testing code in t_erfa_c_extra.c. The source file is also missing the #include <float.h> that's required in jd2cal.c.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions