sib-swiss / pftools3

A suite of tools to build and search generalized profiles
GNU General Public License v2.0
10 stars 7 forks source link

-DUSE_AFFINITY=OFF -> error: field 'LastModification' has incomplete type #25

Closed lecorguille closed 2 years ago

lecorguille commented 3 years ago

According to this issue, I should compile pftools3 with the cmake option -DUSE_AFFINITY=OFF

My Singularity definition

Bootstrap: docker
From: ubuntu:20.04

%post

    # Install dependencies
    ## From apt
    export DEBIAN_FRONTEND=noninteractive
    apt-get -qq update && apt-get -qq upgrade -y
    apt-get -qq install -y wget tar

    # PFTOOLS3
    # @TODO: remove when this issue is fixed: https://github.com/ebi-pf-team/interproscan/issues/215
    # According to: https://github.com/sib-swiss/pftools3/blob/master/Docker/Dockerfile
    apt-get -qq install -y --no-install-recommends \
      build-essential \
      libpcre++-dev \
      gfortran \
      libgfortran5 \
      ca-certificates \
      git \
      cmake \
      zlib1g-dev \
      libpng-dev \
      libfile-slurp-perl
    cd /opt/
    wget https://github.com/sib-swiss/pftools3/archive/refs/tags/v3.2.10.tar.gz
    tar -zxf v3.2.10.tar.gz
    mkdir pftools3-3.2.10/build
    cd pftools3-3.2.10/build
    cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/opt/interproscan/prosite/ -DCMAKE_BUILD_TYPE=Release -DUSE_GRAPHICS=OFF -DUSE_PDF=OFF -DUSE_AFFINITY=OFF
    make
    make install
    make test
    cd /opt/
    rm -rf v3.2.10.tar.gz pftools3-3.2.10

The compilation output:

+ cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/opt/interproscan/prosite/ -DUSE_AFFINITY=OFF
-- +--------------------------------------------------------------------+
-- |                          PfTools   v3.2.10                          |
-- +--------------------------------------------------------------------+
-- |     (C) Copyright SIB Swiss Institute of Bioinformatics            |
-- |         Thierry Schuepbach (projects@vital-it.ch)                  |
-- |                                                                    |
-- |     PfTools is available from                                      |
-- |         https://github.com/sib-swiss/pftools3                      |
-- |     under the GPL v2. See LICENSE.                                 |
-- |                                                                    |
-- +--------------------------------------------------------------------+
-- The Fortran compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- Check for working Fortran compiler: /usr/bin/f95
-- Check for working Fortran compiler: /usr/bin/f95  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/f95 supports Fortran 90
-- Checking whether /usr/bin/f95 supports Fortran 90 -- yes
-- 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
-- Detecting C compile features
-- Detecting C compile features - done
-- Compilation on architecture x86_64.
-- Performing Test HANDLE_SSE
-- Performing Test HANDLE_SSE - Success
-- Performing Test HANDLE_SSE2
-- Performing Test HANDLE_SSE2 - Success
-- testing flag -msse4.1...
-- Performing Test HANDLE_SSE41
-- Performing Test HANDLE_SSE41 - Success
-- Performing Test HANDLE_C99
-- Performing Test HANDLE_C99 - Success
-- Add -std=c99 to C compiler options
-- Add SSE2 to C compiler options
-- Performing Test MS_EXTENSION
-- Performing Test MS_EXTENSION - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Perl: /usr/bin/perl (found version "5.30.0")
-- Perl found - full test suite usable
-- Found PCRE: /usr/lib/x86_64-linux-gnu/libpcre.so
-- Looking for include file emmintrin.h
-- Looking for include file emmintrin.h - found
-- Looking for include file smmintrin.h
-- Looking for include file smmintrin.h - found
-- Looking for include file mm_malloc.h
-- Looking for include file mm_malloc.h - found
-- Looking for include file alloca.h
-- Looking for include file alloca.h - found
-- Check Perl script syntax
       compare_2_profiles.pl
           - syntax OK
       fasta_to_fastq.pl
           - syntax OK
       make_iupac_cmp.pl
           - syntax OK
       ps_scan.pl
           - syntax OK
       scramble_fasta.pl
           - syntax OK
       sort_fasta.pl
           - syntax OK
       split_profile_file.pl
           - syntax OK
--
-- PfTools Software Suite configuration summary:
--
--   System name ......................: Linux
--   Build type .......................: Release
--
--   Integer format ...................: 16 bits
--
--   Install prefix .................. : /opt/interproscan/prosite
--   C compiler ...................... : /usr/bin/cc
--   Fortran compiler ................ : /usr/bin/f95
--   C compiler flags ................ :  -std=c99 -msse2 -fms-extensions -O3 -DNDEBUG
--   C compiler SSE2 flag. ........... : -msse2
--   C compiler SSE 4.1 flag.......... : -msse4.1
--   Fortran compiler flags .......... :  -O3 -DNDEBUG -O3
--
--   Use file memory mapping ..........: ON
--   Use thread affinity setting ......: OFF
--
--   Build shared libs ............... : OFF
--   Build static libs ............... : OFF
--   Build static executables......... : OFF
--
--   Link with pcre .................. : ON
--
!! CPU thread affinity is disabled, hence performance penalty may apply on many-core architecture.
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/pftools3-3.2.10/build
+ make
-- +--------------------------------------------------------------------+
-- |                          PfTools   v3.2.10                          |
-- +--------------------------------------------------------------------+
-- |     (C) Copyright SIB Swiss Institute of Bioinformatics            |
-- |         Thierry Schuepbach (projects@vital-it.ch)                  |
-- |                                                                    |
-- |     PfTools is available from                                      |
-- |         https://github.com/sib-swiss/pftools3                      |
-- |     under the GPL v2. See LICENSE.                                 |
-- |                                                                    |
-- +--------------------------------------------------------------------+
-- Compilation on architecture x86_64.
-- testing flag -msse4.1...
-- Add -std=c99 to C compiler options
-- Add SSE2 to C compiler options
-- Perl found - full test suite usable
-- Building test suite for pfsearch in /opt/pftools3-3.2.10/Tests
-- Check Perl script syntax
       compare_2_profiles.pl
           - syntax OK
       fasta_to_fastq.pl
           - syntax OK
       make_iupac_cmp.pl
           - syntax OK
       ps_scan.pl
           - syntax OK
       scramble_fasta.pl
           - syntax OK
       sort_fasta.pl
           - syntax OK
       split_profile_file.pl
           - syntax OK
--
-- PfTools Software Suite configuration summary:
--
--   System name ......................: Linux
--   Build type .......................: Release
--
--   Integer format ...................: 16 bits
--
--   Install prefix .................. : /opt/interproscan/prosite
--   C compiler ...................... : /usr/bin/cc
--   Fortran compiler ................ : /usr/bin/f95
--   C compiler flags ................ :  -std=c99 -msse2 -fms-extensions -O3 -DNDEBUG
--   C compiler SSE2 flag. ........... : -msse2
--   C compiler SSE 4.1 flag.......... : -msse4.1
--   Fortran compiler flags .......... :  -O3 -DNDEBUG -O3
--
--   Use file memory mapping ..........: ON
--   Use thread affinity setting ......: OFF
--
--   Build shared libs ............... : OFF
--   Build static libs ............... : OFF
--   Build static executables......... : OFF
--
--   Link with pcre .................. : ON
--
!! CPU thread affinity is disabled, hence performance penalty may apply on many-core architecture.
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/pftools3-3.2.10/build
Scanning dependencies of target REGEXP
[  1%] Building C object src/C/CMakeFiles/REGEXP.dir/utils/pfregexp.c.o
[  1%] Built target REGEXP
Scanning dependencies of target OUTPUT_FORMAT
[  2%] Building C object src/C/utils/CMakeFiles/OUTPUT_FORMAT.dir/output.c.o
In file included from /opt/pftools3-3.2.10/src/C/utils/output.c:14:
/opt/pftools3-3.2.10/src/C/utils/../include/pfSequence.h:50:18: error: field 'LastModification' has incomplete type
   50 |  struct timespec LastModification;
      |                  ^~~~~~~~~~~~~~~~
make[2]: *** [src/C/utils/CMakeFiles/OUTPUT_FORMAT.dir/build.make:63: src/C/utils/CMakeFiles/OUTPUT_FORMAT.dir/output.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1579: src/C/utils/CMakeFiles/OUTPUT_FORMAT.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
FATAL:   While performing build: while running engine: exit status 2

It succeed without the -DUSE_AFFINITY=OFF option

Juke34 commented 3 years ago

I would be easier to use directly the container: https://quay.io/repository/biocontainers/pftools it contains pftools3 now

lecorguille commented 3 years ago

@Juke34 According to the conda build, it isn't compile with -DUSE_AFFINITY=OFF https://github.com/bioconda/bioconda-recipes/blob/master/recipes/pftools/build.sh

smoretti commented 3 years ago

@Juke34 It looks to happen with recent kernel and/or glibc e.g. with Rocky Linux 8

duboism commented 3 years ago

I confirm it happens on recent Fedora releases.

I think that this is related to the _GNU_SOURCE preprocessor macro: when using -DUSE_AFFINITY=OFF, USE_AFFINITY is not define and so _GNU_SOURCE isn't defined too (see the generated config.h file); if I manually define _GNU_SOURCE in config.h, the compilation goes fine. So I think that _GNU_SOURCE should always be defined (independently of USE_AFFINITY). I don't know cmake enough to do that.

smoretti commented 3 years ago

I will try this...

duboism commented 3 years ago

Great. Let me know if I can help, I think I understood a (not too ugly) way to do it.

smoretti commented 3 years ago

Thanks to @duboism I think I have now fixed this issue. The fix is in the develop branch

marcadella commented 3 years ago

Tried it and it worked.

lecorguille commented 3 years ago

The same 👍