[Bug]: Couldn't build matplotlib 3.6.0 with both Clang-15 and GCC-12 · Issue #23943 · matplotlib/matplotlib · GitHub
Skip to content

[Bug]: Couldn't build matplotlib 3.6.0 with both Clang-15 and GCC-12 #23943

Description

@MehdiChinoune

Bug summary

It fails to build with Clang-15 and GCC-12
Clang:

  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__tkagg_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -Isrc -ID:/M/msys64/clang64/lib/python3.10/site-packages/numpy/core/include -ID:/M/msys64/clang64/include/python3.10 -c src/_tkagg.cpp -o build/temp.mingw_x86_64_clang-3.10/matplotlib.backends._tkagg/src/_tkagg.o
  src/_tkagg.cpp:234:15: error: cannot initialize a variable of type 'void *' with an rvalue of type 'FARPROC' (aka 'long long (*)()')
      if (void* ptr = dlsym(lib, "Tcl_SetVar")) {
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~
  src/_tkagg.cpp:273:13: note: in instantiation of function template specialization 'load_tcl_tk<HINSTANCE__ *>' requested here
          if (load_tcl_tk(modules[i])) {
              ^
  src/_tkagg.cpp:237:15: error: cannot initialize a variable of type 'void *' with an rvalue of type 'FARPROC' (aka 'long long (*)()')
      if (void* ptr = dlsym(lib, "Tk_FindPhoto")) {
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/_tkagg.cpp:240:15: error: cannot initialize a variable of type 'void *' with an rvalue of type 'FARPROC' (aka 'long long (*)()')
      if (void* ptr = dlsym(lib, "Tk_PhotoPutBlock")) {
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3 errors generated.

GCC:

  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__tkagg_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -Isrc -ID:/M/msys64/ucrt64/lib/python3.10/site-packages/numpy/core/include -ID:/M/msys64/ucrt64/include/python3.10 -c src/_tkagg.cpp -o build/temp.mingw_x86_64_ucrt-3.10/matplotlib.backends._tkagg/src/_tkagg.o
  src/_tkagg.cpp: In instantiation of 'bool load_tcl_tk(T) [with T = HINSTANCE__*]':
  src/_tkagg.cpp:273:24:   required from here
  src/_tkagg.cpp:234:26: error: invalid conversion from 'FARPROC' {aka 'long long int (*)()'} to 'void*' [-fpermissive]
    234 |     if (void* ptr = dlsym(lib, "Tcl_SetVar")) {
        |                          ^
        |                          |
        |                          FARPROC {aka long long int (*)()}
  src/_tkagg.cpp:237:26: error: invalid conversion from 'FARPROC' {aka 'long long int (*)()'} to 'void*' [-fpermissive]
    237 |     if (void* ptr = dlsym(lib, "Tk_FindPhoto")) {
        |                          ^
        |                          |
        |                          FARPROC {aka long long int (*)()}
  src/_tkagg.cpp:240:26: error: invalid conversion from 'FARPROC' {aka 'long long int (*)()'} to 'void*' [-fpermissive]
    240 |     if (void* ptr = dlsym(lib, "Tk_PhotoPutBlock")) {
        |                          ^
        |                          |
        |                          FARPROC {aka long long int (*)()}

Code for reproduction

No code required

Actual outcome

Building succeeds

Expected outcome

Building fails

Additional information

No response

Operating system

No response

Matplotlib Version

3.6.0

Matplotlib Backend

No response

Python version

3.10.7

Jupyter version

No response

Installation

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions