sqlitebrowser icon indicating copy to clipboard operation
sqlitebrowser copied to clipboard

[Bug]: Centos 7 build failing

Open evbo opened this issue 3 years ago • 27 comments

What did you do?

build

What did you expect to see?

successful build master branch

What did you see instead?

See log error

DB4S Version

3.12.99 (nightly)

What OS are you seeing the problem on?

Linux

OS version

CentOS Linux release 7.3.1611 (Core)

Relevant log output

[ 71%] Building CXX object CMakeFiles/sqlitebrowser.dir/sqlitebrowser_autogen/mocs_compilation.cpp.o
In file included from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/EditIndexDialog.h:5:0,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_EditIndexDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:10:
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h: In instantiation of 'bool compare_ci(const T&, const T&) [with T = std::basic_string<char>]':
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:47:59:   required from here
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: error: no matching function for call to 'equal(std::basic_string<char>::const_iterator, std::basic_string<char>::const_iterator, std::basic_string<char>::const_iterator, std::basic_string<char>::const_iterator, compare_ci(const T&, const T&) [with T = std::basic_string<char>]::__lambda0)'
     });
      ^
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: note: candidates are:
In file included from /usr/include/c++/4.8.2/algorithm:61:0,
                 from /usr/include/qt5/QtCore/qglobal.h:109,
                 from /usr/include/qt5/QtGui/qtguiglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qtwidgetsglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qdialog.h:43,
                 from /usr/include/qt5/QtWidgets/QDialog:1,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/AboutDialog.h:4,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_AboutDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:2:
/usr/include/c++/4.8.2/bits/stl_algobase.h:1021:5: note: template<class _II1, class _II2> bool std::equal(_II1, _II1, _II2)
     equal(_II1 __first1, _II1 __last1, _II2 __first2)
     ^
/usr/include/c++/4.8.2/bits/stl_algobase.h:1021:5: note:   template argument deduction/substitution failed:
In file included from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/EditIndexDialog.h:5:0,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_EditIndexDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:10:
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: note:   candidate expects 3 arguments, 5 provided
     });
      ^
In file included from /usr/include/c++/4.8.2/algorithm:61:0,
                 from /usr/include/qt5/QtCore/qglobal.h:109,
                 from /usr/include/qt5/QtGui/qtguiglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qtwidgetsglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qdialog.h:43,
                 from /usr/include/qt5/QtWidgets/QDialog:1,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/AboutDialog.h:4,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_AboutDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:2:
/usr/include/c++/4.8.2/bits/stl_algobase.h:1053:5: note: template<class _IIter1, class _IIter2, class _BinaryPredicate> bool std::equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate)
     equal(_IIter1 __first1, _IIter1 __last1,
     ^
/usr/include/c++/4.8.2/bits/stl_algobase.h:1053:5: note:   template argument deduction/substitution failed:
In file included from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/EditIndexDialog.h:5:0,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_EditIndexDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:10:
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: note:   candidate expects 4 arguments, 5 provided
     });

Prevention against duplicate issues

  • [X] I have searched for similar issues

evbo avatar Aug 05 '22 20:08 evbo

Thanks for the bug report. :smile:

If you roll the git repository back a few commits - eg maybe to a week ago - does it compile?

Just wondering if this is something recent (and affecting CentOS 7), or if it's something that's been hanging around a while.

justinclift avatar Aug 05 '22 21:08 justinclift

Thanks, so I upgraded to gcc 9 since -std=c++14 is explicitly required in older commits and noticed sqlitetypes errors:

[ 71%] Building CXX object CMakeFiles/sqlitebrowser.dir/sqlitebrowser_autogen/mocs_compilation.cpp.o
In file included from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/EditIndexDialog.h:5:0,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_EditIndexDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:10:
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h: In instantiation of 'bool compare_ci(const T&, const T&) [with T = std::basic_string<char>]':
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:47:59:   required from here
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: error: no matching function for call to 'equal(std::basic_string<char>::const_iterator, std::basic_string<char>::const_iterator, std::basic_string<char>::const_iterator, std::basic_string<char>::const_iterator, compare_ci(const T&, const T&) [with T = std::basic_string<char>]::__lambda0)'
     });
      ^
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: note: candidates are:
In file included from /usr/include/c++/4.8.2/algorithm:61:0,
                 from /usr/include/qt5/QtCore/qglobal.h:109,
                 from /usr/include/qt5/QtGui/qtguiglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qtwidgetsglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qdialog.h:43,
                 from /usr/include/qt5/QtWidgets/QDialog:1,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/AboutDialog.h:4,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_AboutDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:2:
/usr/include/c++/4.8.2/bits/stl_algobase.h:1021:5: note: template<class _II1, class _II2> bool std::equal(_II1, _II1, _II2)
     equal(_II1 __first1, _II1 __last1, _II2 __first2)
     ^
/usr/include/c++/4.8.2/bits/stl_algobase.h:1021:5: note:   template argument deduction/substitution failed:
In file included from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/EditIndexDialog.h:5:0,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_EditIndexDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:10:
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: note:   candidate expects 3 arguments, 5 provided
     });
      ^
In file included from /usr/include/c++/4.8.2/algorithm:61:0,
                 from /usr/include/qt5/QtCore/qglobal.h:109,
                 from /usr/include/qt5/QtGui/qtguiglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qtwidgetsglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qdialog.h:43,
                 from /usr/include/qt5/QtWidgets/QDialog:1,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/AboutDialog.h:4,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_AboutDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:2:
/usr/include/c++/4.8.2/bits/stl_algobase.h:1053:5: note: template<class _IIter1, class _IIter2, class _BinaryPredicate> bool std::equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate)
     equal(_IIter1 __first1, _IIter1 __last1,
     ^
/usr/include/c++/4.8.2/bits/stl_algobase.h:1053:5: note:   template argument deduction/substitution failed:
In file included from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/EditIndexDialog.h:5:0,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/moc_EditIndexDialog.cpp:9,
                 from /root/sqlitebrowser/sqlitebrowser_autogen/mocs_compilation.cpp:10:
/root/sqlitebrowser/sqlitebrowser_autogen/UVLADIE3JM/../../src/sql/sqlitetypes.h:33:6: note:   candidate expects 4 arguments, 5 provided
     });
      ^
make[2]: *** [CMakeFiles/sqlitebrowser.dir/build.make:833: CMakeFiles/sqlitebrowser.dir/sqlitebrowser_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: CMakeFiles/sqlitebrowser.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

So I then tried building before we started linking to local version of sqlite: f068c2a4667c49573ac485a7f2bf4210a05107e7

and that built

It looks like maybe this commit where support was added for linking against a locally installed sqlite:

AppImage: Link against locally built SQLite library MKleusberg committed on Jun 10

evbo avatar Aug 06 '22 14:08 evbo

@justinclift related to this, do you know how I can build with support for math functions: ln, exp?

The latest nightly for Ubuntu includes them and I'd like to have them as well on Centos7 so my features are identical across the platforms. Thank you!

evbo avatar Aug 06 '22 15:08 evbo

@MKleusberg Seems like this will be of interest to you. :grin:

@evbo Excellent, that's really good investigation work. :smile:

For the math functions, I'm personally aware of two approaches. There is the original/early math library functions extension which people used for years, that needs compiling and adding in manually.

However, the more recent SQLite releases (3.35.0 and above) also include the math functions you mention built in.

So, if you compile your own recent version of SQLite and point the compile process at that... in theory it should work. Co-incidentally, that seems to be the commit it's breaking on for you. So, that might need some special attention for CentOS 7. Not sure. :wink:

justinclift avatar Aug 06 '22 22:08 justinclift

Thank you! I followed upgrade instructions here for sqlite:

sqlite3 --version 3.39.2 2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603

and with GCC and sqlite upgraded, I can build master.

But unfortunately in my case I need an AppImage since the Centos7 environment I'm releasing to uses very old versions of system libraries.

So I install libfuse and build the appimage:

yum install fuse fuse-devel
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
export VERSION=1.2.3
./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage

But running it self-contained means system libraries on the older Centos7 distro fail with Qt dependencies:

GLIBCXX_3.4.21 not found (required by... .../usr/bin/linuxdeployqt) CXXABI_1.3.9 not found (required by... ...libQt5Core.so.5 CXXABI_1.3.8 not found (required by... ...libQt5Core.so.5

Is there a way to configure the AppImage to only package the latest version of sqlite and then rely on all other system libraries that are installed in the environment running sqlitebrowser? For instance, the binary created from make runs fine in this ancient Centos7 environment, but it's using sqlite 3.7. I just need the latest sqlite but otherwise the binary would be fine.

evbo avatar Aug 07 '22 13:08 evbo

For instance, the binary created from make runs fine in this ancient Centos7 environment, but it's using sqlite 3.7.

To me, it's kind of sounding like it's probably better to get the binary (created using make) to find the newer SQLite installation, rather than having to figure out a whole new build process (AppImage).

As an idea, if you set the LD_LIBRARY_PATH variable to point at your self-installed newer SQLite then run the DB4S binary... does it use the old SQLite or the new one?

Along the lines of:

export LD_LIBRARY_PATH="/home/evbo/local/sqlite/lib"
./sqlitebrowser

justinclift avatar Aug 07 '22 23:08 justinclift

Unfortunately that is not used in this environment. I also tried export PATH="${folder_with_sqlite}:${PATH}" and even though which reported the right version of sqlite3 unfortunately sqlitebrowser still was looking for 3.7 version located in /bin/sqlite3 and I do not have root to change anything.

Is there any other way to override the path to sqlite3 that sqlitebrowser can identify? Or is there a process for removing the binaries in the appimage's usr/lib/* directory?

evbo avatar Aug 08 '22 01:08 evbo

Heh Heh Heh, this is being a bit of a challenge eh?

As a potentially useful data point, this is the AppImage stuff we use for our builds:

    https://github.com/sqlitebrowser/sqlitebrowser/blob/master/.github/workflows/appimage.yml

The "History" page is informative as well:

    https://github.com/sqlitebrowser/sqlitebrowser/commits/master/.github/workflows/appimage.yml

That being said, I've not touched this build process myself so I'm probably not useful in assisting with it. Seems like @MKleusberg potentially would be, and maybe @longnguyen2004 as well (unsure). :smile:

justinclift avatar Aug 08 '22 07:08 justinclift

Oh, if all else fails... then the chrpath tool might be useful. It allows for direct editing of the rpath and runpath in compiled executables, though it's not common for those be used much these days.

Still, it might provide an avenue to muck with this if nothing else does. :smile:

justinclift avatar Aug 08 '22 07:08 justinclift

I hate it when "it works on my machine!" :) Guess I'll make a VM and try to work this out then.

longnguyen2004 avatar Aug 08 '22 08:08 longnguyen2004

Yeah it keeps working for me somehow 😅 image image image

(Ok, not everything worked, icons are missing, but I guess that's somewhere else)

Here's the step I've taken:

  1. Install the necessary tools
# GCC 11 toolchain
su -c "yum install centos-release-scl devtoolset-11-toolchain -y"

# Qt
su -c "yum install qt5-qtbase* qt5-qttools* -y"

# CMake
wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.sh
chmod a+x cmake-3.24.0-linux-x86_64.sh
su -c "./cmake-3.24.0-linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license
  1. Switch to the GCC 11 toolchain
scl enable devtoolset-11 bash
  1. Build SQLite
wget https://www.sqlite.org/2022/sqlite-autoconf-3390200.tar.gz
tar -xvf sqlite-autoconf-3390200.tar.gz
cd sqlite-autoconf-3390200
mkdir build && cd build
../configure # If you want static SQLite only, add --enable-shared=no
make -j6 && su -c "make install"
  1. Build SQLite Browser
git clone https://github.com/sqlitebrowser/sqlitebrowser --depth 1
cd sqlitebrowser
cmake -B build && cd build
make -j6 && su -c "make install"

longnguyen2004 avatar Aug 08 '22 11:08 longnguyen2004

Also, I'm aware that I've broken Windows nightlies, gonna work on that now. That build script though...Let's see what I can do

longnguyen2004 avatar Aug 08 '22 11:08 longnguyen2004

@justinclift unfortunately no rpath or runpath tag found. What do you guys think about adding an optional env var or config setting pointing to the sqlite3 version? Could be useful for rapidly testing different versions of sqlite3.

evbo avatar Aug 08 '22 13:08 evbo

See this for some instruction for that (I'm aware that you need to make install for CMake to properly pick up the library, but you can always install to a different prefix).

longnguyen2004 avatar Aug 08 '22 14:08 longnguyen2004

Thanks I tried setting it to the folder where my copy of sqlite3 is but still it is using the version in /bin. What if in preferences we added to the gui a path for optionally specifying a different sqlite binary? Wouldn't that be useful also for testing and benchmarking new releases and features of sqlite?

evbo avatar Aug 08 '22 14:08 evbo

what's inconsistent to me is if I prepend the location to PATH when I run sqlite3 it correctly loads the latest version, yet sqlitebrowser load /bin/sqlite3 no matter what.

What causes sqlitebrowser to not obey the path the same as my bash shell?

evbo avatar Aug 08 '22 18:08 evbo

What if in preferences we added to the gui a path for optionally specifying a different sqlite binary?

We don't use the shell binary here (sqlite3), but we link to the shared/static sqlite3 library (libsqlite3.(so|a)). The version of sqlite3 that it links with is determined at configure time (you might see a Found SQLite3 line somewhere in the CMake configure output). Changing the version requires rebuilding the program. Theoretically one can use the LD_LIBRARY_PATH mechanism to force the OS to load another version, but that might causes adverse effects, and is a security risk.

So, to answer your other questions:

if I prepend the location to PATH when I run sqlite3 it correctly loads the latest version, yet sqlitebrowser load /bin/sqlite3 no matter what.

What causes sqlitebrowser to not obey the path the same as my bash shell?

Because we don't use /bin/sqlite3, but we link to a specific version, usually in /lib/libsqlite3.so.0

longnguyen2004 avatar Aug 08 '22 18:08 longnguyen2004

That's normal behavior. It's creating symlinks for libsqlite3.so and libsqlite3.so.0

longnguyen2004 avatar Aug 09 '22 01:08 longnguyen2004

Also, @justinclift is there a Windows CI somewhere that I can test with? Replicating every path in the script is proving to be pretty laborious 😅

longnguyen2004 avatar Aug 09 '22 01:08 longnguyen2004

https://circleci.com/execution-environments/windows/ is free for 6000 build minutes? Something like that you mean?

chrisjlocke avatar Aug 09 '22 10:08 chrisjlocke

I can build on my local machine, it's just that replicating the build environment is tedious, so it'd be good if I can have a prepared environment somewhere

longnguyen2004 avatar Aug 09 '22 11:08 longnguyen2004

That's the point of the circleCI website isn't it? I have no idea what I'm going on about though, so will walk slowly backwards... ;) I was playing with Docker on Windows the other day - again, isn't that a useful dingle dongle for this?

chrisjlocke avatar Aug 09 '22 12:08 chrisjlocke

Qt-based CI on Windows has not really been a satisfying experience the last time I tried it, at least when not using the MSYS2 packages, but this might have changed in the meantime. At least in theory there should be no need to fall back to external services like CircleCI, as GitHub Actions provide a similar functionality natively.

FriedrichFroebel avatar Aug 09 '22 13:08 FriedrichFroebel

That hidden .libs folder is what I was missing. If I add the contents of it to LD_LIBRARY_PATH you're right, it works. Finally! Thanks for everyone's help, this is a very chill github.

evbo avatar Aug 09 '22 13:08 evbo

You're welcome! Next time though, please make install, it'll make everything a lot easier :)

longnguyen2004 avatar Aug 09 '22 14:08 longnguyen2004

@longnguyen2004 Unfortunately, we don't have a simple + easily reproduce-able image for our Win builds. That'd be optimal. :smile:

Pretty sure MS licensing terms would stop any idea of us (or anyone else?) doing that.

That being said, it might be possible to knock something together using Ansible or similar CI platform.

Whenever I'm doing serious dev work for our window builds, I tend to spin up a brand new local vm (manually) and build a complete dev environment in that. Generally following the process here, but using more up to date versions of the software as needed:

    https://github.com/sqlitebrowser/sqlitebrowser/wiki/Setting-up-a-Win64-development-environment-for-DB4S

justinclift avatar Aug 09 '22 20:08 justinclift

Okay then...I'll see what I can work out (yet another reason to go with a mingw-w64 toolchain 😄)

longnguyen2004 avatar Aug 10 '22 10:08 longnguyen2004

Anyway @evbo since your problem is solved, you can close this

longnguyen2004 avatar Aug 10 '22 11:08 longnguyen2004