davejohncole / kea_python

Embed Python in the Kea DHCP server.
Mozilla Public License 2.0
25 stars 15 forks source link

Compile error with Kea 1.8.0 in lease_mgr.cc #1

Open djlambert opened 3 years ago

djlambert commented 3 years ago

The module is failing compilation in lease_mgr.cc with Python 3.9 and Kea 1.8.0 under Ubuntu 21.04 on aarch64:

admin@h-tst-smbdc-01:~/src/kea_python/keamodule$ python3 setup.py install
running install
running build
running build_ext
building 'kea' extension
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_closure.cc -o build/temp.linux-aarch64-3.9/callout_closure.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_handle.cc -o build/temp.linux-aarch64-3.9/callout_handle.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_manager.cc -o build/temp.linux-aarch64-3.9/callout_manager.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callouts.cc -o build/temp.linux-aarch64-3.9/callouts.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c capsule.cc -o build/temp.linux-aarch64-3.9/capsule.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_mgr.cc -o build/temp.linux-aarch64-3.9/cfg_mgr.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_subnets4.cc -o build/temp.linux-aarch64-3.9/cfg_subnets4.o
cfg_subnets4.cc: In function ‘PyObject* CfgSubnets4_from_ptr(isc::dhcp::CfgSubnets4Ptr&)’:
cfg_subnets4.cc:181:49: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr<isc::dhcp::CfgSubnets4>’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
  181 |         memset(&self->ptr, 0 , sizeof(self->ptr));
      |                                                 ^
In file included from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/kea/cc/data.h:14,
                 from /usr/include/kea/hooks/library_handle.h:11,
                 from /usr/include/kea/hooks/callout_handle.h:11,
                 from /usr/include/kea/hooks/hooks.h:10,
                 from keamodule.h:3,
                 from cfg_subnets4.cc:1:
/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr<isc::dhcp::CfgSubnets4>’} declared here
  335 | template<class T> class shared_ptr
      |                         ^~~~~~~~~~
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c constants.cc -o build/temp.linux-aarch64-3.9/constants.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c errors.cc -o build/temp.linux-aarch64-3.9/errors.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c kea.cc -o build/temp.linux-aarch64-3.9/kea.o
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease4.cc -o build/temp.linux-aarch64-3.9/lease4.o
lease4.cc: In function ‘PyObject* Lease4_from_handle(isc::dhcp::Lease4Ptr&)’:
lease4.cc:452:49: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr<isc::dhcp::Lease4>’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
  452 |         memset(&self->ptr, 0 , sizeof(self->ptr));
      |                                                 ^
In file included from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/kea/cc/data.h:14,
                 from /usr/include/kea/hooks/library_handle.h:11,
                 from /usr/include/kea/hooks/callout_handle.h:11,
                 from /usr/include/kea/hooks/hooks.h:10,
                 from keamodule.h:3,
                 from lease4.cc:1:
/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr<isc::dhcp::Lease4>’} declared here
  335 | template<class T> class shared_ptr
      |                         ^~~~~~~~~~
aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease_mgr.cc -o build/temp.linux-aarch64-3.9/lease_mgr.o
lease_mgr.cc: In function ‘PyObject* LeaseMgr_deleteLease(LeaseMgrObject*, PyObject*)’:
lease_mgr.cc:198:69: error: no matching function for call to ‘isc::dhcp::LeaseMgr::deleteLease(isc::asiolink::IOAddress)’
  198 |         bool result = self->mgr->deleteLease(IOAddress(string(addr)));
      |                                                                     ^
In file included from keamodule.h:9,
                 from lease_mgr.cc:1:
/usr/include/kea/dhcpsrv/lease_mgr.h:554:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease4Ptr&)’
  554 |     virtual bool deleteLease(const Lease4Ptr& lease) = 0;
      |                  ^~~~~~~~~~~
/usr/include/kea/dhcpsrv/lease_mgr.h:554:47: note:   no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease4Ptr&’ {aka ‘const boost::shared_ptr<isc::dhcp::Lease4>&’}
  554 |     virtual bool deleteLease(const Lease4Ptr& lease) = 0;
      |                              ~~~~~~~~~~~~~~~~~^~~~~
/usr/include/kea/dhcpsrv/lease_mgr.h:564:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease6Ptr&)’
  564 |     virtual bool deleteLease(const Lease6Ptr& lease) = 0;
      |                  ^~~~~~~~~~~
/usr/include/kea/dhcpsrv/lease_mgr.h:564:47: note:   no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease6Ptr&’ {aka ‘const boost::shared_ptr<isc::dhcp::Lease6>&’}
  564 |     virtual bool deleteLease(const Lease6Ptr& lease) = 0;
      |                              ~~~~~~~~~~~~~~~~~^~~~~
error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

Very excited to get this working. My experience with C++ is close to zero, but I'm happy to provide additional information.

davejohncole commented 3 years ago

I was wondering how bad my initialisation method for those smart pointers was. The C++ pointers live in memory allocated on the C heap (by the Python interpreter), so C++ does not get an opportunity to initialise them.

I will see if I can initialise them manually in C++ after work today.

On Wed, Apr 7, 2021 at 12:19 AM Derek J. Lambert @.***> wrote:

The module is failing compilation in lease_mgr.cc with Python 3.9 and Kea 1.8.0 under Ubuntu 21.04 on aarch64:

@.***:~/src/kea_python/keamodule$ python3 setup.py install

running install

running build

running build_ext

building 'kea' extension

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_closure.cc -o build/temp.linux-aarch64-3.9/callout_closure.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_handle.cc -o build/temp.linux-aarch64-3.9/callout_handle.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_manager.cc -o build/temp.linux-aarch64-3.9/callout_manager.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callouts.cc -o build/temp.linux-aarch64-3.9/callouts.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c capsule.cc -o build/temp.linux-aarch64-3.9/capsule.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_mgr.cc -o build/temp.linux-aarch64-3.9/cfg_mgr.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_subnets4.cc -o build/temp.linux-aarch64-3.9/cfg_subnets4.o

cfg_subnets4.cc: In function ‘PyObject* CfgSubnets4_from_ptr(isc::dhcp::CfgSubnets4Ptr&)’:

cfg_subnets4.cc:181:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

181 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from cfg_subnets4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c constants.cc -o build/temp.linux-aarch64-3.9/constants.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c errors.cc -o build/temp.linux-aarch64-3.9/errors.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c kea.cc -o build/temp.linux-aarch64-3.9/kea.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease4.cc -o build/temp.linux-aarch64-3.9/lease4.o

lease4.cc: In function ‘PyObject* Lease4_from_handle(isc::dhcp::Lease4Ptr&)’:

lease4.cc:452:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

452 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from lease4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease_mgr.cc -o build/temp.linux-aarch64-3.9/lease_mgr.o

lease_mgr.cc: In function ‘PyObject LeaseMgr_deleteLease(LeaseMgrObject, PyObject*)’:

lease_mgr.cc:198:69: error: no matching function for call to ‘isc::dhcp::LeaseMgr::deleteLease(isc::asiolink::IOAddress)’

198 | bool result = self->mgr->deleteLease(IOAddress(string(addr)));

  |                                                                     ^

In file included from keamodule.h:9,

             from lease_mgr.cc:1:

/usr/include/kea/dhcpsrv/lease_mgr.h:554:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease4Ptr&)’

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:554:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease4Ptr&’ {aka ‘const boost::shared_ptr&’}

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease6Ptr&)’

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease6Ptr&’ {aka ‘const boost::shared_ptr&’}

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

Very excited to get this working. My experience with C++ is close to zero, but I'm happy to provide additional information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davejohncole/kea_python/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUSDEHK6PT4OVFKHZRFXQDTHMJ6DANCNFSM42O2WD7Q .

davejohncole commented 3 years ago

Ahhh. I just realised. They have changed some more API with 1.8.0.

I need to add some more conditional compilation to handle the changes. I am building 1.8.2 at the moment so I can adapt the code to the new API.

On Wed, Apr 7, 2021 at 7:14 AM Dave Cole @.***> wrote:

I was wondering how bad my initialisation method for those smart pointers was. The C++ pointers live in memory allocated on the C heap (by the Python interpreter), so C++ does not get an opportunity to initialise them.

I will see if I can initialise them manually in C++ after work today.

On Wed, Apr 7, 2021 at 12:19 AM Derek J. Lambert @.***> wrote:

The module is failing compilation in lease_mgr.cc with Python 3.9 and Kea 1.8.0 under Ubuntu 21.04 on aarch64:

@.***:~/src/kea_python/keamodule$ python3 setup.py install

running install

running build

running build_ext

building 'kea' extension

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_closure.cc -o build/temp.linux-aarch64-3.9/callout_closure.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_handle.cc -o build/temp.linux-aarch64-3.9/callout_handle.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_manager.cc -o build/temp.linux-aarch64-3.9/callout_manager.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callouts.cc -o build/temp.linux-aarch64-3.9/callouts.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c capsule.cc -o build/temp.linux-aarch64-3.9/capsule.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_mgr.cc -o build/temp.linux-aarch64-3.9/cfg_mgr.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_subnets4.cc -o build/temp.linux-aarch64-3.9/cfg_subnets4.o

cfg_subnets4.cc: In function ‘PyObject* CfgSubnets4_from_ptr(isc::dhcp::CfgSubnets4Ptr&)’:

cfg_subnets4.cc:181:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

181 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from cfg_subnets4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c constants.cc -o build/temp.linux-aarch64-3.9/constants.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c errors.cc -o build/temp.linux-aarch64-3.9/errors.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c kea.cc -o build/temp.linux-aarch64-3.9/kea.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease4.cc -o build/temp.linux-aarch64-3.9/lease4.o

lease4.cc: In function ‘PyObject* Lease4_from_handle(isc::dhcp::Lease4Ptr&)’:

lease4.cc:452:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

452 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from lease4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease_mgr.cc -o build/temp.linux-aarch64-3.9/lease_mgr.o

lease_mgr.cc: In function ‘PyObject LeaseMgr_deleteLease(LeaseMgrObject, PyObject*)’:

lease_mgr.cc:198:69: error: no matching function for call to ‘isc::dhcp::LeaseMgr::deleteLease(isc::asiolink::IOAddress)’

198 | bool result = self->mgr->deleteLease(IOAddress(string(addr)));

  |                                                                     ^

In file included from keamodule.h:9,

             from lease_mgr.cc:1:

/usr/include/kea/dhcpsrv/lease_mgr.h:554:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease4Ptr&)’

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:554:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease4Ptr&’ {aka ‘const boost::shared_ptr&’}

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease6Ptr&)’

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease6Ptr&’ {aka ‘const boost::shared_ptr&’}

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

Very excited to get this working. My experience with C++ is close to zero, but I'm happy to provide additional information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davejohncole/kea_python/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUSDEHK6PT4OVFKHZRFXQDTHMJ6DANCNFSM42O2WD7Q .

davejohncole commented 3 years ago

Hmmm... I am going to need to download a different docker image to replicate your problem. It compiled fine with centos:7.

@.***:~/play/kea_python$ VER=1.8.2 make build-kea docker build --build-arg VER=1.8.2 --tag kea:1.8.2 . Sending build context to Docker daemon 106.5MB Step 1/10 : ARG VER Step 2/10 : FROM kea-dev:$VER AS build ---> 9dfca1aa45c8 Step 3/10 : WORKDIR /source ---> Running in 3cc96ed0fd32 Removing intermediate container 3cc96ed0fd32 ---> 1775546f3767 Step 4/10 : COPY . . ---> 5d27b97385b5 Step 5/10 : RUN make clean install && mkdir /dist && cd /usr/local && find lib -name *.so* | tar cf - -T - | (cd /dist; tar xf -) && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -) ---> Running in 7eebf2ac0919 touch settings.mk cd keahook && make clean make[1]: Entering directory '/source/keahook' rm -f libkea_python.so make[1]: Leaving directory '/source/keahook' cd keamodule && rm -rf build rm -f settings.mk dhcpdb_create.mysql.sql python3 settings.py cd keahook && make libkea_python.so make[1]: Entering directory '/source/keahook' g++ -std=c++11 -I /usr/local/include/kea -I /usr/include/python3.5m -L /usr/local/lib -fpic -shared -o libkea_python.so \ load_unload.cc messages.cc version.cc \ -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions make[1]: Leaving directory '/source/keahook' cd keahook && make install make[1]: Entering directory '/source/keahook' install libkea_python.so /usr/local/lib/kea/hooks make[1]: Leaving directory '/source/keahook' cd keamodule && python3 setup.py build running build running build_ext building 'kea' extension creating build creating build/temp.linux-x86_64-3.5 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c kea.cc -o build/temp.linux-x86_64-3.5/kea.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host.cc -o build/temp.linux-x86_64-3.5/host.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host_reservation_parser4.cc -o build/temp.linux-x86_64-3.5/host_reservation_parser4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host_mgr.cc -o build/temp.linux-x86_64-3.5/host_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c cfg_mgr.cc -o build/temp.linux-x86_64-3.5/cfg_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c cfg_subnets4.cc -o build/temp.linux-x86_64-3.5/cfg_subnets4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c lease_mgr.cc -o build/temp.linux-x86_64-3.5/lease_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c errors.cc -o build/temp.linux-x86_64-3.5/errors.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c capsule.cc -o build/temp.linux-x86_64-3.5/capsule.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c constants.cc -o build/temp.linux-x86_64-3.5/constants.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c utils.cc -o build/temp.linux-x86_64-3.5/utils.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callouts.cc -o build/temp.linux-x86_64-3.5/callouts.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_closure.cc -o build/temp.linux-x86_64-3.5/callout_closure.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_manager.cc -o build/temp.linux-x86_64-3.5/callout_manager.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c library_handle.cc -o build/temp.linux-x86_64-3.5/library_handle.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_handle.cc -o build/temp.linux-x86_64-3.5/callout_handle.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c lease4.cc -o build/temp.linux-x86_64-3.5/lease4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c pkt4.cc -o build/temp.linux-x86_64-3.5/pkt4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c subnet4.cc -o build/temp.linux-x86_64-3.5/subnet4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c option.cc -o build/temp.linux-x86_64-3.5/option.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c srv_config.cc -o build/temp.linux-x86_64-3.5/srv_config.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ creating build/lib.linux-x86_64-3.5 x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/kea.o build/temp.linux-x86_64-3.5/host.o build/temp.linux-x86_64-3.5/host_reservation_parser4.o build/temp.linux-x86_64-3.5/host_mgr.o build/temp.linux-x86_64-3.5/cfg_mgr.o build/temp.linux-x86_64-3.5/cfg_subnets4.o build/temp.linux-x86_64-3.5/lease_mgr.o build/temp.linux-x86_64-3.5/errors.o build/temp.linux-x86_64-3.5/capsule.o build/temp.linux-x86_64-3.5/constants.o build/temp.linux-x86_64-3.5/utils.o build/temp.linux-x86_64-3.5/callouts.o build/temp.linux-x86_64-3.5/callout_closure.o build/temp.linux-x86_64-3.5/callout_manager.o build/temp.linux-x86_64-3.5/library_handle.o build/temp.linux-x86_64-3.5/callout_handle.o build/temp.linux-x86_64-3.5/lease4.o build/temp.linux-x86_64-3.5/pkt4.o build/temp.linux-x86_64-3.5/subnet4.o build/temp.linux-x86_64-3.5/option.o build/temp.linux-x86_64-3.5/srv_config.o -L/usr/local/lib -lkea-exceptions -lkea-log -lkea-hooks -lkea-dhcpsrv -lffi -o build/lib.linux-x86_64-3.5/ kea.cpython-35m-x86_64-linux-gnu.so cd keamodule && python3 setup.py install running install running build running build_ext running install_lib copying build/lib.linux-x86_64-3.5/kea.cpython-35m-x86_64-linux-gnu.so -> /usr/local/lib/python3.5/dist-packages running install_egg_info Writing /usr/local/lib/python3.5/dist-packages/kea-1.0.egg-info Removing intermediate container 7eebf2ac0919 ---> d1d1e2e08adf Step 6/10 : FROM debian:stretch-slim ---> 2b343cb3b772 Step 7/10 : ENV DEBIAN_FRONTEND noninteractive ---> Using cache ---> f35337a5b422 Step 8/10 : RUN apt-get update -y && apt-get -y install procps socat python3 libpython3.5 liblog4cplus-1.1-9 libboost-system1.62.0 libffi6 libpq5 libmariadb2 ---> Using cache ---> f760a073f805 Step 9/10 : COPY --from=build /dist /usr/local ---> 99ab3088493c Step 10/10 : RUN ldconfig ---> Running in f8034e9bb43d Removing intermediate container f8034e9bb43d ---> 92583087c223 Successfully built 92583087c223 Successfully tagged kea:1.8.2

And I am definitely using kea 1.8.2:

@.***:~/play/kea_python$ docker run --rm kea:1.8.2 /usr/local/sbin/kea-dhcp4 -V 1.8.2 tarball linked with: log4cplus 1.1.2 OpenSSL 1.1.0l 10 Sep 2019 database: MySQL backend 9.3, library 5.5.1 PostgreSQL backend 6.1, library 90617 Memfile backend 2.1

I will have to do some more on this after work :-).

On Wed, Apr 7, 2021 at 7:22 AM Dave Cole @.***> wrote:

Ahhh. I just realised. They have changed some more API with 1.8.0.

I need to add some more conditional compilation to handle the changes. I am building 1.8.2 at the moment so I can adapt the code to the new API.

On Wed, Apr 7, 2021 at 7:14 AM Dave Cole @.***> wrote:

I was wondering how bad my initialisation method for those smart pointers was. The C++ pointers live in memory allocated on the C heap (by the Python interpreter), so C++ does not get an opportunity to initialise them.

I will see if I can initialise them manually in C++ after work today.

On Wed, Apr 7, 2021 at 12:19 AM Derek J. Lambert < @.***> wrote:

The module is failing compilation in lease_mgr.cc with Python 3.9 and Kea 1.8.0 under Ubuntu 21.04 on aarch64:

@.***:~/src/kea_python/keamodule$ python3 setup.py install

running install

running build

running build_ext

building 'kea' extension

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_closure.cc -o build/temp.linux-aarch64-3.9/callout_closure.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_handle.cc -o build/temp.linux-aarch64-3.9/callout_handle.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_manager.cc -o build/temp.linux-aarch64-3.9/callout_manager.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callouts.cc -o build/temp.linux-aarch64-3.9/callouts.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c capsule.cc -o build/temp.linux-aarch64-3.9/capsule.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_mgr.cc -o build/temp.linux-aarch64-3.9/cfg_mgr.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_subnets4.cc -o build/temp.linux-aarch64-3.9/cfg_subnets4.o

cfg_subnets4.cc: In function ‘PyObject* CfgSubnets4_from_ptr(isc::dhcp::CfgSubnets4Ptr&)’:

cfg_subnets4.cc:181:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

181 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from cfg_subnets4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c constants.cc -o build/temp.linux-aarch64-3.9/constants.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c errors.cc -o build/temp.linux-aarch64-3.9/errors.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c kea.cc -o build/temp.linux-aarch64-3.9/kea.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease4.cc -o build/temp.linux-aarch64-3.9/lease4.o

lease4.cc: In function ‘PyObject* Lease4_from_handle(isc::dhcp::Lease4Ptr&)’:

lease4.cc:452:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

452 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from lease4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease_mgr.cc -o build/temp.linux-aarch64-3.9/lease_mgr.o

lease_mgr.cc: In function ‘PyObject LeaseMgr_deleteLease(LeaseMgrObject, PyObject*)’:

lease_mgr.cc:198:69: error: no matching function for call to ‘isc::dhcp::LeaseMgr::deleteLease(isc::asiolink::IOAddress)’

198 | bool result = self->mgr->deleteLease(IOAddress(string(addr)));

  |                                                                     ^

In file included from keamodule.h:9,

             from lease_mgr.cc:1:

/usr/include/kea/dhcpsrv/lease_mgr.h:554:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease4Ptr&)’

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:554:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease4Ptr&’ {aka ‘const boost::shared_ptr&’}

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease6Ptr&)’

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease6Ptr&’ {aka ‘const boost::shared_ptr&’}

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

Very excited to get this working. My experience with C++ is close to zero, but I'm happy to provide additional information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davejohncole/kea_python/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUSDEHK6PT4OVFKHZRFXQDTHMJ6DANCNFSM42O2WD7Q .

davejohncole commented 3 years ago

I am now building the code with 21.04 from here https://hub.docker.com/_/ubuntu - it takes a while, but I will get there.

If/when I make any progress I will send another message.

On Wed, Apr 7, 2021 at 8:20 AM Dave Cole @.***> wrote:

Hmmm... I am going to need to download a different docker image to replicate your problem. It compiled fine with centos:7.

@.***:~/play/kea_python$ VER=1.8.2 make build-kea docker build --build-arg VER=1.8.2 --tag kea:1.8.2 . Sending build context to Docker daemon 106.5MB Step 1/10 : ARG VER Step 2/10 : FROM kea-dev:$VER AS build ---> 9dfca1aa45c8 Step 3/10 : WORKDIR /source ---> Running in 3cc96ed0fd32 Removing intermediate container 3cc96ed0fd32 ---> 1775546f3767 Step 4/10 : COPY . . ---> 5d27b97385b5 Step 5/10 : RUN make clean install && mkdir /dist && cd /usr/local && find lib -name *.so* | tar cf - -T - | (cd /dist; tar xf -) && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -) ---> Running in 7eebf2ac0919 touch settings.mk cd keahook && make clean make[1]: Entering directory '/source/keahook' rm -f libkea_python.so make[1]: Leaving directory '/source/keahook' cd keamodule && rm -rf build rm -f settings.mk dhcpdb_create.mysql.sql python3 settings.py cd keahook && make libkea_python.so make[1]: Entering directory '/source/keahook' g++ -std=c++11 -I /usr/local/include/kea -I /usr/include/python3.5m -L /usr/local/lib -fpic -shared -o libkea_python.so \ load_unload.cc messages.cc version.cc \ -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions make[1]: Leaving directory '/source/keahook' cd keahook && make install make[1]: Entering directory '/source/keahook' install libkea_python.so /usr/local/lib/kea/hooks make[1]: Leaving directory '/source/keahook' cd keamodule && python3 setup.py build running build running build_ext building 'kea' extension creating build creating build/temp.linux-x86_64-3.5 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c kea.cc -o build/temp.linux-x86_64-3.5/kea.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host.cc -o build/temp.linux-x86_64-3.5/host.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host_reservation_parser4.cc -o build/temp.linux-x86_64-3.5/host_reservation_parser4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host_mgr.cc -o build/temp.linux-x86_64-3.5/host_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c cfg_mgr.cc -o build/temp.linux-x86_64-3.5/cfg_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c cfg_subnets4.cc -o build/temp.linux-x86_64-3.5/cfg_subnets4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c lease_mgr.cc -o build/temp.linux-x86_64-3.5/lease_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c errors.cc -o build/temp.linux-x86_64-3.5/errors.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c capsule.cc -o build/temp.linux-x86_64-3.5/capsule.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c constants.cc -o build/temp.linux-x86_64-3.5/constants.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c utils.cc -o build/temp.linux-x86_64-3.5/utils.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callouts.cc -o build/temp.linux-x86_64-3.5/callouts.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_closure.cc -o build/temp.linux-x86_64-3.5/callout_closure.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_manager.cc -o build/temp.linux-x86_64-3.5/callout_manager.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c library_handle.cc -o build/temp.linux-x86_64-3.5/library_handle.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_handle.cc -o build/temp.linux-x86_64-3.5/callout_handle.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c lease4.cc -o build/temp.linux-x86_64-3.5/lease4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c pkt4.cc -o build/temp.linux-x86_64-3.5/pkt4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c subnet4.cc -o build/temp.linux-x86_64-3.5/subnet4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c option.cc -o build/temp.linux-x86_64-3.5/option.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c srv_config.cc -o build/temp.linux-x86_64-3.5/srv_config.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ creating build/lib.linux-x86_64-3.5 x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/kea.o build/temp.linux-x86_64-3.5/host.o build/temp.linux-x86_64-3.5/host_reservation_parser4.o build/temp.linux-x86_64-3.5/host_mgr.o build/temp.linux-x86_64-3.5/cfg_mgr.o build/temp.linux-x86_64-3.5/cfg_subnets4.o build/temp.linux-x86_64-3.5/lease_mgr.o build/temp.linux-x86_64-3.5/errors.o build/temp.linux-x86_64-3.5/capsule.o build/temp.linux-x86_64-3.5/constants.o build/temp.linux-x86_64-3.5/utils.o build/temp.linux-x86_64-3.5/callouts.o build/temp.linux-x86_64-3.5/callout_closure.o build/temp.linux-x86_64-3.5/callout_manager.o build/temp.linux-x86_64-3.5/library_handle.o build/temp.linux-x86_64-3.5/callout_handle.o build/temp.linux-x86_64-3.5/lease4.o build/temp.linux-x86_64-3.5/pkt4.o build/temp.linux-x86_64-3.5/subnet4.o build/temp.linux-x86_64-3.5/option.o build/temp.linux-x86_64-3.5/srv_config.o -L/usr/local/lib -lkea-exceptions -lkea-log -lkea-hooks -lkea-dhcpsrv -lffi -o build/lib.linux-x86_64-3.5/ kea.cpython-35m-x86_64-linux-gnu.so cd keamodule && python3 setup.py install running install running build running build_ext running install_lib copying build/lib.linux-x86_64-3.5/kea.cpython-35m-x86_64-linux-gnu.so -> /usr/local/lib/python3.5/dist-packages running install_egg_info Writing /usr/local/lib/python3.5/dist-packages/kea-1.0.egg-info Removing intermediate container 7eebf2ac0919 ---> d1d1e2e08adf Step 6/10 : FROM debian:stretch-slim ---> 2b343cb3b772 Step 7/10 : ENV DEBIAN_FRONTEND noninteractive ---> Using cache ---> f35337a5b422 Step 8/10 : RUN apt-get update -y && apt-get -y install procps socat python3 libpython3.5 liblog4cplus-1.1-9 libboost-system1.62.0 libffi6 libpq5 libmariadb2 ---> Using cache ---> f760a073f805 Step 9/10 : COPY --from=build /dist /usr/local ---> 99ab3088493c Step 10/10 : RUN ldconfig ---> Running in f8034e9bb43d Removing intermediate container f8034e9bb43d ---> 92583087c223 Successfully built 92583087c223 Successfully tagged kea:1.8.2

And I am definitely using kea 1.8.2:

@.***:~/play/kea_python$ docker run --rm kea:1.8.2 /usr/local/sbin/kea-dhcp4 -V 1.8.2 tarball linked with: log4cplus 1.1.2 OpenSSL 1.1.0l 10 Sep 2019 database: MySQL backend 9.3, library 5.5.1 PostgreSQL backend 6.1, library 90617 Memfile backend 2.1

I will have to do some more on this after work :-).

On Wed, Apr 7, 2021 at 7:22 AM Dave Cole @.***> wrote:

Ahhh. I just realised. They have changed some more API with 1.8.0.

I need to add some more conditional compilation to handle the changes. I am building 1.8.2 at the moment so I can adapt the code to the new API.

On Wed, Apr 7, 2021 at 7:14 AM Dave Cole @.***> wrote:

I was wondering how bad my initialisation method for those smart pointers was. The C++ pointers live in memory allocated on the C heap (by the Python interpreter), so C++ does not get an opportunity to initialise them.

I will see if I can initialise them manually in C++ after work today.

On Wed, Apr 7, 2021 at 12:19 AM Derek J. Lambert < @.***> wrote:

The module is failing compilation in lease_mgr.cc with Python 3.9 and Kea 1.8.0 under Ubuntu 21.04 on aarch64:

@.***:~/src/kea_python/keamodule$ python3 setup.py install

running install

running build

running build_ext

building 'kea' extension

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_closure.cc -o build/temp.linux-aarch64-3.9/callout_closure.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_handle.cc -o build/temp.linux-aarch64-3.9/callout_handle.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_manager.cc -o build/temp.linux-aarch64-3.9/callout_manager.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callouts.cc -o build/temp.linux-aarch64-3.9/callouts.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c capsule.cc -o build/temp.linux-aarch64-3.9/capsule.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_mgr.cc -o build/temp.linux-aarch64-3.9/cfg_mgr.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_subnets4.cc -o build/temp.linux-aarch64-3.9/cfg_subnets4.o

cfg_subnets4.cc: In function ‘PyObject* CfgSubnets4_from_ptr(isc::dhcp::CfgSubnets4Ptr&)’:

cfg_subnets4.cc:181:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

181 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from cfg_subnets4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c constants.cc -o build/temp.linux-aarch64-3.9/constants.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c errors.cc -o build/temp.linux-aarch64-3.9/errors.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c kea.cc -o build/temp.linux-aarch64-3.9/kea.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease4.cc -o build/temp.linux-aarch64-3.9/lease4.o

lease4.cc: In function ‘PyObject* Lease4_from_handle(isc::dhcp::Lease4Ptr&)’:

lease4.cc:452:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

452 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from lease4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease_mgr.cc -o build/temp.linux-aarch64-3.9/lease_mgr.o

lease_mgr.cc: In function ‘PyObject LeaseMgr_deleteLease(LeaseMgrObject, PyObject*)’:

lease_mgr.cc:198:69: error: no matching function for call to ‘isc::dhcp::LeaseMgr::deleteLease(isc::asiolink::IOAddress)’

198 | bool result = self->mgr->deleteLease(IOAddress(string(addr)));

  |                                                                     ^

In file included from keamodule.h:9,

             from lease_mgr.cc:1:

/usr/include/kea/dhcpsrv/lease_mgr.h:554:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease4Ptr&)’

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:554:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease4Ptr&’ {aka ‘const boost::shared_ptr&’}

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease6Ptr&)’

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease6Ptr&’ {aka ‘const boost::shared_ptr&’}

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

Very excited to get this working. My experience with C++ is close to zero, but I'm happy to provide additional information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davejohncole/kea_python/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUSDEHK6PT4OVFKHZRFXQDTHMJ6DANCNFSM42O2WD7Q .

davejohncole commented 3 years ago

I have not tried 1.8.0, but have built 1.82 fine on ubuntu 21.04 without the errors you see, The thing that worries me is I am seeing the same warnings about the way I am clearing the shared_ptr instances. Something must have changed with the version of boost on ubuntu 21.04.

I know one way to fix the code to avoid the warnings, but it is really ugly. The point of shared_ptr is to make use of RAII and automatically initialise and cleanup references with C++ code. That functionality is not available to me because the memory where I am storing the shared_ptr is managed by the Python interpreter in C. I always worried about using memset() to clear out the random memory in the shared_ptr allocated in C, but it was fine for earlier versions of the library. It is not fine anymore.

The ugly way I was thinking of fixing it is to change: // lease4.cc typedef struct { PyObject_HEAD

isc::dhcp::Lease4Ptr ptr;

} Lease4Object;

to this: // lease4.cc typedef struct { PyObject_HEAD

isc::dhcp::Lease4Ptr *ptr;

} Lease4Object;

And then allocate a shared_ptr on the C++ heap. This will allow the constructor and destructor to run when I new/delete the shared_ptr. It makes the code really ugly though - for example: static PyObject Lease4_get_client_id(Lease4Object self, void closure) { try { if (!(self->ptr)->clientid) { Py_RETURN_NONE; } return (PyUnicode_FromString((*self->ptr)->clientid->toText().c_str())); } catch (const exception &e) { PyErr_SetString(PyExc_TypeError, e.what()); return (0); } }

I am going to keep looking for an alternative to this because I really do not like it...

In case you are interested, the two Dockerfile I used to make it work with ubuntu 21.04 are - for the development image: FROM ubuntu:21.04 ARG VER ENV DEBIAN_FRONTEND noninteractive

WORKDIR /source COPY kea-$VER.tar.gz .

RUN apt-get update -y \ && apt-get -y install --no-install-recommends \ procps \ make \ socat \ g++ \ gdb \ libffi-dev \ libboost-dev \ libboost-system-dev \ libssl-dev \ liblog4cplus-dev \ libpython3-dev \ python3 \ python3-distutils \ python3-nose \ libpq-dev postgresql-server-dev-all \ libmariadb-dev libmariadb-dev-compat \ && tar xzf kea-$VER.tar.gz \ && cd kea-$VER \ && ./configure \ --enable-shell \ --with-site-packages=/usr/lib/python3/dist-packages \ --enable-perfdhcp \ --enable-generate-messages \ --with-mysql=/usr/bin/mysql_config \ --with-pgsql=/usr/bin/pg_config \ && make \ && make install \ && ldconfig

And then for the final image: ARG VER FROM kea-dev:1.8.2u AS build

WORKDIR /source COPY . .

RUN apt-get -y install python3-distutils \ && make clean install \ && mkdir /dist \ && cd /usr/local \ && find lib -name *.so* | tar cf - -T - | (cd /dist; tar xf -) \ && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -)

FROM ubuntu:21.04 ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y \ && apt-get -y install \ procps \ socat \ python3 \ libpython3.9 \ liblog4cplus-2.0.5 \ libboost-system1.74.0 \ libffi8ubuntu1 \ libpq5 \ libmariadb3

COPY --from=build /dist /usr/local

RUN ldconfig

On Wed, Apr 7, 2021 at 7:47 PM Dave Cole @.***> wrote:

I am now building the code with 21.04 from here https://hub.docker.com/_/ubuntu - it takes a while, but I will get there.

If/when I make any progress I will send another message.

On Wed, Apr 7, 2021 at 8:20 AM Dave Cole @.***> wrote:

Hmmm... I am going to need to download a different docker image to replicate your problem. It compiled fine with centos:7.

@.***:~/play/kea_python$ VER=1.8.2 make build-kea docker build --build-arg VER=1.8.2 --tag kea:1.8.2 . Sending build context to Docker daemon 106.5MB Step 1/10 : ARG VER Step 2/10 : FROM kea-dev:$VER AS build ---> 9dfca1aa45c8 Step 3/10 : WORKDIR /source ---> Running in 3cc96ed0fd32 Removing intermediate container 3cc96ed0fd32 ---> 1775546f3767 Step 4/10 : COPY . . ---> 5d27b97385b5 Step 5/10 : RUN make clean install && mkdir /dist && cd /usr/local && find lib -name *.so* | tar cf - -T - | (cd /dist; tar xf -) && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -) ---> Running in 7eebf2ac0919 touch settings.mk cd keahook && make clean make[1]: Entering directory '/source/keahook' rm -f libkea_python.so make[1]: Leaving directory '/source/keahook' cd keamodule && rm -rf build rm -f settings.mk dhcpdb_create.mysql.sql python3 settings.py cd keahook && make libkea_python.so make[1]: Entering directory '/source/keahook' g++ -std=c++11 -I /usr/local/include/kea -I /usr/include/python3.5m -L /usr/local/lib -fpic -shared -o libkea_python.so \ load_unload.cc messages.cc version.cc \ -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions make[1]: Leaving directory '/source/keahook' cd keahook && make install make[1]: Entering directory '/source/keahook' install libkea_python.so /usr/local/lib/kea/hooks make[1]: Leaving directory '/source/keahook' cd keamodule && python3 setup.py build running build running build_ext building 'kea' extension creating build creating build/temp.linux-x86_64-3.5 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c kea.cc -o build/temp.linux-x86_64-3.5/kea.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host.cc -o build/temp.linux-x86_64-3.5/host.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host_reservation_parser4.cc -o build/temp.linux-x86_64-3.5/host_reservation_parser4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c host_mgr.cc -o build/temp.linux-x86_64-3.5/host_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c cfg_mgr.cc -o build/temp.linux-x86_64-3.5/cfg_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c cfg_subnets4.cc -o build/temp.linux-x86_64-3.5/cfg_subnets4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c lease_mgr.cc -o build/temp.linux-x86_64-3.5/lease_mgr.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c errors.cc -o build/temp.linux-x86_64-3.5/errors.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c capsule.cc -o build/temp.linux-x86_64-3.5/capsule.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c constants.cc -o build/temp.linux-x86_64-3.5/constants.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c utils.cc -o build/temp.linux-x86_64-3.5/utils.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callouts.cc -o build/temp.linux-x86_64-3.5/callouts.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_closure.cc -o build/temp.linux-x86_64-3.5/callout_closure.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_manager.cc -o build/temp.linux-x86_64-3.5/callout_manager.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c library_handle.cc -o build/temp.linux-x86_64-3.5/library_handle.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c callout_handle.cc -o build/temp.linux-x86_64-3.5/callout_handle.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c lease4.cc -o build/temp.linux-x86_64-3.5/lease4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c pkt4.cc -o build/temp.linux-x86_64-3.5/pkt4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c subnet4.cc -o build/temp.linux-x86_64-3.5/subnet4.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c option.cc -o build/temp.linux-x86_64-3.5/option.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/kea -I/usr/include/python3.5m -c srv_config.cc -o build/temp.linux-x86_64-3.5/srv_config.o -std=c++11 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ creating build/lib.linux-x86_64-3.5 x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.5-ipWR6Y/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/kea.o build/temp.linux-x86_64-3.5/host.o build/temp.linux-x86_64-3.5/host_reservation_parser4.o build/temp.linux-x86_64-3.5/host_mgr.o build/temp.linux-x86_64-3.5/cfg_mgr.o build/temp.linux-x86_64-3.5/cfg_subnets4.o build/temp.linux-x86_64-3.5/lease_mgr.o build/temp.linux-x86_64-3.5/errors.o build/temp.linux-x86_64-3.5/capsule.o build/temp.linux-x86_64-3.5/constants.o build/temp.linux-x86_64-3.5/utils.o build/temp.linux-x86_64-3.5/callouts.o build/temp.linux-x86_64-3.5/callout_closure.o build/temp.linux-x86_64-3.5/callout_manager.o build/temp.linux-x86_64-3.5/library_handle.o build/temp.linux-x86_64-3.5/callout_handle.o build/temp.linux-x86_64-3.5/lease4.o build/temp.linux-x86_64-3.5/pkt4.o build/temp.linux-x86_64-3.5/subnet4.o build/temp.linux-x86_64-3.5/option.o build/temp.linux-x86_64-3.5/srv_config.o -L/usr/local/lib -lkea-exceptions -lkea-log -lkea-hooks -lkea-dhcpsrv -lffi -o build/lib.linux-x86_64-3.5/ kea.cpython-35m-x86_64-linux-gnu.so cd keamodule && python3 setup.py install running install running build running build_ext running install_lib copying build/lib.linux-x86_64-3.5/kea.cpython-35m-x86_64-linux-gnu.so -> /usr/local/lib/python3.5/dist-packages running install_egg_info Writing /usr/local/lib/python3.5/dist-packages/kea-1.0.egg-info Removing intermediate container 7eebf2ac0919 ---> d1d1e2e08adf Step 6/10 : FROM debian:stretch-slim ---> 2b343cb3b772 Step 7/10 : ENV DEBIAN_FRONTEND noninteractive ---> Using cache ---> f35337a5b422 Step 8/10 : RUN apt-get update -y && apt-get -y install procps socat python3 libpython3.5 liblog4cplus-1.1-9 libboost-system1.62.0 libffi6 libpq5 libmariadb2 ---> Using cache ---> f760a073f805 Step 9/10 : COPY --from=build /dist /usr/local ---> 99ab3088493c Step 10/10 : RUN ldconfig ---> Running in f8034e9bb43d Removing intermediate container f8034e9bb43d ---> 92583087c223 Successfully built 92583087c223 Successfully tagged kea:1.8.2

And I am definitely using kea 1.8.2:

@.***:~/play/kea_python$ docker run --rm kea:1.8.2 /usr/local/sbin/kea-dhcp4 -V 1.8.2 tarball linked with: log4cplus 1.1.2 OpenSSL 1.1.0l 10 Sep 2019 database: MySQL backend 9.3, library 5.5.1 PostgreSQL backend 6.1, library 90617 Memfile backend 2.1

I will have to do some more on this after work :-).

On Wed, Apr 7, 2021 at 7:22 AM Dave Cole @.***> wrote:

Ahhh. I just realised. They have changed some more API with 1.8.0.

I need to add some more conditional compilation to handle the changes. I am building 1.8.2 at the moment so I can adapt the code to the new API.

On Wed, Apr 7, 2021 at 7:14 AM Dave Cole @.***> wrote:

I was wondering how bad my initialisation method for those smart pointers was. The C++ pointers live in memory allocated on the C heap (by the Python interpreter), so C++ does not get an opportunity to initialise them.

I will see if I can initialise them manually in C++ after work today.

On Wed, Apr 7, 2021 at 12:19 AM Derek J. Lambert < @.***> wrote:

The module is failing compilation in lease_mgr.cc with Python 3.9 and Kea 1.8.0 under Ubuntu 21.04 on aarch64:

@.***:~/src/kea_python/keamodule$ python3 setup.py install

running install

running build

running build_ext

building 'kea' extension

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_closure.cc -o build/temp.linux-aarch64-3.9/callout_closure.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_handle.cc -o build/temp.linux-aarch64-3.9/callout_handle.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callout_manager.cc -o build/temp.linux-aarch64-3.9/callout_manager.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c callouts.cc -o build/temp.linux-aarch64-3.9/callouts.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c capsule.cc -o build/temp.linux-aarch64-3.9/capsule.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_mgr.cc -o build/temp.linux-aarch64-3.9/cfg_mgr.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c cfg_subnets4.cc -o build/temp.linux-aarch64-3.9/cfg_subnets4.o

cfg_subnets4.cc: In function ‘PyObject* CfgSubnets4_from_ptr(isc::dhcp::CfgSubnets4Ptr&)’:

cfg_subnets4.cc:181:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

181 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from cfg_subnets4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::CfgSubnets4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c constants.cc -o build/temp.linux-aarch64-3.9/constants.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c errors.cc -o build/temp.linux-aarch64-3.9/errors.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c kea.cc -o build/temp.linux-aarch64-3.9/kea.o

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease4.cc -o build/temp.linux-aarch64-3.9/lease4.o

lease4.cc: In function ‘PyObject* Lease4_from_handle(isc::dhcp::Lease4Ptr&)’:

lease4.cc:452:49: warning: ‘void memset(void, int, size_t)’ clearing an object of type ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

452 | memset(&self->ptr, 0 , sizeof(self->ptr));

  |                                                 ^

In file included from /usr/include/boost/shared_ptr.hpp:17,

             from /usr/include/kea/cc/data.h:14,

             from /usr/include/kea/hooks/library_handle.h:11,

             from /usr/include/kea/hooks/callout_handle.h:11,

             from /usr/include/kea/hooks/hooks.h:10,

             from keamodule.h:3,

             from lease4.cc:1:

/usr/include/boost/smart_ptr/shared_ptr.hpp:335:25: note: ‘isc::dhcp::Lease4Ptr’ {aka ‘class boost::shared_ptr’} declared here

335 | template class shared_ptr

  |                         ^~~~~~~~~~

aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-a27J0m/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_GETLEASES4_HOSTNAME -I/usr/include/kea -I/usr/include/python3.9 -c lease_mgr.cc -o build/temp.linux-aarch64-3.9/lease_mgr.o

lease_mgr.cc: In function ‘PyObject LeaseMgr_deleteLease(LeaseMgrObject, PyObject*)’:

lease_mgr.cc:198:69: error: no matching function for call to ‘isc::dhcp::LeaseMgr::deleteLease(isc::asiolink::IOAddress)’

198 | bool result = self->mgr->deleteLease(IOAddress(string(addr)));

  |                                                                     ^

In file included from keamodule.h:9,

             from lease_mgr.cc:1:

/usr/include/kea/dhcpsrv/lease_mgr.h:554:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease4Ptr&)’

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:554:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease4Ptr&’ {aka ‘const boost::shared_ptr&’}

554 | virtual bool deleteLease(const Lease4Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:18: note: candidate: ‘virtual bool isc::dhcp::LeaseMgr::deleteLease(const Lease6Ptr&)’

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                  ^~~~~~~~~~~

/usr/include/kea/dhcpsrv/lease_mgr.h:564:47: note: no known conversion for argument 1 from ‘isc::asiolink::IOAddress’ to ‘const Lease6Ptr&’ {aka ‘const boost::shared_ptr&’}

564 | virtual bool deleteLease(const Lease6Ptr& lease) = 0;

  |                              ~~~~~~~~~~~~~~~~~^~~~~

error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

Very excited to get this working. My experience with C++ is close to zero, but I'm happy to provide additional information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davejohncole/kea_python/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUSDEHK6PT4OVFKHZRFXQDTHMJ6DANCNFSM42O2WD7Q .

djlambert commented 3 years ago

I give the Docker containers a try. I was just compiling locally before. Also using aarch64 (Raspberry Pi 4) instead of x86_64, not sure if that'd make a difference

djlambert commented 3 years ago

I can build the containers ok (had to remove the && make clean install \ line), but have issues trying to build inside kea-dev. It's looking in /usr/include/kea instead of /usr/local/include/kea for the headers.

admin@h-tst-smbdc-01:~/src/kea_python$ VER=1.8.2 make run-kea-dev
docker network ls | grep -q kea || docker network create --subnet=172.28.5.0/24 --ip-range=172.28.5.0/24 kea
docker run --rm -it --network kea -e LANG=C.UTF-8 --privileged -v`pwd`:/workdir --name kea-dev kea-dev:1.8.2 bash

root@47ce7edf68a3:/source# cd /workdir/

root@47ce7edf68a3:/workdir# make build-hook
cd keahook && rm -f libkea_python.so && make install
make[1]: Entering directory '/workdir/keahook'
g++ -I /usr/include/kea -I /usr/include/python3.9 -L /usr/lib -fpic -shared -o libkea_python.so \
    load_unload.cc messages.cc version.cc \
    -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions
load_unload.cc:1:10: fatal error: hooks/hooks.h: No such file or directory
    1 | #include <hooks/hooks.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
messages.cc:4:10: fatal error: log/message_types.h: No such file or directory
    4 | #include <log/message_types.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
version.cc:1:10: fatal error: hooks/hooks.h: No such file or directory
    1 | #include <hooks/hooks.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:2: libkea_python.so] Error 1
make[1]: Leaving directory '/workdir/keahook'
make: *** [Makefile:40: build-hook] Error 2
root@47ce7edf68a3:/workdir# make build-module
cd keamodule && rm -rf build && python3 setup.py install
Traceback (most recent call last):
  File "/workdir/keamodule/setup.py", line 18, in <module>
    define_macros=calc_macros(),
  File "/workdir/keamodule/setup.py", line 6, in calc_macros
    config_h = open('/usr/include/kea/config.h').read()
FileNotFoundError: [Errno 2] No such file or directory: '/usr/include/kea/config.h'
make: *** [Makefile:43: build-module] Error 1

DockerfileDev:

FROM ubuntu:21.04
ARG VER
ENV DEBIAN_FRONTEND noninteractive

WORKDIR /source
COPY kea-$VER.tar.gz .

RUN apt-get update -y \
    && apt-get -y install --no-install-recommends \
        procps \
        make \
        socat \
        g++ \
        gdb \
        libffi-dev \
        libboost-dev \
        libboost-system-dev \
        libssl-dev \
        liblog4cplus-dev \
        libpython3-dev \
        python3 \
        python3-distutils \
        python3-nose \
        libpq-dev \
        postgresql-server-dev-all \
        libmariadb-dev \
        libmariadb-dev-compat \
    && tar xzf kea-$VER.tar.gz \
    && cd kea-$VER \
    && ./configure \
        --enable-shell \
        --with-site-packages=/usr/lib/python3/dist-packages \
        --enable-perfdhcp \
        --enable-generate-messages \
        --with-mysql=/usr/bin/mysql_config \
        --with-pgsql=/usr/bin/pg_config \
    && make \
    && make install \
    && ldconfig

Dockerfile:

ARG VER
FROM kea-dev:$VER AS build

WORKDIR /source
COPY . .

RUN apt-get -y install python3-distutils \
    && mkdir /dist \
    && cd /usr/local \
    && find lib -name \*.so\* | tar cf - -T - | (cd /dist; tar xf -) \
    && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -)

FROM ubuntu:21.04
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y \
    && apt-get -y install \
        procps \
        socat \
        python3 \
        libpython3.9 \
        liblog4cplus-2.0.5 \
        libboost-system1.74.0 \
        libffi8ubuntu1 \
        libpq5 \
        libmariadb3

COPY --from=build /dist /usr/local

RUN ldconfig
davejohncole commented 3 years ago

Sorry for being unresponsive. Work has been a bit insane lately.

I remembered that in the past I had worked with someone a lot more C++ savvy than me. I asked the question about whether my ugly solution was the only option available and he responded by telling me a C++ feature I was not aware of: placement new.

https://en.cppreference.com/w/cpp/language/new

Placement new lets you construct an object in already allocated memory. This is exactly what my code requires.

I am trying a modification to all of my tp_new and tp_dealloc functions along these lines: static PyObject Lease4_new(PyTypeObject type, PyObject args, PyObject kwds) { Lease4Object self; self = (Lease4Object ) type->tp_alloc(type, 0); if (self) { new(&self->ptr) Lease4Ptr; } return ((PyObject *) self); }

and static void Lease4_dealloc(Lease4Object self) { self->ptr.~Lease4Ptr(); Py_TYPE(self)->tp_free((PyObject ) self); }

The good news is the compilation is now completely clean. I need to do more testing before committing and pushing.

Thanks for your patience.

On Thu, Apr 22, 2021 at 2:47 AM Derek J. Lambert @.***> wrote:

I can build the containers ok (had to remove the && make clean install \ line), but have issues trying to build inside kea-dev. It's looking in /usr/include/kea instead of /usr/local/include/kea for the headers.

@.***:~/src/kea_python$ VER=1.8.2 make run-kea-dev docker network ls | grep -q kea || docker network create --subnet=172.28.5.0/24 --ip-range=172.28.5.0/24 kea docker run --rm -it --network kea -e LANG=C.UTF-8 --privileged -vpwd:/workdir --name kea-dev kea-dev:1.8.2 bash

@.***:/source# cd /workdir/

@.:/workdir# make build-hook cd keahook && rm -f libkea_python.so && make install make[1]: Entering directory '/workdir/keahook' g++ -I /usr/include/kea -I /usr/include/python3.9 -L /usr/lib -fpic -shared -o libkea_python.so \ load_unload.cc messages.cc version.cc \ -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions load_unload.cc:1:10: fatal error: hooks/hooks.h: No such file or directory 1 | #include <hooks/hooks.h> | ^~~~~~~ compilation terminated. messages.cc:4:10: fatal error: log/message_types.h: No such file or directory 4 | #include <log/message_types.h> | ^~~~~ compilation terminated. version.cc:1:10: fatal error: hooks/hooks.h: No such file or directory 1 | #include <hooks/hooks.h> | ^~~~~~~ compilation terminated. make[1]: [Makefile:2: libkea_python.so] Error 1 make[1]: Leaving directory '/workdir/keahook' make: [Makefile:40: build-hook] Error 2 @.:/workdir# make build-module cd keamodule && rm -rf build && python3 setup.py install Traceback (most recent call last): File "/workdir/keamodule/setup.py", line 18, in define_macros=calc_macros(), File "/workdir/keamodule/setup.py", line 6, in calc_macros config_h = open('/usr/include/kea/config.h').read() FileNotFoundError: [Errno 2] No such file or directory: '/usr/include/kea/config.h' make: *** [Makefile:43: build-module] Error 1

DockerfileDev:

FROM ubuntu:21.04 ARG VER ENV DEBIAN_FRONTEND noninteractive

WORKDIR /source COPY kea-$VER.tar.gz .

RUN apt-get update -y \ && apt-get -y install --no-install-recommends \ procps \ make \ socat \ g++ \ gdb \ libffi-dev \ libboost-dev \ libboost-system-dev \ libssl-dev \ liblog4cplus-dev \ libpython3-dev \ python3 \ python3-distutils \ python3-nose \ libpq-dev \ postgresql-server-dev-all \ libmariadb-dev \ libmariadb-dev-compat \ && tar xzf kea-$VER.tar.gz \ && cd kea-$VER \ && ./configure \ --enable-shell \ --with-site-packages=/usr/lib/python3/dist-packages \ --enable-perfdhcp \ --enable-generate-messages \ --with-mysql=/usr/bin/mysql_config \ --with-pgsql=/usr/bin/pg_config \ && make \ && make install \ && ldconfig

Dockerfile:

ARG VER FROM kea-dev:$VER AS build

WORKDIR /source COPY . .

RUN apt-get -y install python3-distutils \ && mkdir /dist \ && cd /usr/local \ && find lib -name *.so* | tar cf - -T - | (cd /dist; tar xf -) \ && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -)

FROM ubuntu:21.04 ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y \ && apt-get -y install \ procps \ socat \ python3 \ libpython3.9 \ liblog4cplus-2.0.5 \ libboost-system1.74.0 \ libffi8ubuntu1 \ libpq5 \ libmariadb3

COPY --from=build /dist /usr/local

RUN ldconfig

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davejohncole/kea_python/issues/1#issuecomment-824207058, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUSDEFZSUFFEP3GAPZYYZLTJ36RJANCNFSM42O2WD7Q .

davejohncole commented 3 years ago

Alright I am happy with the results of my testing of those changes.

I have updated the default version of Kea to 1.8.2 in my documentation and Makefile, and have switched to Ubuntu 21.04 as the base Docker image for development.

I have also merged the host-cmds branch back into master. This adds a simple re-implementation of the https://kea.readthedocs.io/en/kea-1.8.2/arm/hooks.html#available-hooks-libraries hook library that is only available to paid customers. I do not have access to the source, so I implemented the commands by looking at the documentation at https://kea.readthedocs.io/en/kea-1.8.2/arm/hooks.html#host-cmds-host-commands.

On Sat, Apr 24, 2021 at 10:18 AM Dave Cole @.***> wrote:

Sorry for being unresponsive. Work has been a bit insane lately.

I remembered that in the past I had worked with someone a lot more C++ savvy than me. I asked the question about whether my ugly solution was the only option available and he responded by telling me a C++ feature I was not aware of: placement new.

https://en.cppreference.com/w/cpp/language/new

Placement new lets you construct an object in already allocated memory. This is exactly what my code requires.

I am trying a modification to all of my tp_new and tp_dealloc functions along these lines: static PyObject Lease4_new(PyTypeObject type, PyObject args, PyObject kwds) { Lease4Object self; self = (Lease4Object ) type->tp_alloc(type, 0); if (self) { new(&self->ptr) Lease4Ptr; } return ((PyObject *) self); }

and static void Lease4_dealloc(Lease4Object self) { self->ptr.~Lease4Ptr(); Py_TYPE(self)->tp_free((PyObject ) self); }

The good news is the compilation is now completely clean. I need to do more testing before committing and pushing.

Thanks for your patience.

On Thu, Apr 22, 2021 at 2:47 AM Derek J. Lambert @.***> wrote:

I can build the containers ok (had to remove the && make clean install \ line), but have issues trying to build inside kea-dev. It's looking in /usr/include/kea instead of /usr/local/include/kea for the headers.

@.***:~/src/kea_python$ VER=1.8.2 make run-kea-dev docker network ls | grep -q kea || docker network create --subnet=172.28.5.0/24 --ip-range=172.28.5.0/24 kea docker run --rm -it --network kea -e LANG=C.UTF-8 --privileged -vpwd:/workdir --name kea-dev kea-dev:1.8.2 bash

@.***:/source# cd /workdir/

@.:/workdir# make build-hook cd keahook && rm -f libkea_python.so && make install make[1]: Entering directory '/workdir/keahook' g++ -I /usr/include/kea -I /usr/include/python3.9 -L /usr/lib -fpic -shared -o libkea_python.so \ load_unload.cc messages.cc version.cc \ -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions load_unload.cc:1:10: fatal error: hooks/hooks.h: No such file or directory 1 | #include <hooks/hooks.h> | ^~~~~~~ compilation terminated. messages.cc:4:10: fatal error: log/message_types.h: No such file or directory 4 | #include <log/message_types.h> | ^~~~~ compilation terminated. version.cc:1:10: fatal error: hooks/hooks.h: No such file or directory 1 | #include <hooks/hooks.h> | ^~~~~~~ compilation terminated. make[1]: [Makefile:2: libkea_python.so] Error 1 make[1]: Leaving directory '/workdir/keahook' make: [Makefile:40: build-hook] Error 2 @.:/workdir# make build-module cd keamodule && rm -rf build && python3 setup.py install Traceback (most recent call last): File "/workdir/keamodule/setup.py", line 18, in define_macros=calc_macros(), File "/workdir/keamodule/setup.py", line 6, in calc_macros config_h = open('/usr/include/kea/config.h').read() FileNotFoundError: [Errno 2] No such file or directory: '/usr/include/kea/config.h' make: *** [Makefile:43: build-module] Error 1

DockerfileDev:

FROM ubuntu:21.04 ARG VER ENV DEBIAN_FRONTEND noninteractive

WORKDIR /source COPY kea-$VER.tar.gz .

RUN apt-get update -y \ && apt-get -y install --no-install-recommends \ procps \ make \ socat \ g++ \ gdb \ libffi-dev \ libboost-dev \ libboost-system-dev \ libssl-dev \ liblog4cplus-dev \ libpython3-dev \ python3 \ python3-distutils \ python3-nose \ libpq-dev \ postgresql-server-dev-all \ libmariadb-dev \ libmariadb-dev-compat \ && tar xzf kea-$VER.tar.gz \ && cd kea-$VER \ && ./configure \ --enable-shell \ --with-site-packages=/usr/lib/python3/dist-packages \ --enable-perfdhcp \ --enable-generate-messages \ --with-mysql=/usr/bin/mysql_config \ --with-pgsql=/usr/bin/pg_config \ && make \ && make install \ && ldconfig

Dockerfile:

ARG VER FROM kea-dev:$VER AS build

WORKDIR /source COPY . .

RUN apt-get -y install python3-distutils \ && mkdir /dist \ && cd /usr/local \ && find lib -name *.so* | tar cf - -T - | (cd /dist; tar xf -) \ && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -)

FROM ubuntu:21.04 ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y \ && apt-get -y install \ procps \ socat \ python3 \ libpython3.9 \ liblog4cplus-2.0.5 \ libboost-system1.74.0 \ libffi8ubuntu1 \ libpq5 \ libmariadb3

COPY --from=build /dist /usr/local

RUN ldconfig

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davejohncole/kea_python/issues/1#issuecomment-824207058, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUSDEFZSUFFEP3GAPZYYZLTJ36RJANCNFSM42O2WD7Q .

djlambert commented 3 years ago

Finally had a chance to get back to this.

The module and hook are compiling successfully for me now! Thanks!

davejohncole commented 3 years ago

Thanks for getting back to me. I am interested to hear how you get along with using the module.