Skip to contentSkip to conversation

ODB: C++ Object-Relational Mapping (ORM): New packages.

PATCH New Adam Duskett 2 participants 6 messages Dec 28, 2017 – Apr 28, 2018

lore
Share & tools
lore
#0 lore raw

cover ODB: C++ Object-Relational Mapping (ORM): New packages.

ODB is an open-source, cross-platform, and cross-database object-relational mapping (ORM) system for C++. It allows you to persist C++ objects to a relational database without having to deal with tables, columns, or SQL and without manually writing any mapping code. ODB supports MySQL, SQLite, PostgreSQL, Oracle, and Microsoft SQL Server relational databases as well as C++98/03 and C++11 language standards. It also comes with optional profiles for Boost and Qt which allow you to seamlessly use value types, containers, and smart pointers from these libraries in your persistent C++ classes.

There are three main components to use ODB (and a single dependency):
- libcutl: This library is ODB's only dependency.
- ODB: This is a compiler that takes a specially crafted c++ header file and auto-generates a schema that works with libodb and the subsequent libodb-database library.

It would be used as such:
odb -d <database> --generate-query --generate-schema file.hxx

- libodb: This package contains the common ODB runtime library. Every application that includes code generated by the ODB compiler will need to link to this library.

- libodb-pgsql: This package contains the PostgreSQL ODB runtime library. Every application that includes code generated for the PostgreSQL database will need to link to this library.

I am only providing libodb-pgsql as that is the only one I personally need. There is also support for mysql, sqlite, mssql, and oracle as well.

Also boost and qt libraries are avaiable if anybody so wishes to add them.

Adam Duskett (4):
libcutl: new package
ODB: New package
libodb: new package
libodb-pgsql: new package

 DEVELOPERS                                         |   4 +
 package/Config.in                                  |   2 +
 package/libcutl/libcutl.hash                       |   6 +
 package/libcutl/libcutl.mk                         |  15 +
 package/libodb-pgsql/Config.in                     |  15 +
 package/libodb-pgsql/libodb-pgsql.hash             |   6 +
 package/libodb-pgsql/libodb-pgsql.mk               |  16 +
 package/libodb/Config.in                           |  12 +
 package/libodb/libodb.hash                         |   6 +
 package/libodb/libodb.mk                           |  16 +
 .../odb/0001-make-ODB-compatible-with-GCC-6.patch  | 327 +++++++++++++++++++++
 ...x-bug-in-GCC-6-input_location-translation.patch |  37 +++
 package/odb/odb.hash                               |   6 +
 package/odb/odb.mk                                 |  20 ++
 14 files changed, 488 insertions(+)
 create mode 100644 package/libcutl/libcutl.hash
 create mode 100644 package/libcutl/libcutl.mk
 create mode 100644 package/libodb-pgsql/Config.in
 create mode 100644 package/libodb-pgsql/libodb-pgsql.hash
 create mode 100644 package/libodb-pgsql/libodb-pgsql.mk
 create mode 100644 package/libodb/Config.in
 create mode 100644 package/libodb/libodb.hash
 create mode 100644 package/libodb/libodb.mk
 create mode 100644 package/odb/0001-make-ODB-compatible-with-GCC-6.patch
 create mode 100644 package/odb/0002-Fix-bug-in-GCC-6-input_location-translation.patch
 create mode 100644 package/odb/odb.hash
 create mode 100644 package/odb/odb.mk
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/4 libcutl: new package

libcutl is distributed in source code and includes the standard autotools build system as well as the VC++ project files. It is a dependency for odb.

Because ODB is a host-only package, and no other package depends on libcutl, this package will also be a host-only package.

---
 DEVELOPERS                   |  1 +
 package/libcutl/libcutl.hash |  6 ++++++
 package/libcutl/libcutl.mk   | 15 +++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 package/libcutl/libcutl.hash
 create mode 100644 package/libcutl/libcutl.mk
DEVELOPERS +1 -0
index 9f4f282203..a3d00ef892 100644
@@ -43,6 +43,7 @@ F:	package/gstreamer1/gst1-plugins-ugly/
 F:	package/gstreamer1/gst1-vaapi/
 F:	package/imx-usb-loader/
 F:	package/janus-gateway/
+F:	package/libcutl/
 F:	package/libressl/
 F:	package/libselinux/
 F:	package/libsemanage/
package/libcutl/libcutl.hash new file +6 -0
new file mode 100644
index 0000000000..1e0baa7f6e
@@ -0,0 +1,6 @@
+# From https://www.codesynthesis.com/download/libcutl/1.10/libcutl-1.10.0.tar.bz2.sha1
+sha1	2885b79529f8caeb13687d722f5c114186f56956	libcutl-1.10.0.tar.bz2
+
+# Locally Computed
+sha256	125163c670e372b47d5626d54379ff8fbaded6ccd5db77ac0bf5912a4017121c	libcutl-1.10.0.tar.bz2
+sha256	c7aa98c5af3b67174f16b12a1fed4332a51cd524b82c69e85baa4c2c412da239	LICENSE
package/libcutl/libcutl.mk new file +15 -0
new file mode 100644
index 0000000000..49c05e6019
@@ -0,0 +1,15 @@
+################################################################################
+#
+# libcutl
+#
+################################################################################
+
+LIBCUTL_VERSION_MAJOR = 1.10
+LIBCUTL_VERSION = $(LIBCUTL_VERSION_MAJOR).0
+LIBCUTL_SOURCE = libcutl-$(LIBCUTL_VERSION).tar.bz2
+LIBCUTL_SITE = https://www.codesynthesis.com/download/libcutl/$(LIBCUTL_VERSION_MAJOR)
+LIBCUTL_INSTALL_STAGING = YES
+LIBCUTL_LICENSE = MIT
+LIBCUTL_LICENSE_FILES = LICENSE
+
+$(eval $(host-autotools-package))
Signature · 1 line
2.14.3
#2 lore raw

PATCH 2/4 ODB: New package

In reply to Adam Duskett

ODB is an open-source, cross-platform, and cross-database object-relational mapping (ORM) system for C++. It allows you to persist C++ objects to a relational database without having to deal with tables, columns, or SQL and without manually writing any mapping code.

ODB supports MySQL, SQLite, PostgreSQL, Oracle, and Microsoft SQL Server relational databases as well as C++98/03 and C++11 language standards. It also comes with optional profiles for Boost and Qt which allow you to seamlessly use value types, containers, and smart pointers from these libraries in your persistent C++ classes.

This package is used for auto-generating ODB specific header files into useable code that can be linked against a seperate libodb and a specific libodb database library. As such, it is only needed as a host program and is not user selectable.

---
 DEVELOPERS                                         |   1 +
 .../odb/0001-make-ODB-compatible-with-GCC-6.patch  | 327 +++++++++++++++++++++
 ...x-bug-in-GCC-6-input_location-translation.patch |  37 +++
 package/odb/odb.hash                               |   6 +
 package/odb/odb.mk                                 |  20 ++
 5 files changed, 391 insertions(+)
 create mode 100644 package/odb/0001-make-ODB-compatible-with-GCC-6.patch
 create mode 100644 package/odb/0002-Fix-bug-in-GCC-6-input_location-translation.patch
 create mode 100644 package/odb/odb.hash
 create mode 100644 package/odb/odb.mk
DEVELOPERS +1 -0
index a3d00ef892..f9e25f853c 100644
@@ -49,6 +49,7 @@ F:	package/libselinux/
 F:	package/libsemanage/
 F:	package/libsepol/
 F:	package/nginx-naxsi/
+F:	package/odb/
 F:	package/policycoreutils/
 F:	package/python-mutagen/
 F:	package/restorecond/
package/odb/0001-make-ODB-compatible-with-GCC-6.patch new file +327 -0

327 lines not on this page · raw message

package/odb/0002-Fix-bug-in-GCC-6-input_location-translation.patch new file +37 -0
new file mode 100644
index 0000000000..c2bb37d3c0
@@ -0,0 +1,37 @@
+From ec777147024fde72e4411cc6b1e1e49f4a1d1804 Mon Sep 17 00:00:00 2001
+From: Boris Kolpackov <[email protected]>
+Date: Fri, 23 Dec 2016 10:18:01 +0200
+Subject: [PATCH] Fix bug in GCC 6 input_location translation
+
+From:
+http://dl.fedoraproject.org/pub/fedora/linux/releases/26/Everything/source/tree/Packages/o/odb-2.4.0-19.fc26.src.rpm
+
+Original author: Boris Kolpackov <[email protected]>
+Signed-off-by: Adam Duskett <[email protected]>
+---
+ odb/cxx-lexer.cxx | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/odb/cxx-lexer.cxx b/odb/cxx-lexer.cxx
+index 64df296..ae045d9 100644
+--- a/odb/cxx-lexer.cxx
++++ b/odb/cxx-lexer.cxx
+@@ -106,7 +106,15 @@ next (string& token, tree* node)
+ location_t cxx_pragma_lexer::
+ location () const
+ {
++  // Starting from GCC 6 the input location seem to require the same
++  // translation as what we do in real_source_location().
++  //
++#if BUILDING_GCC_MAJOR >= 6
++  return linemap_resolve_location (
++    line_table, input_location, LRK_MACRO_EXPANSION_POINT, 0);
++#else
+   return input_location;
++#endif
+ }
+ 
+ string cxx_pragma_lexer::
+-- 
+2.14.3
+
package/odb/odb.hash new file +6 -0
new file mode 100644
index 0000000000..773a9c829b
@@ -0,0 +1,6 @@
+# From https://www.codesynthesis.com/products/odb/download.xhtml
+sha1	810fc02e591429ed19f5a2699d144fb611fb121b	odb-2.4.0.tar.bz2
+
+# Locally computed
+sha256	6785154fa98ea3977c8c2ab38cec16c4aa78c2c2039e80cd2908347b1c1d4198	odb-2.4.0.tar.bz2
+sha256	7983b82cb1f1686ac2b55420ded9c0f348f93dd17bf3e048ae3b25c1da51b80e	LICENSE
package/odb/odb.mk new file +20 -0
new file mode 100644
index 0000000000..b6dcfe8e9b
@@ -0,0 +1,20 @@
+################################################################################
+#
+# odb
+#
+################################################################################
+
+ODB_VERSION_MAJOR = 2.4
+ODB_VERSION = $(ODB_VERSION_MAJOR).0
+ODB_SOURCE = odb-$(ODB_VERSION).tar.bz2
+ODB_SITE = https://www.codesynthesis.com/download/odb/$(ODB_VERSION_MAJOR)
+ODB_LICENSE = MIT
+ODB_LICENSE_FILES = LICENSE
+HOST_ODB_DEPENDENCIES = host-libcutl
+
+# Prevent odb from trying to install the gcc plugin into the hosts
+# gcc plugin directory. Instead, this will install the gcc plugin
+# into host/libexec/odb
+HOST_ODB_CONF_OPTS = --with-gcc-plugin-dir=no
+
+$(eval $(host-autotools-package))
Signature · 1 line
2.14.3
#3 lore raw

PATCH 3/4 libodb: new package

In reply to Adam Duskett

This package contains the common ODB runtime library. Every application that includes code generated by the ODB compiler will need to link to this library.

---
 DEVELOPERS                 |  1 +
 package/Config.in          |  1 +
 package/libodb/Config.in   | 12 ++++++++++++
 package/libodb/libodb.hash |  6 ++++++
 package/libodb/libodb.mk   | 16 ++++++++++++++++
 5 files changed, 36 insertions(+)
 create mode 100644 package/libodb/Config.in
 create mode 100644 package/libodb/libodb.hash
 create mode 100644 package/libodb/libodb.mk
DEVELOPERS +1 -0
index f9e25f853c..ca28d0be50 100644
@@ -44,6 +44,7 @@ F:	package/gstreamer1/gst1-vaapi/
 F:	package/imx-usb-loader/
 F:	package/janus-gateway/
 F:	package/libcutl/
+F:	package/libodb/
 F:	package/libressl/
 F:	package/libselinux/
 F:	package/libsemanage/
package/Config.in +1 -0
index bd39a374f0..c7b80af455 100644
@@ -1484,6 +1484,7 @@ menu "Other"
 	source "package/libloki/Config.in"
 	source "package/libnpth/Config.in"
 	source "package/libnspr/Config.in"
+	source "package/libodb/Config.in"
 	source "package/libpfm4/Config.in"
 	source "package/libplatform/Config.in"
 	source "package/libplist/Config.in"
package/libodb/Config.in new file +13 -0
new file mode 100644
index 0000000000..d5481453df
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_LIBODB
+	bool "libodb"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_INSTALL_LIBSTDCPP
+	help
+	  This package contains the common ODB runtime library. Every
+	  application that includes code generated by the ODB compiler
+	  will need to link to this library.
+
+	  https://www.codesynthesis.com/products/odb/
+
+comment "libodb needs a toolchain w/ C++, threads"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
package/libodb/libodb.hash new file +6 -0
new file mode 100644
index 0000000000..cea5b9eda2
@@ -0,0 +1,6 @@
+# From https://www.codesynthesis.com/projects/libcutl/
+sha1	42bd2a8023e338e004711e755eb30bd122b844a6	libodb-2.4.0.tar.bz2
+
+# Locally Computed
+sha256	66a1bb4e8bb6ef60cc79334f8028c4d4de98d87f2ff6f8123b4cfb7751ce0007	libodb-2.4.0.tar.bz2
+sha256	841105a470fc283851c63941510ffd403c726d1910b688f7df95914ab8b1b5a3	LICENSE
package/libodb/libodb.mk new file +16 -0
new file mode 100644
index 0000000000..6aebd14ce9
@@ -0,0 +1,16 @@
+################################################################################
+#
+# libodb
+#
+################################################################################
+
+LIBODB_VERSION_MAJOR = 2.4
+LIBODB_VERSION = $(LIBODB_VERSION_MAJOR).0
+LIBODB_SOURCE = libodb-$(LIBODB_VERSION).tar.bz2
+LIBODB_SITE = https://www.codesynthesis.com/download/odb/$(LIBODB_VERSION_MAJOR)
+LIBODB_INSTALL_STAGING = YES
+LIBODB_LICENSE = MIT
+LIBODB_LICENSE_FILES = LICENSE
+LIBODB_DEPENDENCIES = host-odb
+
+$(eval $(autotools-package))
Signature · 1 line
2.14.3
#4 lore raw

PATCH 4/4 libodb-pgsql: new package

In reply to Adam Duskett

This package contains the PostgreSQL ODB runtime library. Every application that includes code generated for the PostgreSQL database will need to link to this library.

---
 DEVELOPERS                             |  1 +
 package/Config.in                      |  1 +
 package/libodb-pgsql/Config.in         | 15 +++++++++++++++
 package/libodb-pgsql/libodb-pgsql.hash |  6 ++++++
 package/libodb-pgsql/libodb-pgsql.mk   | 16 ++++++++++++++++
 5 files changed, 39 insertions(+)
 create mode 100644 package/libodb-pgsql/Config.in
 create mode 100644 package/libodb-pgsql/libodb-pgsql.hash
 create mode 100644 package/libodb-pgsql/libodb-pgsql.mk
DEVELOPERS +1 -0
index ca28d0be50..eb67a6a023 100644
@@ -45,6 +45,7 @@ F:	package/imx-usb-loader/
 F:	package/janus-gateway/
 F:	package/libcutl/
 F:	package/libodb/
+F:	package/libodb-pgsql/
 F:	package/libressl/
 F:	package/libselinux/
 F:	package/libsemanage/
package/Config.in +1 -0
index c7b80af455..0a8f04af13 100644
@@ -1060,6 +1060,7 @@ menu "Database"
 	source "package/hiredis/Config.in"
 	source "package/kompexsqlite/Config.in"
 	source "package/leveldb/Config.in"
+	source "package/libodb-pgsql/Config.in"
 	source "package/libpqxx/Config.in"
 	source "package/mongodb/Config.in"
 	source "package/mysql/Config.in"
package/libodb-pgsql/Config.in new file +16 -0
new file mode 100644
index 0000000000..28a17a7cee
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_LIBODB_PGSQL
+	bool "libodb-pgsql"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_POSTGRESQL
+	select BR2_PACKAGE_LIBODB
+	help
+	  This package contains the PostgreSQL ODB runtime library.
+	  Every application that includes code generated for the
+	  PostgreSQL database will need to link to this library.
+
+	  https://www.codesynthesis.com/products/odb/
+
+comment "libodb-pgsql needs a toolchain w/ C++, threads"
+	depends on BR2_PACKAGE_POSTGRESQL
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
package/libodb-pgsql/libodb-pgsql.hash new file +6 -0
new file mode 100644
index 0000000000..5799f09236
@@ -0,0 +1,6 @@
+# From https://www.codesynthesis.com/download/odb/2.4/libodb-pgsql-2.4.0.tar.bz2.sha1
+sha1	4628d5e296da01dbaf8658fd402b4f709f30ea2d	libodb-pgsql-2.4.0.tar.bz2
+
+# Locally Computed
+sha256	778a4d38bd1161e1f0b368815514c3335da20c7584e3d07613526dcce53523bc	libodb-pgsql-2.4.0.tar.bz2
+sha256	841105a470fc283851c63941510ffd403c726d1910b688f7df95914ab8b1b5a3	LICENSE
package/libodb-pgsql/libodb-pgsql.mk new file +16 -0
new file mode 100644
index 0000000000..fd95439d7d
@@ -0,0 +1,16 @@
+################################################################################
+#
+# libodb-pgsql
+#
+################################################################################
+
+LIBODB_PGSQL_VERSION_MAJOR = 2.4
+LIBODB_PGSQL_VERSION = $(LIBODB_PGSQL_VERSION_MAJOR).0
+LIBODB_PGSQL_SOURCE = libodb-pgsql-$(LIBODB_PGSQL_VERSION).tar.bz2
+LIBODB_PGSQL_SITE = https://www.codesynthesis.com/download/odb/$(LIBODB_PGSQL_VERSION_MAJOR)
+LIBODB_PGSQL_DEPENDENCIES += postgresql libodb
+LIBODB_PGSQL_LICENSE = MIT
+LIBODB_PGSQL_LICENSE_FILES = LICENSE
+LIBODB_PGSQL_INSTALL_STAGING = YES
+
+$(eval $(autotools-package))
Signature · 1 line
2.14.3
#5 lore raw

cover ODB: C++ Object-Relational Mapping (ORM): New packages.

In reply to Adam Duskett

Hello Adam,

Quoted 20 lines · Adam Duskett

There are three main components to use ODB (and a single dependency):
- libcutl: This library is ODB's only dependency.
- ODB: This is a compiler that takes a specially crafted c++ header file and auto-generates a schema that works with libodb and the subsequent libodb-database library.

It would be used as such:
odb -d <database> --generate-query --generate-schema file.hxx

- libodb: This package contains the common ODB runtime library. Every application that includes code generated by the ODB compiler will need to link to this library.

- libodb-pgsql: This package contains the PostgreSQL ODB runtime library. Every application that includes code generated for the PostgreSQL database will need to link to this library.

I am only providing libodb-pgsql as that is the only one I personally need. There is also support for mysql, sqlite, mssql, and oracle as well.

Quoted 7 lines

Also boost and qt libraries are avaiable if anybody so wishes to add them.

Adam Duskett (4):
libcutl: new package
ODB: New package
libodb: new package
libodb-pgsql: new package

So, I started looking at this patch series. I found a number of problems, mainly around licensing:

- The libcutl license details were incomplete

- The odb license was incorrect (it's GPL-3.0 and not MIT)

- The libodb and libodb-pgsql license was incorrect (it's GPL-2.0 and not MIT)

But then, I encountered two more fundamental problems:

(1) host-odb tries to build a gcc plugin for the host gcc, but my system didn't had the necessary headers and development files to build a gcc plugin. I had to install the gcc-plugin-devel package on my Fedora system.

Since this is not guaranteed to be installed on all systems, I believe we should add a hidden Config.in boolean such as BR2_NEEDS_HOST_GCC_PLUGIN_SUPPORT, selected by host-odb (which would perhaps require adding a Config.in.host option for host-odb), and a check should be added in support/dependencies/dependencies.sh to verify that gcc plugins can be built for the host gcc. It might also be that plugin support doesn't exist in old gcc versions.

(2) I was able to build libodb and libodb-pgsql without host-odb and host-libcutl, and I don't see in the libodb and libodb-pgsql build system where the gcc plugin built by host-odb or the odb compiler is used. Try by yourself: remove the host-odb dependency from libodb.mk, enable libodb and libodb-pgsql, and it will just work.

Could you look into the problems (1) and (2) ?

In order to avoid duplicating our effort, and because I also did a few other cosmetic improvements, I put the latest version of the patches I have at
https://git.bootlin.com/users/thomas-petazzoni/buildroot/log/?h=odb.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com