Opened 6 years ago

Closed 6 years ago

#56260 closed defect (fixed)

gtkglext @1.2.0: error: redefinition of 'index' as different kind of symbol

Reported by: jbuencuerpo Owned by: jd@…
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: Cc: ShadSterling (Shad Sterling), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: gtkglext

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I have tried to build gtkglext +quartz without success. I attach the main.log file. I have encountered this when trying to build gwyddion in an isolated installation of macports. (/opt/gwyddion)

The error is in gdkglshapes I think. By accesing the work path of the build and running make I obtain:

gdkglshapes.c:552:12: error: redefinition of 'index' as different kind of symbol
static int index[20][3] =

My os and xcode version:
xcode version 9.2
macOS 10.12.6

Attachments (2)

main.log (190.3 KB) - added by jbuencuerpo 6 years ago.
main.log
patch-index-gdkglshapes-osx.diff (416 bytes) - added by jbuencuerpo 6 years ago.
patch to gdk/gdkglshapes.c

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by jbuencuerpo

Attachment: main.log added

main.log

comment:1 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jd@… removed
Description: modified (diff)
Owner: set to jd@…
Status: newassigned
Summary: gtkglext 1.2.0 build failuregtkglext @1.2.0: error: redefinition of 'index' as different kind of symbol

It seems that gtkglext's use of a variable named index is conflicting with a function named index that is provided by the operating system. I am surprised that the operating system would provide a function with such a generic name, and that this problem was not observed before, but I can confirm the problem on my Sierra system.

comment:2 Changed 6 years ago by jbuencuerpo

Hi, I have just rename index, and it compiles. Also gwyddion seems to work patched, The file patch gdk/gdkglshapes.c

--- gdk/gdkglshapes.c.orig      2018-04-11 15:15:50.000000000 -0600
+++ gdk/gdkglshapes.c   2018-04-11 15:16:13.000000000 -0600
@@ -549,7 +549,7 @@
   {-Z, -X, 0}
 };

-static int index[20][3] =
+static int bindex[20][3] =
 {
   {0, 4, 1},
   {0, 9, 4},
@@ -579,7 +579,7 @@
   int i;

   for (i = 19; i >= 0; i--) {
-    drawtriangle(i, idata, index, shadeType);
+    drawtriangle(i, idata, bindex, shadeType);
   }
 }

Avoiding using strings.h could be preferable/possible?

Changed 6 years ago by jbuencuerpo

patch to gdk/gdkglshapes.c

comment:3 Changed 6 years ago by ShadSterling (Shad Sterling)

Cc: ShadSterling added

comment:4 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: MarcusCalhoun-Lopez added

comment:5 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

In 154136086d14a0044a25aba90ea7826ca9b7f89a/macports-ports (master):

gtkglext: avoid name conflict with strings.h func

Fixes #56260

Note: See TracTickets for help on using tickets.