S4 icon indicating copy to clipboard operation
S4 copied to clipboard

Latest commit breaks Python extension

Open soamaven opened this issue 8 years ago • 2 comments

It seems that some of the new implementations of the C functions break the python extension in python 2.7. I am getting these errors, which seem critical, and will try to track them down:

S4/main_python.c: In function ‘S4Sim_new’:
    S4/main_python.c:620:3: error: too few arguments to function ‘Simulation_Init’
       Simulation_Init(&(self->S));
       ^
    In file included from S4/main_python.c:37:0:
    S4/S4.h:239:6: note: declared here
     void Simulation_Init(Simulation *S, const double *Lr, unsigned int nG, int *G);
          ^
    S4/main_python.c: In function ‘S4SpectrumSampler_GetFrequencies’:
    S4/main_python.c:1700:51: warning: passing argument 2 of ‘SpectrumSampler_GetFrequencies’ from incompatible pointer type [-Wincompatible-pointer-types]
      nf = SpectrumSampler_GetFrequencies(self->SpecS, &freqs);
                                                       ^
    In file included from S4/main_python.c:39:0:
    S4/SpectrumSampler.h:41:5: note: expected ‘const double **’ but argument is of type ‘double **’
     int SpectrumSampler_GetFrequencies(const SpectrumSampler sampler, const double **freqs);
         ^
    S4/main_python.c: In function ‘S4_SolveInParallel’:
    S4/main_python.c:1993:14: warning: unused variable ‘layerName’ [-Wunused-variable]
      const char *layerName;
                  ^
    S4/main_python.c:1992:15: warning: unused variable ‘kwlist’ [-Wunused-variable]
      static char *kwlist[] = {"Layer", "Simulations", NULL};
                   ^
    S4/main_python.c: At top level:
    S4/main_python.c:659:18: warning: ‘S4Sim_ConvertUnits’ defined but not used [-Wunused-function]
     static PyObject *S4Sim_ConvertUnits(S4Sim *self, PyObject *args)
                      ^
    error: command 'gcc' failed with exit status 1

    ----------------------------------------

soamaven avatar Sep 23 '16 17:09 soamaven

Yes, the latest commits break the Python extension due to a change in the public API. The Simulation_Init function takes additional arguments now. I will add a change now to make it so you can pass in zeros or NULL for the additional arguments and obtain the same behavior. The goal is to move towards setting the lattice and NumG when the Simulation object is created, and then deprecate the SetNumG and SetLattice methods.

victorliu avatar Sep 23 '16 17:09 victorliu

I cannot to compile python extension - gcc -pthread -shared -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld build/temp.linux-x86_64-2.7/S4/main_python.o -Lbuild -L/usr/lib64 -lS4 -lstdc++ -lpython2.7 -o build/lib.linux-x86_64-2.7/S4.so gcc: error: : No such file or directory error: command 'gcc' failed with exit status 1 Makefile.common:138: recipe for target 'S4_pyext' failed make: *** [S4_pyext] Error 1 May be my problem relates with latest commits.

avegrv avatar Sep 23 '16 19:09 avegrv