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

Fails to build with with GCC-14 (error: invalid conversion from ‘unsigned char*’ to ‘char*’ [-fpermissive]) #101

Closed
sebastic opened this issue Sep 10, 2024 · 4 comments

Comments

@sebastic
Copy link
Contributor

As reported in Debian Bug #1081301:

x86_64-linux-gnu-g++ -g -O2 -ffile-prefix-map=/build/aggdraw-1.3.18=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION=1.3.18 -DHAVE_FREETYPE2 -Iagg2/include -Iagg2/font_freetype -I/usr/include -I/usr/include/freetype -I/usr/include/freetype2 -I/usr/include/python3.12 -c agg2/font_freetype/agg_font_freetype.cpp -o build/temp.linux-x86_64-cpython-312/agg2/font_freetype/agg_font_freetype.o
agg2/font_freetype/agg_font_freetype.cpp: In member function 'void agg::font_engine_freetype_base::update_signature()':
agg2/font_freetype/agg_font_freetype.cpp:766:44: warning: format '%d' expects argument of type 'int', but argument 10 has type 'FT_Fixed' {aka 'long int'} [-Wformat=]
  766 |                     "%s,%u,%d,%d,%d:%dx%d,%d,%d,%d,%d,%d,%d,%08X",
      |                                           ~^
      |                                            |
      |                                            int
      |                                           %ld
......
  774 |                     m_matrix.xx,
      |                     ~~~~~~~~~~~             
      |                              |
      |                              FT_Fixed {aka long int}
agg2/font_freetype/agg_font_freetype.cpp:766:47: warning: format '%d' expects argument of type 'int', but argument 11 has type 'FT_Fixed' {aka 'long int'} [-Wformat=]
  766 |                     "%s,%u,%d,%d,%d:%dx%d,%d,%d,%d,%d,%d,%d,%08X",
      |                                              ~^
      |                                               |
      |                                               int
      |                                              %ld
......
  775 |                     m_matrix.xy,
      |                     ~~~~~~~~~~~                
      |                              |
      |                              FT_Fixed {aka long int}
agg2/font_freetype/agg_font_freetype.cpp:766:50: warning: format '%d' expects argument of type 'int', but argument 12 has type 'FT_Fixed' {aka 'long int'} [-Wformat=]
  766 |                     "%s,%u,%d,%d,%d:%dx%d,%d,%d,%d,%d,%d,%d,%08X",
      |                                                 ~^
      |                                                  |
      |                                                  int
      |                                                 %ld
......
  776 |                     m_matrix.yx,
      |                     ~~~~~~~~~~~                   
      |                              |
      |                              FT_Fixed {aka long int}
agg2/font_freetype/agg_font_freetype.cpp:766:53: warning: format '%d' expects argument of type 'int', but argument 13 has type 'FT_Fixed' {aka 'long int'} [-Wformat=]
  766 |                     "%s,%u,%d,%d,%d:%dx%d,%d,%d,%d,%d,%d,%d,%08X",
      |                                                    ~^
      |                                                     |
      |                                                     int
      |                                                    %ld
......
  777 |                     m_matrix.yy,
      |                     ~~~~~~~~~~~                      
      |                              |
      |                              FT_Fixed {aka long int}
agg2/font_freetype/agg_font_freetype.cpp: In instantiation of 'bool agg::decompose_ft_outline(const FT_Outline&, bool, PathStorage&, ConvCoord) [with PathStorage = path_storage_integer<int, 6>; ConvCoord = int (*)(int); FT_Outline = FT_Outline_]':
agg2/font_freetype/agg_font_freetype.cpp:883:48:   required from here
  883 |                         if(decompose_ft_outline(m_cur_face->glyph->outline,
      |                            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  884 |                                                 flip,
      |                                                 ~~~~~
  885 |                                                 m_path32,
      |                                                 ~~~~~~~~~
  886 |                                                 conv_coord_none))
      |                                                 ~~~~~~~~~~~~~~~~
agg2/font_freetype/agg_font_freetype.cpp:174:35: error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]
  174 |             tags  = outline.tags  + first;
      |                     ~~~~~~~~~~~~~~^~~~~~~
      |                                   |
      |                                   unsigned char*
agg2/font_freetype/agg_font_freetype.cpp: In instantiation of 'bool agg::decompose_ft_outline(const FT_Outline&, bool, PathStorage&, ConvCoord) [with PathStorage = path_storage_integer<short int, 6>; ConvCoord = int (*)(int); FT_Outline = FT_Outline_]':
agg2/font_freetype/agg_font_freetype.cpp:903:48:   required from here
  903 |                         if(decompose_ft_outline(m_cur_face->glyph->outline,
      |                            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  904 |                                                 flip,
      |                                                 ~~~~~
  905 |                                                 m_path16,
      |                                                 ~~~~~~~~~
  906 |                                                 conv_coord_none))
      |                                                 ~~~~~~~~~~~~~~~~
agg2/font_freetype/agg_font_freetype.cpp:174:35: error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]
  174 |             tags  = outline.tags  + first;
      |                     ~~~~~~~~~~~~~~^~~~~~~
      |                                   |
      |                                   unsigned char*
error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1

ERROR Backend subprocess exited when trying to invoke build_wheel
@djhoese
Copy link
Member

djhoese commented Sep 10, 2024

Yep, working on it in #100

@djhoese
Copy link
Member

djhoese commented Sep 10, 2024

I've tried adding -fpermissive to the macos wheel builds as those are the only ones failing at the moment, but it doesn't seem to be allowing the build to continue. Any ideas what I'm missing to at least have a short term workaround for this incompatible vendored code?

@sebastic
Copy link
Contributor Author

sebastic commented Sep 11, 2024

Appending -fpermissive to CXXFLAGS works for the Debian package build.

Others vendoring agg_font_freetype.cpp have encountered the same issue, see: r-lib/ragg#170 (comment) for their fix.

--- a/agg2/font_freetype/agg_font_freetype.cpp
+++ b/agg2/font_freetype/agg_font_freetype.cpp
@@ -171,7 +171,7 @@ namespace agg
             v_control = v_start;
 
             point = outline.points + first;
-            tags  = outline.tags  + first;
+            tags  = (char*)outline.tags  + first;
             tag   = FT_CURVE_TAG(tags[0]);
 
             // A contour cannot start with a cubic control point!

That change is also confirmed with the Debian package.

@djhoese
Copy link
Member

djhoese commented Sep 11, 2024

Fixed in #100. Released as 1.3.19. Thanks for the bug report!

@djhoese djhoese closed this as completed Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants