Opened 5 years ago

Closed 5 months ago

#57621 closed defect (fixed)

py-gdal build failure on libstdc++ systems

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cooljeanius (Eric Gallager)
Port: py-gdal

Description

py-gdal fails to build on libstdc++ systems because it requires C++11.

Using the cxx11 1.1 portgroup is insufficient to fix the problem because this is a python port, and python's distutils does not support C++ software. It compiles C++ software using the C compiler, hence the lovely flags the cxx11 portgroup adds don't get used.

Change History (4)

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Now tracking the underlying issue as #59950.

comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Now that we are defaulting to libc++ on 10.6-10.8 py-gdal still can't build there for the same reason, since it's still compiling with clang (not clang++ like it should) and MacPorts CXXFLAGS (including -stdlib) aren't getting passed to the build. Here's a log of what that looks like:

In file included from extensions/gdal_array_wrap.cpp:3144:
In file included from /opt/local/include/gdal.h:49:
/opt/local/include/cpl_minixml.h:205:37: error: unknown template name 'unique_ptr'
class CPLXMLTreeCloser: public std::unique_ptr<CPLXMLNode, CPLXMLTreeCloserDeleter>
                                    ^
/opt/local/include/cpl_minixml.h:210:20: error: expected '(' or '{'
    std::unique_ptr<CPLXMLNode, CPLXMLTreeCloserDeleter>(data) {}
                   ^
/opt/local/include/cpl_minixml.h:210:20: error: expected '{' or ','
/usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch x86_64 -isysroot/ build/temp.macosx-10.8-x86_64-3.8/extensions/gdalconst_wrap.o -L../../.libs -L../../ -L/opt/local/lib -lgdal -o build/lib.macosx-10.8-x86_64-3.8/osgeo/_gdalconst.cpython-38-darwin.so
ld: warning: directory not found for option '-L../../.libs'
In file included from extensions/gdal_array_wrap.cpp:3519:
/opt/local/include/cpl_conv.h:366:10: fatal error: 'type_traits' file not found
#include <type_traits> // for std::is_base_of
         ^
extensions/ogr_wrap.cpp:4900:17: warning: will never be executed [-Wunreachable-code]
                CPLError(CE_Failure, CPLE_IllegalArg, "Illegal field subtype value");
                ^~~~~~~~
extensions/gdal_wrap.cpp:4658:14: warning: will never be executed [-Wunreachable-code]
  } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
             ^~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:5635:12: warning: will never be executed [-Wunreachable-code]
    return SWIG_From_unsigned_SS_long_SS_long  (static_cast< unsigned long long >(value));
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:7610:16: error: no member named 'emplace_back' in 'std::vector<ErrorStruct, std::allocator<ErrorStruct> >'
    paoErrors->emplace_back(eErr, no, msg);
    ~~~~~~~~~  ^
extensions/gdal_wrap.cpp:8997:17: warning: 'PyObject_AsReadBuffer' is deprecated [-Wdeprecated-declarations]
      int res = PyObject_AsReadBuffer(obj0, &safeBuf, &safeLen);
                ^
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/abstract.h:337:17: note: 'PyObject_AsReadBuffer' declared here
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
                ^
extensions/gdal_wrap.cpp:10317:17: warning: 'PyObject_AsReadBuffer' is deprecated [-Wdeprecated-declarations]
      int res = PyObject_AsReadBuffer(obj0, &safeBuf, &safeLen);
                ^
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/abstract.h:337:17: note: 'PyObject_AsReadBuffer' declared here
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
                ^
extensions/gdal_wrap.cpp:12761:17: warning: 'PyObject_AsReadBuffer' is deprecated [-Wdeprecated-declarations]
      int res = PyObject_AsReadBuffer(obj0, &safeBuf, &safeLen);
                ^
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/abstract.h:337:17: note: 'PyObject_AsReadBuffer' declared here
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
                ^
3 warnings and 4 errors generated.

comment:3 Changed 2 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:4 Changed 5 months ago by Schamschula (Marius Schamschula)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.