How to compile subsurface sources with the latest libdivecomputer compiled from git sources?

157 views
Skip to first unread message

Francesco Ganozzi

unread,
Jul 30, 2015, 12:55:00 PM7/30/15
to Subsurface Divelog
Hi!
Sorry for my bad english.
I'm not very skilled with Linux and I can't use my dive computer with Subsurface.
At the beginning I've installed it from your official repository (sudo apt-add-repository ppa:subsurface/subsurface).
It seems that my DiveSystem iDive Pro is supported. Unfortunately, when I try to import the dives, it fails.
My OS is Ubuntu 14.04 LTS on a 64-bit architecture.
The libdivecomputer0 package from the official repositories does not contain the divesystem_idive.c file (or there's something wrong in it... I don't remember... I'm lost after a day spent googling for it; anyway, try to look at this: http://trac.libdivecomputer.org/browser/libdivecomputer/src/divesystem_idive.c?rev=50c8b46c961d2fcb81754e20e2cabcb96c6c5508).
The latest libdivecomputer from git seems to have all I need and the right value of SZ_HEADER (0x32).
I've succesfully downloaded, compiled and installed it.
If I try to install again Subsurface (4.4.2-1~trusty) from your repository it fails because it cannot find
libdivecomputer 'cause it was compiled and installed from sources.
After that I used you instructions and try to download, compile and install from git:

git clone git://subsurface-divelog.org/subsurface.git

I tried in different ways, also Torvalds's way: ./subsurface/scripts/build.sh, but I can't link the operation to libdivecomputer path.

That's the error: "can't check out the Subsurface-testing branch of libdivecomputer -- giving up" (ln 115 of my build.sh copy)
Thanks in advance.

Miika Turkia

unread,
Jul 30, 2015, 1:31:44 PM7/30/15
to Subsurface Divelog, francesc...@gmail.com
You should let the build.sh script to clone the git repository of libdivecomputer, as we have some own additions to it. And these additions have not yet made to  the official repository. So remove the current libdivecomputer sources and try runing subsurface/scripts/build.sh again

miika

Francesco Ganozzi

unread,
Jul 30, 2015, 4:24:01 PM7/30/15
to Subsurface Divelog, francesc...@gmail.com
Thanks for the answer!
I've tried from another machine, twin of the previous, so the situation is clear.
I have installed all the dependencies for subsurface except libdivecomputer0 and libdivecomputer-dev. Then:

mkdir ~/src
cd ~/
src
git clone
-b v4.4.2 git://subsurface-divelog.org/subsurface
./subsurface/scripts/build.sh

It gave me an error because it could not find qmake-qt5 command. So:

sudo apt-get install qt5-qmake
cd
/usr/bin
sudo ln
-s ../lib/x86_64-linux-gnu/qt5/bin/qmake qmake-qt5 #because still not found
cd
-

Tried build.sh again. It did a lot of stuff for a while but at the end it gave me another error. I paste here only the last (english) part and omit italian messages, but you can find src/marble-source/build/CMakeFiles/CMakeOutput.log in attach. The return code with echo $? is 2.


[...]
Your branch is up-to-date with 'origin/Subsurface-4.4'.
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:68 (find_package):
 
By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked
CMake to find a package configuration file provided by "Qt5Core", but
 
CMake did not find one.

 
Could not find a package configuration file provided by "Qt5Core" with any
  of the following names
:

   
Qt5CoreConfig.cmake
    qt5core
-config.cmake

 
Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
 
"Qt5Core_DIR" to a directory containing one of the above files.  If
 
"Qt5Core" provides a separate development package or SDK, be sure it has
  been installed
.


-- Configuring incomplete, errors occurred!
See also "/home/gano/src/marble-source/build/CMakeFiles/CMakeOutput.log".
./subsurface/scripts/build.sh: riga 95: cd: src/lib/marble: File o directory non esistente
[...]

To those who work with this things, messages will be clear, but my knowledge stops here.

CMakeOutput.log

Tomaz Canabrava

unread,
Jul 30, 2015, 5:06:15 PM7/30/15
to Subsurface Divelog, francesc...@gmail.com

You only installed qt5-qmake but you need to install qt5-dev packages.

This is a pain in Debian, all packages are split in two versions, dev and normal. Dev is necessary to build stuff, please install the dev variant of qt5


--
You received this message because you are subscribed to the Google Groups "Subsurface Divelog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
To post to this group, send email to subsurfac...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/subsurface-divelog/6118059d-24e6-4fcf-ac1b-adeaff274628%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miika Turkia

unread,
Jul 31, 2015, 12:21:35 AM7/31/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
Run the following command just to make sure, all packages are installed:

sudo apt-get install git g++ make autoconf libtool cmake pkg-config \
        libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
        libusb-1.0-0-dev libgit2-dev \
        qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \
        libqt5webkit5-dev libqt5qml5 libqt5quick5 libqt5declarative5 \
        qtscript5-dev libssh2-1-dev libcurl4-openssl-dev qttools5-dev \
        qtconnectivity5-dev

This wil install all the required packages that might be missing from your installation and is documented in the INSTALL file under the sources.

miika

Francesco Ganozzi

unread,
Jul 31, 2015, 4:50:59 AM7/31/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org, miika....@gmail.com
Hi, guys!
Thank you for the support.
I've used Miika's command and build.sh. It seemed that everything went well, but when I ran subsurface and tried to import dives from the DiveSystem iDive Pro, it gave me the usual error, as in subsrf_out.txt attachment:

[0.336960] ERROR: Unexpected packet length. [in divesystem_idive.c:323 (divesystem_idive_transfer)]

So I check divesystem_idive.c file in the libdivecomputer directory that build.sh downloaded for me and at line 55 I saw again

#define SZ_HEADER 0x33

I deleted all in my home's src dir, cloned again subsurface from git and edited ln 62 of build.sh:

# git clone -b Subsurface-4.4 git://subsurface-divelog.org/libdc libdivecomputer
 git clone git
://git.libdivecomputer.org/libdivecomputer.git

Ran it (build.sh) again. Launched Subsurface. Tried the import and... TAADAA!! It works!!!
You're great, guys! Thank you very much!
subsrf_out.txt

Francesco Ganozzi

unread,
Aug 3, 2015, 1:16:10 PM8/3/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
Hi again.
I tried to install Subsurface in another machine and I saw that something has changed since two days ago, so my solution does not works.
I saw that the DiveSystem library in your repository have the correct header length, so I tried the installation with the normal build.sh file (all dependecies ok with Miika's command and a clear src folder in my home).
This is the last part of the output:

gano@pc-jolly:~/src$ ./subsurface/scripts/build.sh
[...]
[ 95%] Building CXX object CMakeFiles/subsurface_interface.dir/qt-ui/printdialog.cpp.o
[ 95%] Building CXX object CMakeFiles/subsurface_interface.dir/qt-ui/printoptions.cpp.o
/home/gano/src/subsurface/printer.cpp: In member function void Printer::print()’:
/home/gano/src/subsurface/printer.cpp:147:33: error: class QPrinter has no member named pageLayout
  pageSize
.setHeight(printerPtr->pageLayout().paintRect(QPageLayout::Inch).height() * dpi);
                                 
^
/home/gano/src/subsurface/printer.cpp:147:56: error: QPageLayout has not been declared
  pageSize
.setHeight(printerPtr->pageLayout().paintRect(QPageLayout::Inch).height() * dpi);
                                                       
^
/home/gano/src/subsurface/printer.cpp:148:32: error: class QPrinter has no member named pageLayout
  pageSize
.setWidth(printerPtr->pageLayout().paintRect(QPageLayout::Inch).width() * dpi);
                               
^
/home/gano/src/subsurface/printer.cpp:148:55: error: QPageLayout has not been declared
  pageSize
.setWidth(printerPtr->pageLayout().paintRect(QPageLayout::Inch).width() * dpi);
                                                       
^
make
[2]: *** [CMakeFiles/subsurface_interface.dir/printer.cpp.o] Errore 1
make
[2]: *** Attesa per i processi non terminati....
make
[1]: *** [CMakeFiles/subsurface_interface.dir/all] Errore 2
make
: *** [all] Errore 2
[  0%] Built target documentationLink
[  0%] Built target documentation
[  0%] Built target link_marble_data
[  0%] Built target printing_templatesLink
[  0%] Automoc for target subsurface
[  0%] Built target subsurface_automoc
[  0%] Automoc for target subsurface_statistics
AUTOMOC
: warning: /home/gano/src/subsurface/qt-ui/statistics/yearstatistics.cpp: file is empty

AUTOMOC
: warning: /home/gano/src/subsurface/qt-ui/statistics/statisticsbar.cpp: file is empty

AUTOMOC
: warning: /home/gano/src/subsurface/qt-ui/statistics/monthstatistics.cpp: file is empty

[  0%] Built target subsurface_statistics_automoc
[  0%] Automoc for target subsurface_generated_ui
[  0%] Built target subsurface_generated_ui_automoc
[  0%] Built target version
[ 16%] Built target subsurface_generated_ui
[ 19%] Built target subsurface_statistics
[ 20%] Automoc for target subsurface_interface
[ 20%] Built target subsurface_interface_automoc
[ 22%] Building CXX object CMakeFiles/subsurface_interface.dir/printer.cpp.o
/home/gano/src/subsurface/printer.cpp: In member function void Printer::print()’:
/home/gano/src/subsurface/printer.cpp:147:33: error: class QPrinter has no member named pageLayout
  pageSize
.setHeight(printerPtr->pageLayout().paintRect(QPageLayout::Inch).height() * dpi);
                                 
^
/home/gano/src/subsurface/printer.cpp:147:56: error: QPageLayout has not been declared
  pageSize
.setHeight(printerPtr->pageLayout().paintRect(QPageLayout::Inch).height() * dpi);
                                                       
^
/home/gano/src/subsurface/printer.cpp:148:32: error: class QPrinter has no member named pageLayout
  pageSize
.setWidth(printerPtr->pageLayout().paintRect(QPageLayout::Inch).width() * dpi);
                               
^
/home/gano/src/subsurface/printer.cpp:148:55: error: QPageLayout has not been declared
  pageSize
.setWidth(printerPtr->pageLayout().paintRect(QPageLayout::Inch).width() * dpi);
                                                       
^
make
[2]: *** [CMakeFiles/subsurface_interface.dir/printer.cpp.o] Errore 1
make
[1]: *** [CMakeFiles/subsurface_interface.dir/all] Errore 2
make
: *** [all] Errore 2

What can I do?
Thank you.



Il giorno venerdì 31 luglio 2015 06:21:35 UTC+2, Miika Turkia ha scritto:

Tomaz Canabrava

unread,
Aug 3, 2015, 1:18:27 PM8/3/15
to Francesco Ganozzi, Subsurface Divelog
What's the version of your Qt5 installation?
from the Qt docs, QPageLayout is Since: Qt 5.3 

Francesco Ganozzi

unread,
Aug 3, 2015, 1:23:17 PM8/3/15
to Tomaz Canabrava, Subsurface Divelog

How can I check this?

Tomaz Canabrava

unread,
Aug 3, 2015, 1:27:07 PM8/3/15
to Subsurface Divelog
On Mon, Aug 3, 2015 at 2:23 PM, Francesco Ganozzi <francesc...@gmail.com> wrote:

How can I check this?


Please respond the e-mail inline, not at the top. :)
It depends on your distro actually.
assuming that it's arch, you'd do pacman -Ss qt5 | grep installed
assuming that it's an debian derivate ( ubuntu, mint )  apt-show-versions qt5-dev

--
You received this message because you are subscribed to the Google Groups "Subsurface Divelog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
To post to this group, send email to subsurfac...@googlegroups.com.

Francesco Ganozzi

unread,
Aug 3, 2015, 1:49:29 PM8/3/15
to Subsurface Divelog, tcana...@kde.org
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-divelog+unsub...@googlegroups.com.

To post to this group, send email to subsurfac...@googlegroups.com.

Excuse me. I have answered directly to the email from my phone.
Now I'm back to pc. I'm fear that I miss again the reply point... In this case, tell me please. Sorry...
Anyway, I have installed apt-show-versions package and it told me that in this pc I don't have qt5-dev package (as in your previous answer).
I think that in my case the package is qt5-default, but maybe I'm wrong. So:

gano@pc
-jolly:~$ apt-show-versions qt5-default
qt5
-default:amd64/trusty-security 5.2.1+dfsg-1ubuntu14.3 uptodate





Tomaz Canabrava

unread,
Aug 3, 2015, 1:55:56 PM8/3/15
to Francesco Ganozzi, Subsurface Divelog
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
To post to this group, send email to subsurfac...@googlegroups.com.
Excuse me. I have answered directly to the email from my phone.
Now I'm back to pc. I'm fear that I miss again the reply point... In this case, tell me please. Sorry...
Anyway, I have installed apt-show-versions package and it told me that in this pc I don't have qt5-dev package (as in your previous answer).
I think that in my case the package is qt5-default, but maybe I'm wrong. So:

gano@pc
-jolly:~$ apt-show-versions qt5-default
qt5
-default:amd64/trusty-security 5.2.1+dfsg-1ubuntu14.3 uptodate



And that's the problem, your Qt5 is too old :(
we depend on Qt 5.3, you hae 5.2 (current Qt5 is 5.5 )
is it possible to update your Qt5 ?

 

Francesco Ganozzi

unread,
Aug 3, 2015, 2:00:46 PM8/3/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-divelog+unsub...@googlegroups.com.
To post to this group, send email to subsurfac...@googlegroups.com.
Excuse me. I have answered directly to the email from my phone.
Now I'm back to pc. I'm fear that I miss again the reply point... In this case, tell me please. Sorry...
Anyway, I have installed apt-show-versions package and it told me that in this pc I don't have qt5-dev package (as in your previous answer).
I think that in my case the package is qt5-default, but maybe I'm wrong. So:

gano@pc
-jolly:~$ apt-show-versions qt5-default
qt5
-default:amd64/trusty-security 5.2.1+dfsg-1ubuntu14.3 uptodate



And that's the problem, your Qt5 is too old :(
we depend on Qt 5.3, you hae 5.2 (current Qt5 is 5.5 )
is it possible to update your Qt5 ?

 

Have to add a repository?

Francesco Ganozzi

unread,
Aug 4, 2015, 4:16:51 AM8/4/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
I've deleted all the previous part and wrote here only my current post. I hope I'm right.
I found the package at: http://packages.ubuntu.com/vivid/qt5-default but this version is for Vivid. My release is Trusty. They suggests to add the repository to sources.list but I don't know if is it safe to add a repository of different (later) release. What if in the future I'll try to do a release upgrade?
But on the other hand, if I decide to download and install the package manually, there are tons of dependencies calling themselves in a long chain and it's almost certain that I may be wrong.
What do you suggest?

Robert C. Helling

unread,
Aug 4, 2015, 5:11:00 AM8/4/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
I am building subsurface on a Mac and there relying on packaged Qt turned out to be not practical. Thus I directly download the sources from the Qt website and build them (that admittedly takes a while). But except for the time this works without any problems. The same might be true for you.

Best
Robert

PS: A starting point would be https://www.qt.io/download-open-source/ 

Miika Turkia

unread,
Aug 4, 2015, 5:14:18 AM8/4/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org

For the time being, I have just deleted the offending few lines of code from the printing support on my secondary Ubuntu 14.04 LTS box that complains the same on the official sources. (I do not need printing on this machine, so it is no issue for me if the printing is broken by myself.)

miika

Francesco Ganozzi

unread,
Aug 4, 2015, 8:13:41 AM8/4/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
First let me thank you, guys.
I have fear to break my system. I'm confused... I'll try to explain my doubts distinguishing between the two answers.

To Robert:
do you think that I must first uninstall the official qt5 dev package (qt5-default) before compile qt from the sources? What happens to qtchooser (I don't know very well what I'm talking about)? How can my system "link" itself with this manual compiled/installed package? I have to do something?

To Miika:
do you mean that I have to reclone Subsurface from git and then, before launching build.sh, I have to search a file named printer.cpp and comment out some lines? Lines 147-148? Or an entire method? What method? (I'm not a C programmer and I don't know if the commented part is used elsewhere in the code).
However, if you don't have time to answer, I'll try it when I'll came back home and let you know.

Francesco Ganozzi

unread,
Aug 4, 2015, 12:28:00 PM8/4/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
Miikaaa...
I've recloned Subsurface, commented out lnn 147-148 in printer.cpp and launched build.sh. Operation succesfully completed. Exit code: 0.
When I try to launch ~/src/install-root/bin/subsurface, I have: "error while loading shared libraries: libgit2.so.22: cannot open shared object file: No such file or directory".
After a while I found ~/src/install-root/lib/libgit2.so.0.22.0. Is it enough and is it correct to do this:

ldconfig -n ~/src/install-root/lib/
cd
~/src/install-root/lib/
ln -s libgit2.so.0.22.0 libgit2.so.22

and then relaunch Subsurface?

Tomaz Canabrava

unread,
Aug 4, 2015, 12:29:40 PM8/4/15
to Francesco Ganozzi, Subsurface Divelog

You can also set the ld_library_path to the directory where the libgit is, it should work.

Miika Turkia

unread,
Aug 4, 2015, 12:34:57 PM8/4/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org

Weird that you are missing that symbolic link. Here is what I have on my system:

lrwxrwxrwx 1 mturkia mturkia      13 Apr 23 01:18 ./install-root/lib/libgit2.so -> libgit2.so.22
lrwxrwxrwx 1 mturkia mturkia      17 Apr 23 01:18 ./install-root/lib/libgit2.so.22 -> libgit2.so.0.22.0
-rw-r--r-- 1 mturkia mturkia 1102440 Jun 11 17:59 ./install-root/lib/libgit2.so.0.22.0

It should be enough to have these symbolic links and relaunching Subsurface, unless there is also something else amiss.

miika

Francesco Ganozzi

unread,
Aug 6, 2015, 5:56:27 AM8/6/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
It works. My situation in install-root/lib/ was the same as Miika's but the program still wasn't working. This is what I've done.
  • Searched for the lost links:

    ldd ~/src/install-root/bin/subsurface | grep found

    Res: libgit2.so.22, libGrantlee_Templates.so.5, libssrfmarblewidget.so.21

  • Searched for the real name of libgit2 package from official repositories:

    ~$ apt-cache search libgit2
    libgit2-0
    libgit2-dev
    ~$ dpkg -l libgit2-0
    ii
    ...
    ~$ dpkg -l libgit2-dev
    ii
    ...
    ~$ dpkg -L libgit2-dev #for the list of installed file, to find the position for the link
    ... /usr/lib/x86_64-linux-gnu/ ... #the position

  • Searched for the right file in install-root:
    
    
    ~$ cd ~/src/ ~$ find . -type f -name "libgit2*"
    ...
    ./install-root/lib/libgit2.so.0.22.0 #the origin of the links (I knew this, but this if what I've done for the others library)
    ...

  • Created the symbolic link:
    
    
    ~$ sudo ln -s /home/gano/src/install-root/lib/libgit2.so.0.22.0 /usr/lib/x86_64-linux-gnu/libgit2.so.22

  • I don't had the official packages of the other libraries installed in my system, but with ldd ./install-root/bin/subsurface I knew that the most of the libraries were searched in /usr/lib/x86_64-linux-gnu/ and then, after another pair of find:
    
    
    ~$ sudo ln -s /home/gano/src/install-root/lib/libGrantlee_Templates.so.5.0.0 /usr/lib/x86_64-linux-gnu/libGrantlee_Templates.so.5 ~$ sudo ln -s /home/gano/src/install-root/lib/libssrfmarblewidget.so.0.21.3 /usr/lib/x86_64-linux-gnu/libssrfmarblewidget.so.21

  • Test:
    
    ~$ ./install-root/bin/subsurface
It works.
Miika, Tomaz, Robert... Again, thank you!

Miika Turkia

unread,
Aug 6, 2015, 6:36:19 AM8/6/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
Excellent that it is working now. However, the  linking issue is still quite strange, as it should do the right thing automatically. Can you send me the build.log from the main directory from where the subsurface/scripts/build.sh is run. This might reveal what went wrong during the build so we can fix it.


Francesco Ganozzi

unread,
Aug 6, 2015, 7:36:03 AM8/6/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
I send it to you in the evening

Miika Turkia

unread,
Aug 7, 2015, 11:07:13 AM8/7/15
to Subsurface Divelog, francesc...@gmail.com, tcana...@kde.org
On Thursday, August 6, 2015 at 2:36:03 PM UTC+3, Francesco Ganozzi wrote:
I send it to you in the evening

The log file looked quite normal to me. I didn't spot anything that would have explained the missing symlinks.
Reply all
Reply to author
Forward
0 new messages