[odb-users] QT config

Alex B intord at gmail.com
Thu Nov 9 12:36:19 EST 2023


ok here is what i got:

admin at gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 --std c++11
--profile qt -d sqlite \
--generate-query property.h
In file included from /usr/include/qt5/QtCore/qchar.h:43,
                 from /usr/include/qt5/QtCore/qstring.h:49,
                 from /usr/include/qt5/QtCore/QString:1,
                 from
/usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7,
                 from <odb-prologue-2>:1:
/usr/include/qt5/QtCore/qglobal.h:1289:4: error: #error "You must build
your code with position independent code if Qt was built with
-reduce-relocations. " "Compile your code with -fPIC (and not with -fPIE)."
 1289 | #  error "You must build your code with position independent code
if Qt was built with -reduce-relocations. "\
      |    ^~~~~
property.h:4:10: fatal error: QString: No such file or directory
    4 | #include <QString>
      |          ^~~~~~~~~
compilation terminated.
admin at gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 --std c++11
--profile qt -d sqlite --generate-query property.h
In file included from /usr/include/qt5/QtCore/qchar.h:43,
                 from /usr/include/qt5/QtCore/qstring.h:49,
                 from /usr/include/qt5/QtCore/QString:1,
                 from
/usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7,
                 from <odb-prologue-2>:1:
/usr/include/qt5/QtCore/qglobal.h:1289:4: error: #error "You must build
your code with position independent code if Qt was built with
-reduce-relocations. " "Compile your code with -fPIC (and not with -fPIE)."
 1289 | #  error "You must build your code with position independent code
if Qt was built with -reduce-relocations. "\
      |    ^~~~~
property.h:4:10: fatal error: QString: No such file or directory
    4 | #include <QString>
      |          ^~~~~~~~~
compilation terminated.
admin at gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 -fPIC --std c++11
--profile qt -d sqlite --generate-query property.h
unknown option '-f'
admin at gentoo ~/QTProjects/odb-qt $

so i found your answer here:
https://odb-users.codesynthesis.narkive.com/dSmA1FfR/problem-compiling-with-qt
and tried, but still get the same error:

admin at gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 -x -fPIC --std
c++11 --profile qt -d sqlite --generate-query property.h
property.h:4:10: fatal error: QString: No such file or directory
    4 | #include <QString>
      |          ^~~~~~~~~
compilation terminated.
admin at gentoo ~/QTProjects/odb-qt $
admin at gentoo ~/QTProjects/odb-qt $ odb  -x -fPIC -I/usr/include/qt5 --std
c++11 --profile qt -d sqlite --generate-query property.h
property.h:4:10: fatal error: QString: No such file or directory
    4 | #include <QString>
      |          ^~~~~~~~~
compilation terminated.

seems like it still should be added soomewhere in the odb makefile like
suggested here:
https://stackoverflow.com/questions/15978608/qt-compile-your-code-with-fpic-or-fpie



On Thu, Nov 9, 2023 at 7:54 AM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Alex B <intord at gmail.com> writes:
>
> > Basically, odb compiler cannot find the correct path to the QtCore
> > folder, which I added to the $PATH etc, but no luck. I do not see
> > any param for the odb compiler to specify that as well.
> >
> > admin at gentoo ~/QTProjects/odb-qt $ echo $PATH
> > [...]:/usr/include/qt5:/usr/lib64/qt5
> > admin at gentoo ~/QTProjects/odb-qt $ odb --std c++11 --profile qt -d
> sqlite
> > --generate-query property.h
>
> PATH is not the right place to add the header (/usr/include/qt5) and
> library (/usr/lib64/qt5) search paths. Try to add -I/usr/include/qt5
> to the ODB command line:
>
> odb -I/usr/include/qt5 --std c++11 --profile qt -d sqlite \
> --generate-query property.h
>


More information about the odb-users mailing list