Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not seem to be able to install on python3 #66

Open
alexwestfall opened this issue Sep 26, 2024 · 1 comment
Open

does not seem to be able to install on python3 #66

alexwestfall opened this issue Sep 26, 2024 · 1 comment

Comments

@alexwestfall
Copy link

Seems a number of places in the code break on the "new" python 3.9 version when attempting to install.

(venv) alexwestfall@GLMJ61G4HL4QL pypredict % sudo python3 setup.py install
Password:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.9
copying predict.py -> build/lib.macosx-10.9-universal2-3.9
running build_ext
building 'cpredict' extension
creating build/temp.macosx-10.9-universal2-3.9
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c predict.c -o build/temp.macosx-10.9-universal2-3.9/predict.o
predict.c:127:31: warning: use of GNU old-style field designator extension [-Wgnu-designator]
struct tm debug_frozen_tm = { tm_year: 114, tm_mon: 10, tm_mday: 2 };
                              ^~~~~~~~
                              .tm_year = 
predict.c:127:45: warning: use of GNU old-style field designator extension [-Wgnu-designator]
struct tm debug_frozen_tm = { tm_year: 114, tm_mon: 10, tm_mday: 2 };
                                            ^~~~~~~
                                            .tm_mon = 
predict.c:127:57: warning: use of GNU old-style field designator extension [-Wgnu-designator]
struct tm debug_frozen_tm = { tm_year: 114, tm_mon: 10, tm_mday: 2 };
                                                        ^~~~~~~~
                                                        .tm_mday = 
predict.c:1120:48: warning: variable 'zmo' set but not used [-Wunused-but-set-variable]
        z21, z22, z23, z3, z31, z32, z33, ze, zf, zm, zmo, zn, zsing,
                                                      ^
predict.c:2126:23: warning: comparison of integers of different signs: 'unsigned int' and 'char' [-Wsign-compare]
                for (x=start, y=0; x<=end && string[x]!=0; x++)
                                   ~^ ~~~
predict.c:2151:17: warning: comparison of integers of different signs: 'unsigned int' and 'char' [-Wsign-compare]
        for (j=start; j<=end; j++)
                      ~^ ~~~
predict.c:2447:24: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        a = ((la == 0) || (la >= sizeof(sat.name)));
                           ~~ ^  ~~~~~~~~~~~~~~~~
predict.c:2448:24: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        b = ((lb == 0) || (lb >= sizeof(sat.line1)));
                           ~~ ^  ~~~~~~~~~~~~~~~~~
predict.c:2449:24: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        c = ((lc == 0) || (lc >= sizeof(sat.line2)));
                           ~~ ^  ~~~~~~~~~~~~~~~~~
predict.c:2620:6: warning: variable 'x' set but not used [-Wunused-but-set-variable]
        int x;
            ^
predict.c:2632:7: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
char *Daynum2String(daynum)
      ^
predict.c:2680:47: warning: variable 'e' set but not used [-Wunused-but-set-variable]
                b, w1, w2, bt, p, lm, h, ra, dec, z, ob, n, e, el,
                                                            ^
predict.c:3348:13: warning: incompatible pointer types passing 'char (*)[25]' to parameter of type 'char *' [-Wincompatible-pointer-types]
    strncpy(&(obs->name), &(sat.name), sizeof(obs->name));
            ^~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:128:28: note: expanded from macro 'strncpy'
                __builtin___strncpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                         ^~~~
predict.c:3348:27: warning: incompatible pointer types passing 'char (*)[25]' to parameter of type 'const char *' [-Wincompatible-pointer-types]
    strncpy(&(obs->name), &(sat.name), sizeof(obs->name));
                          ^~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:128:34: note: expanded from macro 'strncpy'
                __builtin___strncpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                               ^~~~~~~~~~~
predict.c:3360:13: warning: incompatible pointer types passing 'char (*)[5]' to parameter of type 'char *' [-Wincompatible-pointer-types]
    strncpy(&(obs->orbital_model), &(ephem), sizeof(obs->orbital_model));
            ^~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:128:28: note: expanded from macro 'strncpy'
                __builtin___strncpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                         ^~~~
predict.c:3360:36: warning: incompatible pointer types passing 'char (*)[5]' to parameter of type 'const char *' [-Wincompatible-pointer-types]
    strncpy(&(obs->orbital_model), &(ephem), sizeof(obs->orbital_model));
                                   ^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:128:34: note: expanded from macro 'strncpy'
                __builtin___strncpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                               ^~~~~~~~~~~
predict.c:3301:28: warning: variable 'delay' set but not used [-Wunused-but-set-variable]
    double doppler100=0.0, delay;
                           ^
predict.c:3385:36: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
    printf("NORAD_ID        %d\n", obs->norad_id);
                            ~~     ^~~~~~~~~~~~~
                            %ld
predict.c:3483:14: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        if (ReadTLE(tle0,tle1,tle2) != 0)
                    ^~~~
predict.c:2439:20: note: passing argument to parameter 'line0' here
char ReadTLE(char *line0, char *line1, char *line2)
                   ^
predict.c:3483:19: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        if (ReadTLE(tle0,tle1,tle2) != 0)
                         ^~~~
predict.c:2439:33: note: passing argument to parameter 'line1' here
char ReadTLE(char *line0, char *line1, char *line2)
                                ^
predict.c:3483:24: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        if (ReadTLE(tle0,tle1,tle2) != 0)
                              ^~~~
predict.c:2439:46: note: passing argument to parameter 'line2' here
char ReadTLE(char *line0, char *line1, char *line2)
                                             ^
predict.c:3545:9: warning: variable 'now' set but not used [-Wunused-but-set-variable]
        double now;
               ^
predict.c:3683:6: error: call to undeclared function 'Py_InitModule3'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        m = Py_InitModule3("cpredict", pypredict_funcs,
            ^
predict.c:3683:4: error: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
        m = Py_InitModule3("cpredict", pypredict_funcs,
          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 warnings and 2 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
@jerematt
Copy link
Collaborator

Looks like the compile of the C code is not setting the PY_MAJOR_VERSION correctly when called in this way on macOS, as it shouldnt be trying to use PyInitModule3 when compiling for python3. We should use pip install instead which does seem to set it up right. I'll update the README to reflect this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants