[Debian-med-packaging] How to use libgtest-dev in packaging projects (Was: ABySS version is out of date)

Sebastien Jodogne s.jodogne at chu.ulg.ac.be
Wed Sep 17 06:46:16 UTC 2014


Hi Andreas,

Orthanc also depends on Google Test and is properly packaged for Debian.

I introduced a CMake parameter "USE_GTEST_DEBIAN_SOURCE_PACKAGE" in the 
upstream to make it work. This parameter enables the following CMake 
section [1]:

=====
   set(GTEST_SOURCES /usr/src/gtest/src/gtest-all.cc)
   include_directories(/usr/src/gtest)

   if (NOT EXISTS /usr/include/gtest/gtest.h OR
       NOT EXISTS ${GTEST_SOURCES})
     message(FATAL_ERROR "Please install the libgtest-dev package")
   endif()
=====

HTH,
Sébastien-

[1] 
https://code.google.com/p/orthanc/source/browse/Resources/CMake/GoogleTestConfiguration.cmake



On 09/17/2014 08:40 AM, Andreas Tille wrote:
> Hi,
>
> when trying to upgrade the abyss packaging
> (git://git.debian.org/git/debian-med/abyss.git) I realised that the test
> framework which switched to gtest is not as easy to use in packaging as
> I expected.  According to README.Debian of libgtest-dev (which is in
> line what Anthony wrote below) you need to build the test framework
> first before you can use it.
>
> I wonder how this can be done in the packaging process and whether we
> have any example for doing this.
>
> Kind regards
>
>          Andreas.
>
> On Tue, Sep 16, 2014 at 04:48:12PM -0700, Anthony Raymond wrote:
>> Hi Andreas,
>>
>> I also had to compile the source that is part of the gtest package:
>> sudo apt-get install libgtest-dev
>> cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/ && cd -
>>
>> I'm not sure of the best way to include gtest, but I found the above. How do others use the gtest install from debian?
>>
>> Thanks,
>> Tony
>>
>> On 2014-09-16, at 3:25 PM, Andreas Tille wrote:
>>
>> Hi Anthony,
>>
>> On Tue, Sep 16, 2014 at 02:13:33PM -0700, Anthony Raymond wrote:
>> Hi Andreas, Steve,
>>
>> I had to follow the instructions on this post to build libgtest.a and libgtest_main.a:
>> http://askubuntu.com/questions/145887/why-no-library-files-installed-for-google-test
>>
>> Then I also had to add a check for libgtest in order to include -lgtest when compiling the tests (see attached patch). I haven't had to do this when I compile the gtest library myself, but it's not a big deal to add.
>>
>> Thanks for the patch.  I applied the patch to the packaging but with no
>> effect (=got the same error as below). :-(
>>
>> Kind regards
>>
>>        Andreas.
>>
>> ...
>> I commited the packaging for abyss 1.5.2 into our packaging git[1].
>> Unfortunately it fails to run the unit tests since the build ended with
>>
>> ...
>> make[2]: Entering directory '/tmp/buildd/abyss-1.5.2/GapFiller'
>> make[2]: Nothing to be done for 'check'.
>> make[2]: Leaving directory '/tmp/buildd/abyss-1.5.2/GapFiller'
>> make[2]: Entering directory '/tmp/buildd/abyss-1.5.2'
>> make[2]: Nothing to be done for 'check-am'.
>> make[2]: Leaving directory '/tmp/buildd/abyss-1.5.2'
>> error: To use 'make check' command, please setup
>>      gtest header&library as shown on the Wiki
>> Makefile:860: recipe for target 'check' failed
>> make[1]: *** [check] Error 1
>> make[1]: Leaving directory '/tmp/buildd/abyss-1.5.2'
>> dh_auto_test: make -j1 check returned exit code 2
>> debian/rules:6: recipe for target 'build' failed
>> make: *** [build] Error 2
>>
>>
>> While I dadded libgtest-dev to the Build-Depends and the build log says:
>>
>>
>> ...
>> checking for boost/unordered_set.hpp... yes
>> checking gtest/gtest.h usability... yes
>> checking gtest/gtest.h presence... yes
>> checking for gtest/gtest.h... yes
>> checking for pthread_create in -lpthread... yes
>> checking for main in -lgtest_main... no
>> checking for g++ option to support OpenMP... -fopenmp
>> checking that generated files are newer than configure... done
>> ...
>>
>>
>> I think the gtest headers are reasonably installed but I wonder what
>> "-lgtest_main... no" might mean, whether this is connected to the
>> problem and how to fix this (Steve as maintainer of libgtest-dev in
>> CC).
>>
>> While I could cowardly skip the unit tests I would really prefer to
>> run them.
>>
>> BTW, since you asked what you can do to get abyss packaged for Debian:
>> while the package is technically packaged it does not belong to the
>> Debian distribution since it is regarded as non-free due to its
>> licensing restriction to non-commercial use.  I wonder whether you might
>> consider with the people in charge to use a non-restricted license.
>> This would be really appreciated and if you want me to be more verbose
>> about the advantages I could go more into details.
>>
>> Kind regards
>>
>>       Andreas.
>>
>> [1] git://anonscm.debian.org/debian-med/abyss.git
>>
>> --
>> http://fam-tille.de
>>
>>
>>
>>
>>
>> --
>> http://fam-tille.de
>>
>
>> _______________________________________________
>> Debian-med-packaging mailing list
>> Debian-med-packaging at lists.alioth.debian.org
>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-packaging
>
>


-- 
Sébastien Jodogne, PhD.
Medical Imaging Engineer
Department of Medical Physics

C.H.U. - SART TILMAN - B35
BAT. T1-3 RADIOTHERAPIE
4000 Liège
BELGIUM

Tel 1: +32 4 3667518
Tel 2: +32 4 3667596
Mail: s.jodogne at chu.ulg.ac.be
Web: http://www.montefiore.ulg.ac.be/~jodogne/



More information about the Debian-med-packaging mailing list