use Python/C API on msys2-mingw - python

I try to use Python/C API on msys2-mingw, so I install
this package mingw-w64-x86_64-python2, and I write main.cpp:
#include <python2.7\Python.h>
int main(){
return 0;
}
And when I enter this $ g++ main.cpp -o main,
It gives me these msg:
In file included from \msys64\mingw64\include/python2.7\Python.h:58:0,
from main.cpp:1:
\msys64\mingw64\include/python2.7\pyport.h:907:2: 錯誤:#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
^
In file included from \msys64\mingw64\include/python2.7\Python.h:8:0,
from main.cpp:1:
/usr/include/cygwin/types.h:78:20: 錯誤:一個宣告指定了多個類型
typedef __uint32_t uid_t;
^
/usr/include/cygwin/types.h:78:20: 錯誤:沒有宣告任何東西 [-fpermissive]
/usr/include/cygwin/types.h:84:20: 錯誤:一個宣告指定了多個類型
typedef __uint32_t gid_t;
^
/usr/include/cygwin/types.h:84:20: 錯誤:沒有宣告任何東西 [-fpermissive]
makefile:2: recipe for target 'main' failed
make: *** [main] Error 1
I have no idea why these happen. It's not a error about linking file(since I hadn't link any file.). Is my method wrong, or I include the wrong file ?

You mix GCC's: mingw-w64 GCC and msys GCC. For mingw-w64 GCC under MSYS2 you must not have includes from /usr. See your error message /usr/include/cygwin/types.h

Related

Embedding python in Visual C++

I am trying to embed python in a Visual C++ application using visual studio 2017.
I correctly included the header files path and the lib path from my Python 3.7.0 installation.
I can include the Python.h and pylifecycle.h files but get an error when I try to run the program. My code and error is below.
// TestPythonEmbedding.cpp : Defines the entry point for the console application.
//
#include "Python.h"
#include "pylifecycle.h"
#include "stdafx.h"
int main()
{
PyObject* myPointer;
Py_Initialize();
return 0;
}
Here are the errors I get when I try to build the solution.
testpythonembedding.cpp(11): error C2065: 'PyObject': undeclared
identifier
testpythonembedding.cpp(11): error C2065: 'myPointer': undeclared
identifier
testpythonembedding.cpp(13): error C3861: 'Py_Initialize': identifier
not found
1>Done building project "TestPythonEmbedding.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Strangely enough Visual studio gives information about Pyobject* and highlights it as if it is identified. I included an image of that.
image

Boost.Python fails with static libraries

I cannot seem to get the simple hello.cpp example in Boost.Python to work.
hello.cpp:
char const* greet()
{
return "hello, world";
}
BOOST_PYTHON_MODULE(hello_ext)
{
using namespace boost::python;
def("greet", greet);
}
I am using cmake with mingw-w64 and am not entirely sure of the difference between using the static and shared boost libraries. If the extension is linked with the shared library will the extension library have to be distributed with the boost library as well? I would like to only have to distribute a single dll. What is the difference between Boost_USE_STATIC_LIBS and Boost_USE_STATIC_RUNTIME? If either of these flags are set to ON the subsequent compilation will fail with undefined symbols. If they are both set to OFF a file called libhello_ext.dll is created. However, I cannot get python to use it with either import hello_ext or import libhello_ext.
This is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.12)
project(hello VERSION 1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -pedantic -g")
set(BOOST_LIBRARYDIR C:/boost_1_67_0/stage/x64/lib)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
find_package(Boost 1.67.0 REQUIRED python37)
if (Boost_FOUND)
message(" Boost include directory found at ${Boost_INCLUDE_DIRS}")
message(" Boost libraries found at ${Boost_LIBRARIES}")
else()
message(" Boost not found")
return()
endif()
find_package(PythonLibs 3.7 REQUIRED)
if (PYTHONLIBS_FOUND)
message(" Python include directory found at ${PYTHON_INCLUDE_DIRS}")
message(" Python libraries found at ${PYTHON_LIBRARIES}")
else()
message(" Python not found")
endif()
set(SOURCE_FILES hello.cpp)
add_library(hello_ext SHARED ${SOURCE_FILES})
target_include_directories(hello_ext SYSTEM PRIVATE ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
target_link_libraries(hello_ext ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
This is the output for mingw32-make:
[ 50%] Linking CXX shared library libhello_ext.dll
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `PyInit_hello_ext':
C:/boost_1_67_0/libs/python/example/tutorial/hello.cpp:15: undefined reference to `__imp__ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE'
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `boost::python::type_info::name() const':
C:/boost_1_67_0/boost/python/type_id.hpp:160: undefined reference to `__imp__ZN5boost6python6detail12gcc_demangleEPKc'
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `boost::python::to_python_value<char const* const&>::operator()(char const* const&) const':
C:/boost_1_67_0/boost/python/converter/builtin_converters.hpp:157: undefined reference to `__imp__ZN5boost6python9converter19do_return_to_pythonEPKc'
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `void boost::python::def<char const* (*)()>(char const*, char const* (*)())':
C:/boost_1_67_0/boost/python/def.hpp:91: undefined reference to `__imp__ZN5boost6python6detail17scope_setattr_docEPKcRKNS0_3api6objectES3_'
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `boost::python::api::object boost::python::detail::make_function_aux<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> >(char const* (*)(), boost::python::default_call_policies const&, boost::mpl::vector1<char const*> const&)':
C:/boost_1_67_0/boost/python/make_function.hpp:38: undefined reference to `__imp__ZN5boost6python7objects15function_objectERKNS1_11py_functionE'
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `boost::python::objects::py_function_impl_base::py_function_impl_base()':
C:/boost_1_67_0/boost/python/object/py_function.hpp:20: undefined reference to `__imp__ZTVN5boost6python7objects21py_function_impl_baseE'
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > >::~caller_py_function_impl()':
C:/boost_1_67_0/boost/python/object/py_function.hpp:30: undefined reference to `__imp__ZN5boost6python7objects21py_function_impl_baseD2Ev'
CMakeFiles\hello_ext.dir/objects.a(hello.cpp.obj): In function `boost::python::converter::expected_pytype_for_arg<char const*>::get_pytype()':
C:/boost_1_67_0/boost/python/converter/pytype_function.hpp:67: undefined reference to `__imp__ZN5boost6python9converter8registry5queryENS0_9type_infoE'
C:/boost_1_67_0/boost/python/converter/pytype_function.hpp:70: undefined reference to `__imp__ZNK5boost6python9converter12registration25expected_from_python_typeEv'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\hello_ext.dir\build.make:88: libhello_ext.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:72: CMakeFiles/hello_ext.dir/all] Error 2
mingw32-make: *** [Makefile:83: all] Error 2
For some strange reason, the naming convention must be forced for Boost Python (and only for Boost Python, other Boost modules don't need this) in Windows (not in Linux nor MacOSX).
In summary, you need to add:
add_definitions(/DBOOST_PYTHON_STATIC_LIB)
to your CMake config file. Otherwise, your linker will try to use boost_python37-vc141-mt-x64-1_70.lib (the import library associated to the DLL, boost_python37-vc141-mt-x64-1_70.dll) instead of libboost_python37-vc141-mt-x64-1_70.lib, which is the "real" static library (Stupid Windows and its weird convention to use the same extension for Import libraries and Static libraries).

Cython Compile Error: Python3 Compatibility

I am running Python 3.4.4 :: Anaconda 4.0.0 (x86_64) on OS X Yosemite. My Cython's version is 0.23.4. I'm trying to embed some very trivial Cython code test.pyx into C code testcc.c. The problem is, if I use python2.7-config then everything works well (Python 2.7 is the built-in version on OS X). However if I use python3.4-config the following errors raised:
Undefined symbols for architecture x86_64:
"_inittest", referenced from:
_main in testcc-b22dcf.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have to use Python3 since all my other codes are written in it. Please help me solve this problem.
The following are my source files:
test.pyx:
cdef public void pythonAdd(int[] a):
a[1] = 5
a[0] = 4
testcc.c:
#include "Python.h"
#include "test.h"
#include <math.h>
#include <stdio.h>
int main(int argc, char **argv) {
Py_Initialize();
inittest();
int a [2] = {0 , 0};
pythonAdd(a);
printf("fist: %d, second: %d", a[0], a[1]);
Py_Finalize();
return 0;
}
And Compiling those two files using following setup.py:
from distutils.core import setup, Extension
from Cython.Build import cythonize
ext = Extension("testc", sources=["test.pyx"])
setup(name="testc", ext_modules=cythonize(ext))
The following is the command I compile those c files:
ldflags:=$(shell $(python3.4-config) --ldflags)
cflags:=$(shell $(python3.4-config) --cflags)
python setup.py build_ext --inplace
cython test.pyx
gcc $(cflags) $(ldflags) test.c testcc.c -o cysvm.out
Update:
I changed the inittest() to PyInit_test() as Jim suggested. The code compiles successfully. However when I run ./cysvm.out the following errors occured:
./cysvm.out
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'
Current thread 0x00007fff772f5300 (most recent call first):
Update
I solved this by adding the following line before Py_Initialize(); in my c code:
Py_SetPythonHome(L"/PATH/to/python3");
This is probably due to the fact that in Python 3.x initialization of modules is not performed by calling init<module_name> but rather with PyInit_<module_name> (See PEP 3121). So, if you are linking with Python 3.x and executing via 3.x you need to change the initialization call.
In short, changing the call that initializes the module from:
inittest();
To:
PyInit_test();
and recompiling, should do the trick.
As for your second problem, an alternate solution other than using Py_SetPythonHome is setting PYTHONHOME to the output of python3.4-config --exec-prefix (or sys.exec_prefix) prior to compilation.

Embed python2.7 in a C program, using CMakeLists.txt. Static libraries linking

I'm doing some trials to embed python in a c program.
I use CMake 2.8.12.2 and gcc 4.8.1 to build the application. My Python version is 2.7.11. Running on W7.
This is how I'm linking the libraries in the CMakeLists.txt, which has always worked for me before with static libraries:
CMakeLists.txt
cmake_minimum_required(VERSION 2.7 FATAL_ERROR)
project(testpy)
include_directories("C:\\Anaconda\\include")
link_directories("C:\\Anaconda\\libs")
set(CMAKE_BUILD_TYPE Release)
set(SOURCE_FILES testpy.c)
add_executable(testpy ${SOURCE_FILES} Python.h)
set(PYLIB_DIR "C:\\Anaconda\\libs")
message(${PYLIB_DIR})
find_library(PYlib python27.lib HINTS ${PYLIB_DIR})
include_directories(${PYLIB_DIR})
message(${PYlib})
TARGET_LINK_LIBRARIES(testpy ${PYlib})
testpy.c
#include <Python.h>
int main(int argc, char *argv[])
{
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\nprint('Today is',ctime(time())\n)");
Py_Finalize();
return 0;
}
The errors I am getting when making:
CMakeFiles\testpy.dir/objects.a(testpy.c.obj):testpy.c:(.text.startup+0x10): und
efined reference to `_imp__Py_Initialize'
CMakeFiles\testpy.dir/objects.a(testpy.c.obj):testpy.c:(.text.startup+0x25): und
efined reference to `_imp__PyRun_SimpleStringFlags'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: CMakeFiles
\testpy.dir/objects.a(testpy.c.obj): bad reloc address 0x25 in section `.text.st
artup'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
CMakeFiles\testpy.dir\build.make:90: recipe for target 'testpy.exe' failed
mingw32-make[2]: *** [testpy.exe] Error 1
CMakeFiles\Makefile2:62: recipe for target 'CMakeFiles/testpy.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/testpy.dir/all] Error 2
Makefile:74: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I'm pretty shure is a linking problem, but I still not seing where it is, and how to fix it. Seen and tried also a lot of solutions suggested here and in other forums without success.
In both \include and \libs folders can be found the python.h and the python27.lib, respectively.
Thanks in advance for your feedback.

Issues with building PyQt5 on Ubuntu 14.04

I am having some problems building PyQt5 on Ubuntu 14.04. I am working with some code that has a hard dependency on Python 2.7; so, I am unable to use the python3 packages from Ubuntu's repository. Further searches of Ubuntu's packages reveal that there are dev and doc packages for Python 2 pyqt5. But, nothing to install the libraries necessary to write code.
This has led me to creating a custom build for PyQt5. I obtained the source for version 5.5 from here: https://www.riverbankcomputing.com/software/pyqt/download5 and I am using sip as provided by the Ubuntu repos (installation of kubuntu-desktop requires sip).
I read that its easy to have mismatched versions of sip so I did the following check:
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sip
>>> print(sip, sip.SIP_VERSION_STR)
(<module 'sip' from '/usr/lib/python2.7/dist-packages/sip.so'>, '4.16.9')
And:
$ sip -V
4.16.9
Also I am using the Qt5 tools provided by the Ubuntu repos. This included installing qtdeclarative5-* (probably overkill) and qt5-default. Here is some information about qmake:
qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
I currently have PyQt4 installed and read on the installation notes that this would be fine as long as they were both compiled against the same version of sip.
After downloading, I unpacked the tarball and attempted a build as follows:
sudo ln -s /usr/include/python2.7 /usr/local/include/python2.7
python configure.py --sip-incdir=/usr/include/python2.7/
make
The configuration output appeared to identify the correct version of sip and I get the following (seemingly) sip related compile errors from make:
make[1]: Entering directory `~/Downloads/PyQt-gpl-5.5/QtWebKit'
g++ -c -m64 -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WEBKIT_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -I. -I/usr/include/python2.7 -I/usr/include/qt5 -I/usr/include/qt5/QtWebKit -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o sipQtWebKitQWebSecurityOrigin.o sipQtWebKitQWebSecurityOrigin.cpp
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: In function ‘PyObject* meth_QWebSecurityOrigin_addAccessWhitelistEntry(PyObject*, PyObject*)’:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:384:9: error: ‘SubdomainSetting’ is not a member of ‘QWebSecurityOrigin’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:384:46: error: expected ‘;’ before ‘a2’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:387:214: error: ‘a2’ was not declared in this scope
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1E", &sipSelf, sipType_QWebSecurityOrigin, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, sipType_QWebSecurityOrigin_SubdomainSetting, &a2))
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:389:21: error: ‘class QWebSecurityOrigin’ has no member named ‘addAccessWhitelistEntry’
sipCpp->addAccessWhitelistEntry(*a0,*a1,a2);
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: In function ‘PyObject* meth_QWebSecurityOrigin_removeAccessWhitelistEntry(PyObject*, PyObject*)’:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:417:9: error: ‘SubdomainSetting’ is not a member of ‘QWebSecurityOrigin’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:417:46: error: expected ‘;’ before ‘a2’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:420:214: error: ‘a2’ was not declared in this scope
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1E", &sipSelf, sipType_QWebSecurityOrigin, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, sipType_QWebSecurityOrigin_SubdomainSetting, &a2))
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:422:21: error: ‘class QWebSecurityOrigin’ has no member named ‘removeAccessWhitelistEntry’
sipCpp->removeAccessWhitelistEntry(*a0,*a1,a2);
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: In function ‘void* init_type_QWebSecurityOrigin(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:477:48: error: no matching function for call to ‘QWebSecurityOrigin::QWebSecurityOrigin(const QUrl&)’
sipCpp = new QWebSecurityOrigin(*a0);
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:477:48: note: candidates are:
In file included from ~/Downloads/PyQt-gpl-5.5/sip/QtWebKit/qwebsecurityorigin.sip:26:0:
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:64:5: note: QWebSecurityOrigin::QWebSecurityOrigin(QWebSecurityOriginPrivate*)
QWebSecurityOrigin(QWebSecurityOriginPrivate* priv);
^
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:64:5: note: no known conversion for argument 1 from ‘const QUrl’ to ‘QWebSecurityOriginPrivate*’
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:58:5: note: QWebSecurityOrigin::QWebSecurityOrigin(const QWebSecurityOrigin&)
QWebSecurityOrigin(const QWebSecurityOrigin& other);
^
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:58:5: note: no known conversion for argument 1 from ‘const QUrl’ to ‘const QWebSecurityOrigin&’
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: At global scope:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:516:48: error: ‘AllowSubdomains’ is not a member of ‘QWebSecurityOrigin’
{sipName_AllowSubdomains, static_cast<int>(QWebSecurityOrigin::AllowSubdomains), 21},
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:517:51: error: ‘DisallowSubdomains’ is not a member of ‘QWebSecurityOrigin’
{sipName_DisallowSubdomains, static_cast<int>(QWebSecurityOrigin::DisallowSubdomains), 21},
^
make[1]: *** [sipQtWebKitQWebSecurityOrigin.o] Error 1
make[1]: Leaving directory `~/Downloads/PyQt-gpl-5.5/QtWebKit'
make: *** [sub-QtWebKit-make_first-ordered] Error 2
The outcome is that I can make install and get some of the functionality that I'd expect; however, I am missing some required functionality with the WebKit widgets. I hope that I have supplied enough information to describe where i'm stuck. I feel just shy of digging into the code; however, I'm assuming that the answer is actually much simpler.
Thanks in advance!
So,
I started digging through the source package for the file that is failing to be compiled. In the sip directory there is a sip file QWebSecurityOrigin that contains the following:
%If (Qt_5_2_0 -)
enum SubdomainSetting
{
AllowSubdomains,
DisallowSubdomains,
};
%End
I can reasonably expect that this code be included as qmake tells me the following:
qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
Next I wanted to look into the qwebsecurityorigin.h that was provided by Qt to see if the error could come from there. Mine is installed here: /usr/include/qt5/QtWebKit/qwebsecurityorigin.h
#ifndef _WEBSECURITYORIGIN_H_
#define _WEBSECURITYORIGIN_H_
#include <QtCore/qurl.h>
#include <QtCore/qshareddata.h>
#include "qwebkitglobal.h"
namespace WebCore {
class SecurityOrigin;
class ChromeClientQt;
}
class QWebSecurityOriginPrivate;
class QWebDatabase;
class QWebFrame;
class QWEBKIT_EXPORT QWebSecurityOrigin {
public:
static QList<QWebSecurityOrigin> allOrigins();
static void addLocalScheme(const QString& scheme);
static void removeLocalScheme(const QString& scheme);
static QStringList localSchemes();
~QWebSecurityOrigin();
QString scheme() const;
QString host() const;
int port() const;
qint64 databaseUsage() const;
qint64 databaseQuota() const;
void setDatabaseQuota(qint64 quota);
void setApplicationCacheQuota(qint64 quota);
QList<QWebDatabase> databases() const;
QWebSecurityOrigin(const QWebSecurityOrigin& other);
QWebSecurityOrigin &operator=(const QWebSecurityOrigin& other);
private:
friend class QWebDatabase;
friend class QWebFrameAdapter;
friend class WebCore::ChromeClientQt;
QWebSecurityOrigin(QWebSecurityOriginPrivate* priv);
private:
QExplicitlySharedDataPointer<QWebSecurityOriginPrivate> d;
};
Note, no enum is defined. A search of Qt 5.5 suggests that the enum should be there: http://doc.qt.io/qt-5/qwebsecurityorigin.html#SubdomainSetting-enum
Finally, had recalled that I installed libqt5webkit separately from the bulk of the Qt libraries; so, I did a version check on the package:
dpkg -s libqt5webkit5
Package: libqt5webkit5
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 34225
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: qtwebkit-opensource-src
Version: 5.1.1-1ubuntu8
This output is almost identical for the dev package. So this makes it appear as the bulk of the Qt5 distribution, in the repos, is on a different version than webkit. Furthermore, if QWebKit is on 5.1.1, it would explain why the enum is missing as the sip file seems to suggest it was an addition in 5.2.0.
So my solution was to download and install Qt 5.5 from the Qt website using the automated installer (ran with sudo, using defaults). I then started fresh with the PyQt5 source by blowing away the build directory and unpacking source again:
python configure.py --sip-incdir=/usr/include/python2.7/ --qmake=/opt/Qt/5.5/gcc_64/bin/qmake
make
sudo make install
The licenses are not compatible; however, a quick search through the pyqt5 configure.py script, using the error output, may give some insight into getting the code configured and compiling.

Categories

Resources