Problems with incremental v2-build after changes
After doing a v2-build, then making changes to the source (e.g. adding new Qt functions), Qtah has trouble rebuilding properly. First, the next v2-build call doesn't recognize that anything in qtah-cpp
and qtah
have changed, so it's necessary to touch the .cabal files to force this:
echo >>.../qtah/git/qtah-cpp/qtah-cpp.cabal; echo >>.../qtah/git/qtah/qtah.cabal
The upstream bug is here, but it's closed as wontfix currently: https://github.com/haskell/cabal/issues/3886
Past this, there are still problems. Possibly libqtah.so isn't being reinstalled properly; when the final application gets linked, we hit this error:
Building executable 'goatee-qt' for goatee-qt-0.4.0..
Linking <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/goatee-qt-0.4.0/x/goatee-qt/build/goatee-qt/goatee-qt ...
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-0.8.0/build/libHSqtah-0.8.0-inplace-ghc8.10.6.so: undefined reference to `genpop__QPainter_fillRectWithColor'
collect2: error: ld returned 1 exit status
`x86_64-pc-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)
Command exited with non-zero status 1
When qtah-cpp first builds, libqtah.so gets installed like this:
Preprocessing library for qtah-cpp-0.8.0..
Building library for qtah-cpp-0.8.0..
[1 of 1] Compiling Graphics.UI.Qtah.NothingToSeeHere ( src/Graphics/UI/Qtah/NothingToSeeHere.hs, <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-cpp-0.8.0/build/Graphics/UI/Qtah/NothingToSeeHere.o, <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-cpp-0.8.0/build/Graphics/UI/Qtah/NothingToSeeHere.dyn_o )
make: Entering directory '<...>/qtah/git/qtah-cpp/cpp'
/usr/lib64/qt5/bin/qmake -install qinstall -exe libqtah.so.0.8.0 <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-cpp-0.8.0/build/libqtah.so.0.8.0
ln -f -s libqtah.so.0.8.0 <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-cpp-0.8.0/build/libqtah.so
ln -f -s libqtah.so.0.8.0 <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-cpp-0.8.0/build/libqtah.so.0
ln -f -s libqtah.so.0.8.0 <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-cpp-0.8.0/build/libqtah.so.0.8
make: Leaving directory '<...>/qtah/git/qtah-cpp/cpp'
[1 of 1] Compiling Main ( <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-0.8.0/setup/setup.hs, <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-0.8.0/setup/Main.o )
Linking <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-0.8.0/setup/setup ...
Configuring qtah-0.8.0...
<snip>
After adding a function and touching the two .cabal files, qtah-cpp/cpp/libqtah.so is rebuilt, but it doesn't get reinstalled:
In order, the following will be built (use -v for more details):
- qtah-cpp-0.8.0 (lib:qtah-cpp) (file qtah-cpp.cabal changed)
- qtah-0.8.0 (lib:qtah) (dependency rebuilt)
- goatee-qt-0.4.0 (lib) (dependency rebuilt)
- goatee-qt-0.4.0 (exe:goatee-qt) (dependency rebuilt)
./qtah-cpp.cabal has been changed. Re-configuring with most recently used
options. If this fails, please run configure manually.
Configuring qtah-cpp-0.8.0...
qtah-cpp: Requesting system default Qt.
qtah-cpp: Using Qt 5.15.
Info: creating stash file /tmp/qtahenum-89de064c2614b7ee/.qmake.stash
g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -I/usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o qtahenum.o qtahenum.cpp
<snipping a bunch of warnings>
g++ -Wl,-O1 -o qtahenum qtahenum.o /usr/lib64/libQt5Widgets.so /usr/lib64/libQt5Gui.so /usr/lib64/libQt5Core.so -lGL -lpthread
Building the Qtah C++ library...
make: Entering directory '<...>/qtah/git/qtah-cpp/cpp'
g++ -c -pipe -std=c++11 -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -I/usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o b_qpainter.o b_qpainter.cpp
rm -f libqtah.so.0.8.0 libqtah.so libqtah.so.0 libqtah.so.0.8
g++ -Wl,-O1 -shared -Wl,-soname,libqtah.so.0 -o libqtah.so.0.8.0 b_callback.o <snip>
ln -s libqtah.so.0.8.0 libqtah.so
ln -s libqtah.so.0.8.0 libqtah.so.0
ln -s libqtah.so.0.8.0 libqtah.so.0.8
make: Leaving directory '<...>/qtah/git/qtah-cpp/cpp'
Preprocessing library for qtah-cpp-0.8.0..
Building library for qtah-cpp-0.8.0..
./qtah.cabal has been changed. Re-configuring with most recently used options.
If this fails, please run configure manually.
Configuring qtah-0.8.0...
<snip>
Confirming this:
$ readelf -W --dyn-syms <...>/qtah/git/qtah-cpp/cpp/libqtah.so | grep 'QPainter.setPen'
116: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZN8QPainter6setPenERK6QColor@Qt_5 (2)
382: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZN8QPainter6setPenERK4QPen@Qt_5 (2)
424: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZN8QPainter6setPenEN2Qt8PenStyleE@Qt_5 (2)
9210: 0000000000232370 5 FUNC GLOBAL DEFAULT 11 genpop__QPainter_setPenStyle
14651: 0000000000232340 5 FUNC GLOBAL DEFAULT 11 genpop__QPainter_setPen
16530: 0000000000232360 5 FUNC GLOBAL DEFAULT 11 genpop__QPainter_setPenColor
$ readelf -W --dyn-syms <...>/goatee/git/dist-newstyle/build/x86_64-linux/ghc-8.10.6/qtah-cpp-0.8.0/build/libqtah.so | grep 'QPainter.setPen'
<nothing>
(My setup here is that I'm working on Goatee with cabal.local.project pointing to local Hoppy and Qtah.)