Bug 64926 - included plugin linefit does not compile
Summary: included plugin linefit does not compile
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-25 14:53 UTC by Matthew Truch
Modified: 2003-09-25 19:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Truch 2003-09-25 14:53:19 UTC
Version:           0.92 (using KDE KDE 3.1)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5) 
OS:          Linux

I was unable to compile the linefit plugin for kst included in the source tree.  

Below is output from gcc:

[matt@cherry linefit]$ make linefit
gcc -ansi -W -Wall -pedantic -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -O2   -Wformat-security -Wmissing-format-attribute -DQT_THREAD_SUPPORT  -D_REENTRANT   linefit.c
  -o linefit
linefit.c:19: warning: no previous prototype for `linefit'
linefit.c: In function `linefit':
linefit.c:51: warning: implicit declaration of function `lrint'
linefit.c:16: warning: unused parameter `is'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:77: undefined reference to `main'
/tmp/ccNkyzrF.o(.text+0x161): In function `linefit':
: undefined reference to `lrint'
/tmp/ccNkyzrF.o(.text+0x171): In function `linefit':
: undefined reference to `floor'
/tmp/ccNkyzrF.o(.text+0x1dd): In function `linefit':
: undefined reference to `lrint'
/tmp/ccNkyzrF.o(.text+0x1ed): In function `linefit':
: undefined reference to `floor'
collect2: ld returned 1 exit status
make: *** [linefit] Error 1
Comment 1 George Staikos 2003-09-25 19:04:26 UTC
Subject: Re: [Kst]   New: included plugin linefit does not compile

On Thursday 25 September 2003 08:53, Matthew Truch wrote:
> I was unable to compile the linefit plugin for kst included in the source
> tree.
>
> Below is output from gcc:
>
> [matt@cherry linefit]$ make linefit
> gcc -ansi -W -Wall -pedantic -Wchar-subscripts -Wshadow -Wpointer-arith
> -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -O2 
>  -Wformat-security -Wmissing-format-attribute -DQT_THREAD_SUPPORT 
> -D_REENTRANT   linefit.c -o linefit
> linefit.c:19: warning: no previous prototype for `linefit'
> linefit.c: In function `linefit':
> linefit.c:51: warning: implicit declaration of function `lrint'
> linefit.c:16: warning: unused parameter `is'
> /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In
> function `_start': ../sysdeps/i386/elf/start.S:77: undefined reference to
> `main'

  Funny, I just realised this would happen to someone last night.  lrint() is 
in C99 only.  I'll commit a fix shortly.

Comment 2 George Staikos 2003-09-25 19:26:37 UTC
Subject: kdeextragear-2/kst/plugins/linefit

CVS commit by staikos: 

lrint() not portable enough.  rint() should be sufficient here anyways.

CCMAIL: 64926-done@bugs.kde.org


  M +10 -2     linefit.c   1.9


--- kdeextragear-2/kst/plugins/linefit/linefit.c  #1.8:1.9
@@ -13,4 +13,10 @@
 #define Y 1
 
+
+int linefit(const double *const inArrays[], const int inArrayLens[],
+                const double is[],
+                double *outArrays[], int outArrayLens[],
+                double outScalars[]);
+
 int linefit(const double *const inArrays[], const int inArrayLens[],
                 const double is[],
@@ -22,4 +28,6 @@ int linefit(const double *const inArrays
         double xScale;
 
+        if (is) {} /* don't warn */
+
         if (inArrayLens[Y] < 1 || inArrayLens[X] < 1) {
                 return -1;
@@ -49,5 +57,5 @@ int linefit(const double *const inArrays
         for (i = 0; i < inArrayLens[Y]; i++) {
                 double z = xScale*i;
-                long int idx = lrint(z);
+                long int idx = rint(z);
                 double skew = z - floor(z); /* [0..1] */
                 long int idx2 = idx + 1;
@@ -79,5 +87,5 @@ int linefit(const double *const inArrays
         for (i = 0; i < inArrayLens[X]; i++) {
                 double z = xScale*i;
-                long int idx = lrint(z);
+                long int idx = rint(z);
                 double skew = z - floor(z); /* [0..1] */
                 long int idx2 = idx + 1;


Comment 3 George Staikos 2003-09-25 19:27:33 UTC
Subject: Re: [Kst]   New: included plugin linefit does not compile

On Thursday 25 September 2003 08:53, Matthew Truch wrote:
> I was unable to compile the linefit plugin for kst included in the source
> tree.
>
> Below is output from gcc:
>
> [matt@cherry linefit]$ make linefit
> gcc -ansi -W -Wall -pedantic -Wchar-subscripts -Wshadow -Wpointer-arith
> -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -O2 
>  -Wformat-security -Wmissing-format-attribute -DQT_THREAD_SUPPORT 
> -D_REENTRANT   linefit.c -o linefit

  One note, the makefile there will not build the plugin.  It probably 
shouldn't be there.  Please read the README for how to compile the plugin 
properly.