[CM] Trouble buillding cm on Arch Linux

Phil Thomson phil at philthomson.ca
Tue Aug 21 12:00:46 PDT 2012


Hello,

Thanks for the reply!

I am not very knowledgeable about C, so I am probably doing this wrong, 
but I edited s7.c and replaced this bit of code:

s7_Double s7_number_to_real(s7_scheme *sc, s7_pointer x)
{
   if (type(x) == T_REAL)
     return(real(x));
   /* this is nearly always the case in current usage, so by avoiding 
the "switch" we can go twice as fast */

   switch (type(x))
     {
     case T_INTEGER:
       return((s7_Double)integer(x));

     case T_RATIO:
       return((s7_Double)numerator(x) / (s7_Double)denominator(x));

     case T_REAL:
       return(real(x));

     case T_COMPLEX:
       return(real_part(x));

#if WITH_GMP
     case T_BIG_INTEGER:
       return((s7_Double)big_integer_to_s7_Int(big_integer(x)));

     case T_BIG_RATIO:
       return((s7_Double)((long 
double)big_integer_to_s7_Int(mpq_numref(big_ratio(x))) / (long 
double)big_integer_to_s7_Int(mpq_denref(big_ratio(x)))));

     case T_BIG_REAL:
       return((s7_Double)mpfr_get_d(big_real(x), GMP_RNDN));

     case T_BIG_COMPLEX:
       return((s7_Double)mpfr_get_d(mpc_realref(big_complex(x)), GMP_RNDN));
#endif
     }

   s7_wrong_type_arg_error(sc, "s7_number_to_real", 0, x, "a real number");
   return(0.0);
}




with the bit in your email, but I get this error when running make:




gcc -c -DHAVE_CONFIG_H -I. -g -O2 -fPIC   -I/usr/include  s7.c
s7.c:6859:11: error: conflicting types for ‘s7_number_to_real’
In file included from s7.c:331:0:
s7.h:324:11: note: previous declaration of ‘s7_number_to_real’ was here
s7.c: In function ‘g_rationalize’:
s7.c:9132:7: warning: passing argument 1 of ‘s7_number_to_real’ from 
incompatible pointer type [enabled by default]
s7.c:6859:11: note: expected ‘s7_pointer’ but argument is of type 
‘struct s7_scheme *’
s7.c:9132:7: error: too many arguments to function ‘s7_number_to_real’
s7.c:6859:11: note: declared here
s7.c:9165:2: warning: passing argument 1 of ‘s7_number_to_real’ from 
incompatible pointer type [enabled by default]
s7.c:6859:11: note: expected ‘s7_pointer’ but argument is of type 
‘struct s7_scheme *’
s7.c:9165:2: error: too many arguments to function ‘s7_number_to_real’
s7.c:6859:11: note: declared here
make: *** [s7.o] Error 1




I should probably also ask whether there is an easier way to get a 
version of Common Music 3.8.0 (including both cm and Grace) on Linux. I 
see that there is a package of Grace for Ubuntu (which seems to run fine 
on Arch), but I would also like cm; I tend to prefer text interfaces to 
GUIs.

Thanks in advance for all assistance!

Phil Thomson
http://philthomson.ca/

On 12-08-21 4:57 AM, Bill Schottstaedt wrote:
> It looks like a version mismatch -- I added the s7_scheme* pointer
> to s7_number_to_real about a month ago, but I think cm is older
> than that.  The previous version was:
>
> s7_Double s7_number_to_real(s7_pointer x)
> {
>    switch (type(x))
>      {
>      case T_INTEGER: return((s7_Double)integer(x));
>      case T_RATIO:   return((s7_Double)numerator(x) / (s7_Double)denominator(x));
>      case T_REAL:    return(real(x));
>      case T_COMPLEX: return(real_part(x));
>      }
>    return(0.0);
> }
>
> but I needed the s7_scheme* pointer for error handling and so on.
> I thought I looked for s7_number_to_real in the cm sources before
> changing it!  Perhaps you can get cm to compile if you use the
> version above.
>
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
>



More information about the Cmdist mailing list