[PD-dev] fix for pd compilation on OpenSUSE (HZ and sysconf())

Claude Heiland-Allen claudiusmaximus at goto10.org
Sun Aug 26 13:58:51 CEST 2007


irc.freenode.net/#dataflow 2007-08-26
11:21 < AndyGraybeal> x_misc.c: In function 'cputime_bang2':
11:21 < AndyGraybeal> x_misc.c:233: error: 'HZ' undeclared (first use in 
this function)
11:21 < AndyGraybeal> x_misc.c:233: error: (Each undeclared identifier 
is reported only once
11:21 < AndyGraybeal> x_misc.c:233: error: for each function it appears in.)
11:21 < AndyGraybeal> make: *** [x_misc.o] Error 1
11:22 < AndyGraybeal> this is where i've been getting stuck every 
time.... no matter what version of pd
11:34 < ClaudiusMaximus> try adding this to x_misc.c below the #include 
lines:
11:34 < ClaudiusMaximus> #ifndef HZ
11:34 < ClaudiusMaximus> # define HZ sysconf(_SC_CLK_TCK)
11:34 < ClaudiusMaximus> #endif
11:38 < AndyGraybeal> holy pooop it works!


It seems OpenSUSE is following this document:

http://www.opengroup.org/onlinepubs/009695399/functions/sysconf.html

which makes some sense regarding portability of binaries to systems 
other than the one they were compiled on.


Since sysconf() is a function, it might be better to cache HZ in a 
variable together with the above "quick fix" #define, given that it is 
guaranteed to remain unchanged throughout the lifetime of the process.


Claude
-- 
http://claudiusmaximus.goto10.org




More information about the Pd-dev mailing list