Skip to content

Fails to Compile Against Graphviz 13.x #2375

@bassmadrigal

Description

@bassmadrigal

Graphviz 13.0, released in June, had the following listed in its changelog:

  • Breaking: gvRenderData takes its length parameter as a size_t *. The GVJ_t fields output_data_allocated and output_data_position have type size_t.

When graphviz was updated to 13.x in my distro's repo, it broke libmediainfo when compiled with graphviz support, which is a package I maintain for that repo. When trying to compile against the newer graphviz, the error is:

../../../Source/MediaInfo/Export/Export_Graph.cpp:160:60: error: cannot convert ‘unsigned int*’ to ‘size_t*’ {aka ‘long unsigned int*’}
  160 |         gvRenderData(Context, Graph, "svg:cairo", &Buffer, &Size);
      |                                                            ^~~~~
      |                                                            |
      |                                                            unsigned int*
In file included from ../../../Source/MediaInfo/Export/Export_Graph.cpp:35:
/usr/include/graphviz/gvc.h:99:49: note:   initializing argument 5 of ‘int gvRenderData(GVC_t*, graph_t*, const char*, char**, size_t*)’
   99 |                          char **result, size_t *length);
      |                                         ~~~~~~~~^~~~~~
../../../Source/MediaInfo/Export/Export_Graph.cpp:162:54: error: cannot convert ‘unsigned int*’ to ‘size_t*’ {aka ‘long unsigned int*’}
  162 |         gvRenderData(Context, Graph, "svg", &Buffer, &Size);
      |                                                      ^~~~~
      |                                                      |
      |                                                      unsigned int*
In file included from ../../../Source/MediaInfo/Export/Export_Graph.cpp:35:
/usr/include/graphviz/gvc.h:99:49: note:   initializing argument 5 of ‘int gvRenderData(GVC_t*, graph_t*, const char*, char**, size_t*)’
   99 |                          char **result, size_t *length);
      |                                         ~~~~~~~~^~~~~~

We are able to fix this locally with the following sed command:

sed -i 's|unsigned int|size_t|' Source/MediaInfo/Export/Export_Graph*

However, this is not backwards compatible with graphviz 12.x and earlier, so it would seem the code would need some sort of if/then statement to determine the graphviz version and use the correct parameters, but that is beyond my programming expertise.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions