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 against Podofo 0.10.3 (on MinGW) #9976

Closed
MehdiChinoune opened this issue May 21, 2024 · 6 comments · Fixed by #9984
Closed

Fails to build against Podofo 0.10.3 (on MinGW) #9976

MehdiChinoune opened this issue May 21, 2024 · 6 comments · Fixed by #9984
Assignees

Comments

@MehdiChinoune
Copy link

What is the bug?

Fails to build against podofo 0.10.3
Most probably bacause of 7b526b1
In https://github.com/OSGeo/gdal/blob/master/frmts/pdf/pdfsdk_headers.h

#ifdef GetObject
#undef GetObject
#endif

Should be put right before #include "podofo.h"
No other header could be included between them.

with gcc 14.1.0

  [538/1307] Building CXX object frmts/pdf/CMakeFiles/gdal_PDF.dir/pdfdataset.cpp.obj
  FAILED: frmts/pdf/CMakeFiles/gdal_PDF.dir/pdfdataset.cpp.obj 
  C:\msys64\ucrt64\bin\g++.exe -DDONT_DEPRECATE_SPRINTF -DGDAL_COMPILATION -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_PODOFO -DHAVE_PODOFO_0_10_OR_LATER -DHAVE_SSE_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DUSE_IMPORT_EXPORT -IC:/_/B/src/gdal-3.9.0/apps -IC:/_/B/src/gdal-3.9.0/alg -IC:/_/B/src/gdal-3.9.0/gcore -IC:/_/B/src/build-UCRT64-static/gcore -IC:/_/B/src/gdal-3.9.0/port -IC:/_/B/src/build-UCRT64-static/port -IC:/_/B/src/gdal-3.9.0/ogr -IC:/_/B/src/gdal-3.9.0/ogr/ogrsf_frmts -IC:/_/B/src/gdal-3.9.0/frmts -IC:/_/B/src/gdal-3.9.0/frmts/vrt -IC:/_/B/src/gdal-3.9.0/frmts/mem -IC:/_/B/src/gdal-3.9.0/ogr/ogrsf_frmts/mem -IC:/msys64/ucrt64/include/podofo -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fvisibility=hidden -O3 -DNDEBUG -Wall -Wextra -Winit-self -Wunused-parameter -Wmissing-declarations -Wlogical-op -Wshadow -Wmissing-include-dirs -Wformat -Werror=format-security -Wno-format-nonliteral -Werror=vla -Wno-clobbered -Wdate-time -Wnull-dereference -Wextra-semi -
  In file included from C:/msys64/ucrt64/include/winnt.h:9,
                   from C:/msys64/ucrt64/include/minwindef.h:163,
                   from C:/msys64/ucrt64/include/windef.h:9,
                   from C:/msys64/ucrt64/include/windows.h:69,
                   from C:/_/B/src/gdal-3.9.0/port/cpl_spawn.h:45,
                   from C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp:39:
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp: In member function 'GDALPDFObject* PDFDataset::GetCatalog()':
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp:2511:41: error: 'class PoDoFo::PdfIndirectObjectList' has no member named 'GetObjectA'; did you mean 'GetObject'?
   2511 |             m_poDocPodofo->GetObjects().GetObject(
        |                                         ^~~~~~~~~
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp: In static member function 'static PDFDataset* PDFDataset::Open(GDALOpenInfo*)':
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp:4935:56: error: 'class PoDoFo::PdfPage' has no member named 'GetObjectA'; did you mean 'GetObject'?
   4935 |         const PoDoFo::PdfObject *pObj = &poPagePodofo->GetObject();
        |                                                        ^~~~~~~~~
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp:5523:27: error: 'const class PoDoFo::PdfInfo' has no member named 'GetObjectA'; did you mean 'GetObject'?
   5523 |                 &(poInfo->GetObject()),
        |                           ^~~~~~~~~

with clang 18.1.4

  [537/1307] Building CXX object frmts/pdf/CMakeFiles/gdal_PDF.dir/pdfdataset.cpp.obj
  FAILED: frmts/pdf/CMakeFiles/gdal_PDF.dir/pdfdataset.cpp.obj 
  C:\msys64\clang64\bin\clang++.exe -DDONT_DEPRECATE_SPRINTF -DGDAL_COMPILATION -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_PODOFO -DHAVE_PODOFO_0_10_OR_LATER -DHAVE_SSE_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DUSE_IMPORT_EXPORT -IC:/_/B/src/gdal-3.9.0/apps -IC:/_/B/src/gdal-3.9.0/alg -IC:/_/B/src/gdal-3.9.0/gcore -IC:/_/B/src/build-CLANG64-static/gcore -IC:/_/B/src/gdal-3.9.0/port -IC:/_/B/src/build-CLANG64-static/port -IC:/_/B/src/gdal-3.9.0/ogr -IC:/_/B/src/gdal-3.9.0/ogr/ogrsf_frmts -IC:/_/B/src/gdal-3.9.0/frmts -IC:/_/B/src/gdal-3.9.0/frmts/vrt -IC:/_/B/src/gdal-3.9.0/frmts/mem -IC:/_/B/src/gdal-3.9.0/ogr/ogrsf_frmts/mem -IC:/msys64/clang64/include/podofo -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-finite-math-only -fvisibility=hidden -O3 -DNDEBUG -Wall -Wextra -Winit-self -Wunused-parameter -Wmissing-declarations -Wshorten-64-to-32 -Wshadow -Wshadow-field -Wmissing-include-dirs -Wformat -Werror=format-security -Wno-format-nonliteral -Werror=vla -Wdate-time -Wnull-dereference -Wextra-semi -Wcomma -Wfloat-conversion -Wdocumentation -Wno-documentation-deprecated-sync -Wunused-private-field -Wnon-virtual-dtor -Woverloaded-virtual -Wsuggest-override -fno-operator-names -Wzero-as-null-pointer-constant -MD -MT frmts/pdf/CMakeFiles/gdal_PDF.dir/pdfdataset.cpp.obj -MF frmts\pdf\CMakeFiles\gdal_PDF.dir\pdfdataset.cpp.obj.d -o frmts/pdf/CMakeFiles/gdal_PDF.dir/pdfdataset.cpp.obj -c C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp:2511:41: error: no member named 'GetObjectA' in 'PoDoFo::PdfIndirectObjectList'; did you mean 'GetObject'?
   2511 |             m_poDocPodofo->GetObjects().GetObject(
        |                                         ^~~~~~~~~
        |                                         GetObject
  C:/msys64/clang64/include/wingdi.h:3423:19: note: expanded from macro 'GetObject'
   3423 | #define GetObject __MINGW_NAME_AW(GetObject)
        |                   ^
  C:/msys64/clang64/include/_mingw_unicode.h:20:32: note: expanded from macro '__MINGW_NAME_AW'
     20 | # define __MINGW_NAME_AW(func) func##A
        |                                ^
  <scratch space>:94:1: note: expanded from here
     94 | GetObjectA
        | ^
  C:/msys64/clang64/include/podofo/main/PdfIndirectObjectList.h:157:16: note: 'GetObject' declared here
    157 |     PdfObject* GetObject(const PdfReference& ref) const;
        |                ^
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp:4935:56: error: no member named 'GetObjectA' in 'PoDoFo::PdfPage'
   4935 |         const PoDoFo::PdfObject *pObj = &poPagePodofo->GetObject();
        |                                          ~~~~~~~~~~~~  ^
  C:/msys64/clang64/include/wingdi.h:3423:19: note: expanded from macro 'GetObject'
   3423 | #define GetObject __MINGW_NAME_AW(GetObject)
        |                   ^
  C:/msys64/clang64/include/_mingw_unicode.h:20:32: note: expanded from macro '__MINGW_NAME_AW'
     20 | # define __MINGW_NAME_AW(func) func##A
        |                                ^
  <scratch space>:95:1: note: expanded from here
     95 | GetObjectA
        | ^
  C:/_/B/src/gdal-3.9.0/frmts/pdf/pdfdataset.cpp:5523:27: error: no member named 'GetObjectA' in 'PoDoFo::PdfInfo'
   5523 |                 &(poInfo->GetObject()),
        |                   ~~~~~~  ^
  C:/msys64/clang64/include/wingdi.h:3423:19: note: expanded from macro 'GetObject'
   3423 | #define GetObject __MINGW_NAME_AW(GetObject)
        |                   ^
  C:/msys64/clang64/include/_mingw_unicode.h:20:32: note: expanded from macro '__MINGW_NAME_AW'
  
     20 | # define __MINGW_NAME_AW(func) func##A
  
        |                                ^
  
  <scratch space>:96:1: note: expanded from here
  
     96 | GetObjectA
  
        | ^
  
  3 errors generated.

Steps to reproduce the issue

Install Podofo 0.10.3 and build gdal against it

Versions and provenance

Windows 2022 Server (GitHub)
MSYS2 Platform in both UCRT64 and CLANG64 environments
3.9.0

Additional context

I am trying to build gdal against podofo instead of poppler, because It no longer builds with 24.05.0 (Even after backporting c++20 patches)

@MehdiChinoune
Copy link
Author

The issue seems to be from podofo

@MehdiChinoune MehdiChinoune closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
@MehdiChinoune MehdiChinoune reopened this May 21, 2024
@MehdiChinoune
Copy link
Author

It's a gdal issue. in frmts/pdf/pdfdataset.cpp file gdal_pdf.h was included first before other headers which redefine GetObject (Which is used in pdfdataset.cpp).

MehdiChinoune referenced this issue in msys2/MINGW-packages May 21, 2024
Building against poppler 24.05.0 fails with gcc because of c++20.
@ognevny
Copy link

ognevny commented May 21, 2024

related discussion in podofo repository: podofo/podofo#152. also see linked commits/PRs for more info

@rouault
Copy link
Member

rouault commented May 21, 2024

I am trying to build gdal against podofo instead of poppler, because It no longer builds with 24.05.0 (Even after backporting c++20 patches)

That's a bad idea. I would recommend against using PoDoFo backend which has no rendering capabilities and will result in a driver without raster capabilities. What is the issue exactly with Poppler?

@MehdiChinoune
Copy link
Author

That's a bad idea. I would recommend against using PoDoFo backend which has no rendering capabilities and will result in a driver without raster capabilities. What is the issue exactly with Poppler?

I got this type of error error: failed reading mapper, most probably a bug in gcc on mingw-w64 as It doesn't occur with gcc-14 on Arch and clang on mingw-w64.

@MehdiChinoune
Copy link
Author

I got this type of error error: failed reading mapper, most probably a bug in gcc on mingw-w64 as It doesn't occur with gcc-14 on Arch and clang on mingw-w64.

It's a CMake issue https://gitlab.kitware.com/cmake/cmake/-/issues/25974

The issue is about podofo.

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

Successfully merging a pull request may close this issue.

3 participants