Opened 6 years ago

Closed 4 years ago

Last modified 2 years ago

#2265 closed defect (fixed)

lib/rst/qtree.c compilation error

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Compiling Version: svn-trunk
Keywords: rst Cc:
CPU: x86-64 Platform: Linux

Description

This error occurs when compiling current GRASS 7 trunk:

make[4]: Leaving directory `/home/neteler/software/grass71/lib/rst/data'
qtree.c:20:63: warning: ‘struct quaddata’ declared inside parameter list [enabled by default]
     *MT_functions_new(int (*compare) (struct triple *, struct quaddata *),
                                                               ^
qtree.c:20:63: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
qtree.c:20:63: warning: ‘struct triple’ declared inside parameter list [enabled by default]
qtree.c:24:12: warning: ‘struct triple’ declared inside parameter list [enabled by default]
            double),
            ^
qtree.c:28:7: warning: ‘struct quaddata’ declared inside parameter list [enabled by default]
       int))
       ^
qtree.c: In function ‘MT_functions_new’:
qtree.c:32:56: error: invalid application of ‘sizeof’ to incomplete type ‘struct multfunc’
     if (!(functions = (struct multfunc *)malloc(sizeof(struct multfunc)))) {
                                                        ^
qtree.c:35:14: error: dereferencing pointer to incomplete type
     functions->compare = compare;
              ^
qtree.c:36:14: error: dereferencing pointer to incomplete type
     functions->divide_data = divide_data;
              ^
qtree.c:37:14: error: dereferencing pointer to incomplete type
     functions->add_data = add_data;
              ^
qtree.c:38:14: error: dereferencing pointer to incomplete type
     functions->intersect = intersect;
              ^
qtree.c:39:14: error: dereferencing pointer to incomplete type
     functions->division_check = division_check;
              ^
qtree.c:40:14: error: dereferencing pointer to incomplete type
     functions->get_points = get_points;
              ^
qtree.c: At top level:
qtree.c:46:8: warning: ‘struct multtree’ declared inside parameter list [enabled by default]
        int kmax)
        ^
qtree.c: In function ‘MT_tree_info_new’:
qtree.c:50:52: error: invalid application of ‘sizeof’ to incomplete type ‘struct tree_info’
     if (!(info = (struct tree_info *)malloc(sizeof(struct tree_info)))) {
                                                    ^
qtree.c:53:9: error: dereferencing pointer to incomplete type
     info->root = root;
         ^
qtree.c:54:9: error: dereferencing pointer to incomplete type
     info->functions = functions;
         ^
qtree.c:55:9: error: dereferencing pointer to incomplete type
     info->dmin = dmin;
         ^
qtree.c:56:9: error: dereferencing pointer to incomplete type
     info->kmax = kmax;
         ^
qtree.c: At top level:
qtree.c:62:9: warning: ‘struct quaddata’ declared inside parameter list [enabled by default]
         int multant)
         ^
qtree.c: In function ‘MT_tree_new’:
qtree.c:66:51: error: invalid application of ‘sizeof’ to incomplete type ‘struct multtree’
     if (!(tree = (struct multtree *)malloc(sizeof(struct multtree)))) {
                                                   ^
qtree.c:69:9: error: dereferencing pointer to incomplete type
     tree->data = data;
         ^
qtree.c:70:9: error: dereferencing pointer to incomplete type
     tree->leafs = leafs;
         ^
qtree.c:71:9: error: dereferencing pointer to incomplete type
     tree->parent = parent;
         ^
qtree.c:72:9: error: dereferencing pointer to incomplete type
     tree->multant = multant;
         ^
qtree.c: At top level:
qtree.c:79:39: warning: ‘struct triple’ declared inside parameter list [enabled by default]
        struct tree_info *info, struct multtree *tree, int n_leafs)
                                       ^
qtree.c: In function ‘MT_insert’:
qtree.c:99:13: error: dereferencing pointer to incomplete type
     if (tree->data == NULL) {
             ^
qtree.c:103:13: error: dereferencing pointer to incomplete type
     i = info->functions->division_check(tree->data, info->kmax);
             ^
qtree.c:103:45: error: dereferencing pointer to incomplete type
     i = info->functions->division_check(tree->data, info->kmax);
                                             ^
qtree.c:103:57: error: dereferencing pointer to incomplete type
     i = info->functions->division_check(tree->data, info->kmax);
                                                         ^
qtree.c:106:17: error: dereferencing pointer to incomplete type
      comp = info->functions->compare(point, tree->data);
                 ^
qtree.c:106:49: error: dereferencing pointer to incomplete type
      comp = info->functions->compare(point, tree->data);
                                                 ^
qtree.c:109:37: error: dereferencing pointer to incomplete type
      j = MT_insert(point, info, tree->leafs[comp - 1], n_leafs);
                                     ^
qtree.c:113:11: error: dereferencing pointer to incomplete type
   j = info->functions->add_data(point, tree->data, info->dmin);
           ^
qtree.c:113:44: error: dereferencing pointer to incomplete type
   j = info->functions->add_data(point, tree->data, info->dmin);
                                            ^
qtree.c:113:56: error: dereferencing pointer to incomplete type
   j = info->functions->add_data(point, tree->data, info->dmin);
                                                        ^
qtree.c:118:2: error: implicit declaration of function ‘MT_divide’ [-Werror=implicit-function-declaration]
  k = MT_divide(info, tree, n_leafs);
  ^
qtree.c: In function ‘MT_divide’:
qtree.c:146:17: error: dereferencing pointer to incomplete type
     datas = info->functions->divide_data(tree->data, info->kmax, info->dmin);
                 ^
qtree.c:146:46: error: dereferencing pointer to incomplete type
     datas = info->functions->divide_data(tree->data, info->kmax, info->dmin);
                                              ^
qtree.c:146:58: error: dereferencing pointer to incomplete type
     datas = info->functions->divide_data(tree->data, info->kmax, info->dmin);
                                                          ^
qtree.c:146:70: error: dereferencing pointer to incomplete type
     datas = info->functions->divide_data(tree->data, info->kmax, info->dmin);
                                                                      ^
qtree.c:154:2: warning: passing argument 1 of ‘MT_tree_new’ from incompatible pointer type [enabled by default]
  leafs[i - 1] = MT_tree_new(datas[i], NULL, par, i);
  ^
qtree.c:60:18: note: expected ‘struct quaddata *’ but argument is of type ‘struct quaddata *’
 struct multtree *MT_tree_new(struct quaddata *data,
                  ^
qtree.c:156:9: error: dereferencing pointer to incomplete type
     tree->leafs = leafs;
         ^
qtree.c: At top level:
qtree.c:166:6: warning: ‘struct quaddata’ declared inside parameter list [enabled by default]
      int n_leafs)
      ^
qtree.c: In function ‘MT_region_data’:
qtree.c:180:13: error: dereferencing pointer to incomplete type
     if (tree->data == NULL) {
             ^
qtree.c:184:13: error: dereferencing pointer to incomplete type
     if (info->functions->intersect(data, tree->data)) {
             ^
qtree.c:184:46: error: dereferencing pointer to incomplete type
     if (info->functions->intersect(data, tree->data)) {
                                              ^
qtree.c:185:10: error: dereferencing pointer to incomplete type
  if (tree->leafs != NULL) {
          ^
qtree.c:188:37: error: dereferencing pointer to incomplete type
        n + MT_region_data(info, tree->leafs[j], data, MAX - n,
                                     ^
qtree.c:194:14: error: dereferencing pointer to incomplete type
      n = info->functions->get_points(data, tree->data, MAX);
              ^
qtree.c:194:48: error: dereferencing pointer to incomplete type
      n = info->functions->get_points(data, tree->data, MAX);
                                                ^
cc1: some warnings being treated as errors
make[4]: *** [OBJ.x86_64-unknown-linux-gnu/qtree.o] Error 1

Interestingly it disappears at the second compilation attempt:

# Note: linebreaks inserted for legibility:
[neteler@pgis_north qtree]$ make
gcc  -g -O1 -Wall -Werror-implicit-function-declaration 
-fno-common -fexceptions -Wreturn-type -std=gnu99 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
-m64 -mtune=generic  -fPIC  
-I/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/include 
-I/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/include    -DPACKAGE=\""grasslibs"\"   
-I/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/include 
-I/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/include 
-o OBJ.x86_64-unknown-linux-gnu/qtree.o -c qtree.c
gcc -shared 
-o /home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/lib/libgrass_qtree.7.1.svn.so 
-L/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/lib 
-L/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/lib -Wl,--no-undefined -Wl,-z,relro 
-Wl,--export-dynamic  -L/usr/lib64 
-Wl,-rpath-link,/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/lib  OBJ.x86_64-unknown-linux-gnu/qtree.o   -lm 
(cd /home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/lib; ln -f 
-s libgrass_qtree.7.1.svn.so /home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/lib/libgrass_qtree.so)
if [ "" != "" -a -f "".html ] ; then make html ; fi

Change History (4)

comment:1 Changed 5 years ago by neteler

Apparently lib/rst/qtree does not compile in parallel make mode (make -j4) - see error above. How can this be serialized in the Makefile?

comment:2 Changed 4 years ago by neteler

Resolution: fixed
Status: newclosed

Problem is gone, closing.

comment:3 Changed 2 years ago by neteler

In 71343:

librst: to prevent parallel (really rare) compilation failures, data dir must be processed before qtree (trunk, r71236). Probably fixes #2265

comment:4 in reply to:  2 Changed 2 years ago by neteler

Replying to neteler:

Problem is gone, closing.

Likely fixed in r71236. Backported to 7.2 in r71343.

Note: See TracTickets for help on using tickets.