[odb-users] odb compiler schema generation issue

Michael Martin Moro sexymimi64 at gmail.com
Sat Feb 17 07:59:40 EST 2024


Hi !

I've been trying to reproduce the Hello World example, but I don't get 
the expected result in terms of schema. Here's the documentation I've 
been using:

https://www.codesynthesis.com/products/odb/doc/manual.xhtml#2

It says that the following command would generate a person.xml file:

odb -d mysql --generate-query --generate-schema person.hxx

But it doesn't. Instead, it creates a person.sql file. Could it be that 
the default value for `--schema-format` is actually `sql` ?

When using the --schema-format option and set it to /embedded/ or 
/separate/, the command no longer generates a sql file. But it doesn't 
generate a changelog xml file either, even if the --changelog option is 
explicitely specified. A person-schema.cxx file is generated as expected 
when the value is set to /separate./

It also seems that odb::database::schema_version() always returns 0, 
regardless of the value set using #pragma db version, and regardless of 
whether the database has already been created using 
odb::schema_catalog::create_schema. The result is that it's not possible 
to update the database schema without wiping off the entire database.

Odb version is 2.5.0-b.25.

Any idea what would be causing such an issue ?

---

Some more details:

1) If it helps, I've also noticed that the xml changlog files actually 
still works in my older projects: basically, the xml changelog gets 
updates if it already exists, but it never gets created if it doesn't 
already exist. While in theory, that means I should be able to patch 
this issue by manually creating the first changelog, in practice I 
haven't been able to manually create an xml changelog that the odb 
compiler actually reads from. And since the odb compiler no longer 
generates the first iteration of that changelog, I haven't been able to 
use changelogs in any new project.

2) This issue is not new. I use odb on a daily basis, and I've been 
having issues with changelogs since summer 2022. At first I suspected 
something was wrong with my setup, but I've actually built odb from 
scratch on many virtual machines since, and this reproduces everywhere.

3) Verbose output of the odb command, trying to generate a xml changelog 
for the person

/usr/local/bin/odb -d pgsql --generate-query --generate-schema 
--schema-format separate --changelog person.xml model.h -v
Profile search paths:
  /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13
  /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/x86_64-redhat-linux
  /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/backward
  /usr/lib/gcc/x86_64-redhat-linux/13/include
  /usr/local/include
  /usr/include
Compiling model.h
g++ -x c++ -std=c++98 -S -Wunknown-pragmas -Wno-deprecated 
-fplugin=/usr/local/bin/odb.so -v 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/x86_64-redhat-linux 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/backward 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/include 
-fplugin-arg-odb-svc-path=/usr/local/include 
-fplugin-arg-odb-svc-path=/usr/include -DODB_COMPILER 
-DODB_COMPILER_VERSION=2049975 -DODB_DATABASE_PGSQL 
-fplugin-arg-odb-database=pgsql -fplugin-arg-odb-generate-query 
-fplugin-arg-odb-generate-schema -fplugin-arg-odb-schema-format=separate 
-fplugin-arg-odb-changelog=person.xml -fplugin-arg-odb-svc-file=model.h -
Utilisation des specs internes.
COLLECT_GCC=g++
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Cible : x86_64-redhat-linux
Configuré avec: ../configure --enable-bootstrap 
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto 
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info 
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared 
--enable-threads=posix --enable-checking=release --enable-multilib 
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions 
--enable-gnu-unique-object --enable-linker-build-id 
--with-gcc-major-version-only --enable-libstdcxx-backtrace 
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo 
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array 
--with-isl=/builddir/build/BUILD/gcc-13.2.1-20231011/obj-x86_64-redhat-linux/isl-install 
--enable-offload-targets=nvptx-none --without-cuda-driver 
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet 
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 
--with-build-config=bootstrap-lto --enable-link-serialization=1
Modèle de thread: posix
Algorithmes de compression LTO supportés: zlib zstd
gcc version 13.2.1 20231011 (Red Hat 13.2.1-4) (GCC)
COLLECT_GCC_OPTIONS='-std=c++98' '-S' '-Wunknown-pragmas' 
'-Wno-deprecated' '-fplugin=/usr/local/bin/odb.so' '-v' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/x86_64-redhat-linux' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/backward' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/include' 
'-fplugin-arg-odb-svc-path=/usr/local/include' 
'-fplugin-arg-odb-svc-path=/usr/include' '-D' 'ODB_COMPILER' '-D' 
'ODB_COMPILER_VERSION=2049975' '-D' 'ODB_DATABASE_PGSQL' 
'-fplugin-arg-odb-database=pgsql' '-fplugin-arg-odb-generate-query' 
'-fplugin-arg-odb-generate-schema' 
'-fplugin-arg-odb-schema-format=separate' 
'-fplugin-arg-odb-changelog=person.xml' 
'-fplugin-arg-odb-svc-file=model.h' '-shared-libgcc' '-mtune=generic' 
'-march=x86-64'
  /usr/libexec/gcc/x86_64-redhat-linux/13/cc1plus -quiet -v 
-iplugindir=/usr/lib/gcc/x86_64-redhat-linux/13/plugin -D_GNU_SOURCE -D 
ODB_COMPILER -D ODB_COMPILER_VERSION=2049975 -D ODB_DATABASE_PGSQL - 
-iplugindir=/usr/lib/gcc/x86_64-redhat-linux/13/plugin -quiet -dumpbase 
- -mtune=generic -march=x86-64 -Wunknown-pragmas -Wno-deprecated 
-std=c++98 -version -fplugin=/usr/local/bin/odb.so 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/x86_64-redhat-linux 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/backward 
-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/include 
-fplugin-arg-odb-svc-path=/usr/local/include 
-fplugin-arg-odb-svc-path=/usr/include -fplugin-arg-odb-database=pgsql 
-fplugin-arg-odb-generate-query -fplugin-arg-odb-generate-schema 
-fplugin-arg-odb-schema-format=separate 
-fplugin-arg-odb-changelog=person.xml -fplugin-arg-odb-svc-file=model.h 
-o -.s
GNU C++98 (GCC) version 13.2.1 20231011 (Red Hat 13.2.1-4) 
(x86_64-redhat-linux)
         compilé par GNU C version 13.2.1 20231011 (Red Hat 13.2.1-4), 
GMP version 6.2.1, MPFR version 4.2.0-p12, MPC version 1.3.1, isl 
version isl-0.24-GMP

heuristiques GGC: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
  odb: 2.5.0-b.25
le répertoire « /usr/lib/gcc/x86_64-redhat-linux/13/include-fixed » est 
ignoré car inexistant
le répertoire 
« /usr/lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include » 
est ignoré car inexistant
la recherche pour #include "..." débute ici :
la recherche pour #include <...> débute ici:
  /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13
  /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/x86_64-redhat-linux
  /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/backward
  /usr/lib/gcc/x86_64-redhat-linux/13/include
  /usr/local/include
  /usr/include
Fin de la liste de recherche.
Compiler executable checksum: eec6ea8c5ebefd8c87c81ea2002f55e3
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/13/:/usr/libexec/gcc/x86_64-redhat-linux/13/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/13/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/13/:/usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/13/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-std=c++98' '-S' '-Wunknown-pragmas' 
'-Wno-deprecated' '-fplugin=/usr/local/bin/odb.so' '-v' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/x86_64-redhat-linux' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/backward' 
'-fplugin-arg-odb-svc-path=/usr/lib/gcc/x86_64-redhat-linux/13/include' 
'-fplugin-arg-odb-svc-path=/usr/local/include' 
'-fplugin-arg-odb-svc-path=/usr/include' '-D' 'ODB_COMPILER' '-D' 
'ODB_COMPILER_VERSION=2049975' '-D' 'ODB_DATABASE_PGSQL' 
'-fplugin-arg-odb-database=pgsql' '-fplugin-arg-odb-generate-query' 
'-fplugin-arg-odb-generate-schema' 
'-fplugin-arg-odb-schema-format=separate' 
'-fplugin-arg-odb-changelog=person.xml' 
'-fplugin-arg-odb-svc-file=model.h' '-shared-libgcc' '-mtune=generic' 
'-march=x86-64'


More information about the odb-users mailing list