Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build of pygraphviz failed with SWIG 4.2.0 #2778

Closed
jplesnik opened this issue Jan 24, 2024 · 3 comments
Closed

Build of pygraphviz failed with SWIG 4.2.0 #2778

jplesnik opened this issue Jan 24, 2024 · 3 comments

Comments

@jplesnik
Copy link
Contributor

The build of python-pygraphviz-1.11 is failing against SWIG 4.2.0 in Fedora rawhide/40.

pygraphviz/graphviz_wrap.c: In function ‘SWIG_AsCharPtrAndSize’:
pygraphviz/graphviz_wrap.c:3255:17: error: implicit declaration of function ‘SWIG_Python_str_AsChar’; did you mean ‘SWIG_Python_str_FromChar’? [-Wimplicit-function-declaration]
 3255 |         *cptr = SWIG_Python_str_AsChar(obj);
      |                 ^~~~~~~~~~~~~~~~~~~~~~
      |                 SWIG_Python_str_FromChar
pygraphviz/graphviz_wrap.c:3255:15: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 3255 |         *cptr = SWIG_Python_str_AsChar(obj);
      |               ^
error: command '/usr/bin/gcc' failed with exit code 1

Complete build log is here. Other information about the build can be found here.

@ojwb
Copy link
Member

ojwb commented Jan 24, 2024

This looks like further fallout from @wsfulton's changes.

wsfulton added a commit to wsfulton/pygraphviz that referenced this issue Jan 24, 2024
Remove pystring.swg - a very ancient copy from SWIG which does not
compile when using swig-4.2.0. Instead SWIG's version of pystrings.swg
that is kept up to date in SWIG is used. SWIG_PYTHON_STRICT_BYTE_CHAR
needs to be defined in order to maintain the current behaviour of only
allowing Python 3 byte type instead of Python 3 string type as input.

As the output of swig is in graphviz_wrap.c and is committed to the
repo, the updates committed in this file (keeping the current swig-4.1.1
version). A later commit could update it to swig-4.2.0.

Fixes build problems on Fedora where SWIG_Python_str_AsChar no longer exists,
as reported at swig/swig#2778.
@wsfulton
Copy link
Member

pygraphviz has an ancient outdated copy of pystrings.swg as an override to SWIG's version. pygraphviz/pygraphviz#508 should fix this and restore it to use the SWIG maintained version which of course doesn't have the SWIG_Python_str_AsChar problem.

@jplesnik
Copy link
Contributor Author

@wsfulton The fix works for Fedora. Thank you

@ojwb ojwb closed this as completed Jan 25, 2024
jarrodmillman pushed a commit to pygraphviz/pygraphviz that referenced this issue Jan 26, 2024
Remove pystring.swg - a very ancient copy from SWIG which does not
compile when using swig-4.2.0. Instead SWIG's version of pystrings.swg
that is kept up to date in SWIG is used. SWIG_PYTHON_STRICT_BYTE_CHAR
needs to be defined in order to maintain the current behaviour of only
allowing Python 3 byte type instead of Python 3 string type as input.

As the output of swig is in graphviz_wrap.c and is committed to the
repo, the updates committed in this file (keeping the current swig-4.1.1
version). A later commit could update it to swig-4.2.0.

Fixes build problems on Fedora where SWIG_Python_str_AsChar no longer exists,
as reported at swig/swig#2778.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants