bioconda / bioconda-recipes

Conda recipes for the bioconda channel.
https://bioconda.github.io
MIT License
1.65k stars 3.29k forks source link

Cannot compile C++ program #35603

Closed weber8thomas closed 10 months ago

weber8thomas commented 2 years ago

Hi everyone,

I'm trying to make a PR of this program (https://github.com/weber8thomas/mosaicatcher).

I made several tentatives but I always get the same error relative to a C++ compilation. I am not heavy familiar with C++ but when I compare the compilation logs between my own computer and the Azure test_linux one, it looks like the Boost libraries are found, but the PkgConfig package is not detected, thus htslib libraries are also not detected by the system.

The compilation is done in two times by using first cmake and then make.

meta.yaml file

{% set version = "0.3" %}
{% set sha256 = "550e3ae73e6a2fbc049db264ee8cb3904da006338598def0b76c22e7694f7fa8" %}

package:
  name: mosaic
  version: {{ version }}

source:
  url: https://github.com/weber8thomas/mosaicatcher/archive/refs/tags/{{ version }}.tar.gz
  sha256: '{{sha256}}'

build:
  number: 0

requirements:
  build:
    - boost-cpp=1.72.0
    - cmake=3.16.4
    - htslib=1.10.2
    - make=4.3
    - pkg-config=0.29.2
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}

  host:
    - htslib
    - boost-cpp

  run:
    - htslib
    - boost-cpp

test:
  commands:
    - mosaic --help

about:
  home: https://github.com/friendsofstrandseq/mosaicatcher/
  license: MIT License
  summary: 'mosaic: counts Strand-seq reads and classifies strand states of each chromosome in each cell using a Hidden Markov Model.'
  license_family: MIT

build.sh file

#!/bin/bash

# Ensure we run successfully using either conda-forge or defaults ncurses
# (unlike other platforms, the latter does not automatically pull in libtinfo)

export CFLAGS="-I$PREFIX/include"
export LDFLAGS="-L$PREFIX/lib"
export CPATH=${PREFIX}/include

mkdir build
cd build
cmake ../src
make CC="${CC}" CXX="${CXX}" LDFLAGS="${LDFLAGS}" -lhts

First step: cmake command

Here is the output of the compilation of cmake on my own computer:

-- The CXX compiler identification is GNU 7.3.0
-- Check for working CXX compiler: /home/tweber/.conda/envs/strandseqnation/bin/x86_64-conda_cos6-linux-gnu-c++
-- Check for working CXX compiler: /home/tweber/.conda/envs/strandseqnation/bin/x86_64-conda_cos6-linux-gnu-c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Boost: /home/tweber/.conda/envs/strandseqnation/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version "1.72.0", minimum required is "1.50") found components: system date_time filesystem iostreams program_options

# Missing part in bioconda-recipe compilation
----------------------------------------------
-- Found PkgConfig: /home/tweber/.conda/envs/strandseqnation/bin/pkg-config (found version "0.29.2")
-- Checking for module 'htslib'
--   Found htslib, version 1.10.2
--    HTSlib include dirs: /home/tweber/.conda/envs/strandseqnation/include
--    HTSlib libraries: -L/home/tweber/.conda/envs/strandseqnation/lib;-lhts
----------------------------------------------

fatal: not a git repository (or any parent up to mount point /g)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /g)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
Need Doxygen to produce API documentation. This is skipped.
-- Configuring done
-- Generating done
-- Build files have been written to: /g/korbel2/weber/workspace/mosaic_test/build

The output of the compilation of cmake using the bioconda-recipe:

INFO:bioconda_utils.utils:(OUT) -- The CXX compiler identification is GNU 10.3.0
08:09:45 BIOCONDA INFO (OUT) -- The CXX compiler identification is GNU 10.3.0
INFO:bioconda_utils.utils:(OUT) -- Check for working CXX compiler: $BUILD_PREFIX/bin/x86_64-conda-linux-gnu-c++
08:09:45 BIOCONDA INFO (OUT) -- Check for working CXX compiler: $BUILD_PREFIX/bin/x86_64-conda-linux-gnu-c++
INFO:bioconda_utils.utils:(OUT) -- Check for working CXX compiler: $BUILD_PREFIX/bin/x86_64-conda-linux-gnu-c++ -- works
08:09:45 BIOCONDA INFO (OUT) -- Check for working CXX compiler: $BUILD_PREFIX/bin/x86_64-conda-linux-gnu-c++ -- works
INFO:bioconda_utils.utils:(OUT) -- Detecting CXX compiler ABI info
08:09:45 BIOCONDA INFO (OUT) -- Detecting CXX compiler ABI info
INFO:bioconda_utils.utils:(OUT) -- Detecting CXX compiler ABI info - done
08:09:45 BIOCONDA INFO (OUT) -- Detecting CXX compiler ABI info - done
INFO:bioconda_utils.utils:(OUT) -- Detecting CXX compile features
08:09:45 BIOCONDA INFO (OUT) -- Detecting CXX compile features
INFO:bioconda_utils.utils:(OUT) -- Detecting CXX compile features - done
08:09:45 BIOCONDA INFO (OUT) -- Detecting CXX compile features - done
INFO:bioconda_utils.utils:(OUT) -- Found Boost: $PREFIX/lib/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.50") found components: system date_time filesystem iostreams program_options
08:09:45 BIOCONDA INFO (OUT) -- Found Boost: $PREFIX/lib/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.50") found components: system date_time filesystem iostreams program_options
INFO:bioconda_utils.utils:(OUT) fatal: not a git repository (or any of the parent directories): .git
08:09:45 BIOCONDA INFO (OUT) fatal: not a git repository (or any of the parent directories): .git
INFO:bioconda_utils.utils:(OUT) fatal: not a git repository (or any of the parent directories): .git
08:09:45 BIOCONDA INFO (OUT) fatal: not a git repository (or any of the parent directories): .git
INFO:bioconda_utils.utils:(OUT) fatal: not a git repository (or any of the parent directories): .git
08:09:45 BIOCONDA INFO (OUT) fatal: not a git repository (or any of the parent directories): .git
INFO:bioconda_utils.utils:(OUT) -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
08:09:45 BIOCONDA INFO (OUT) -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
INFO:bioconda_utils.utils:(OUT) Need Doxygen to produce API documentation. This is skipped.
08:09:45 BIOCONDA INFO (OUT) Need Doxygen to produce API documentation. This is skipped.
INFO:bioconda_utils.utils:(OUT) -- Configuring done
08:09:45 BIOCONDA INFO (OUT) -- Configuring done
INFO:bioconda_utils.utils:(OUT) -- Generating done
08:09:45 BIOCONDA INFO (OUT) -- Generating done
INFO:bioconda_utils.utils:(OUT) -- Build files have been written to: $SRC_DIR/build
08:09:45 BIOCONDA INFO (OUT) -- Build files have been written to: $SRC_DIR/build

Second step: make command

Error using the bioconda-recipe:

INFO:bioconda_utils.utils:(OUT) /opt/conda/conda-bld/mosaic_1656662817729/_build_env/bin/../lib/gcc/x86_64-conda-linux-gnu/10.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: CMakeFiles/mosaic.dir/main.cpp.o: in function `interval::read_exclude_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bam_hdr_t*, std::vector<interval::Interval, std::allocator<interval::Interval> >&, bool)':
08:10:48 BIOCONDA INFO (OUT) /opt/conda/conda-bld/mosaic_1656662817729/_build_env/bin/../lib/gcc/x86_64-conda-linux-gnu/10.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: CMakeFiles/mosaic.dir/main.cpp.o: in function `interval::read_exclude_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bam_hdr_t*, std::vector<interval::Interval, std::allocator<interval::Interval> >&, bool)':
INFO:bioconda_utils.utils:(OUT) main.cpp:(.text._ZN8interval17read_exclude_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP9bam_hdr_tRSt6vectorINS_8IntervalESaISB_EEb+0x3e7): undefined reference to `bam_name2id'
08:10:48 BIOCONDA INFO (OUT) main.cpp:(.text._ZN8interval17read_exclude_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP9bam_hdr_tRSt6vectorINS_8IntervalESaISB_EEb+0x3e7): undefined reference to `bam_name2id'
INFO:bioconda_utils.utils:(OUT) collect2: error: ld returned 1 exit status
08:10:48 BIOCONDA INFO (OUT) collect2: error: ld returned 1 exit status
INFO:bioconda_utils.utils:(OUT) make[2]: *** [CMakeFiles/mosaic.dir/build.make:89: mosaic] Error 1
08:10:48 BIOCONDA INFO (OUT) make[2]: *** [CMakeFiles/mosaic.dir/build.make:89: mosaic] Error 1
INFO:bioconda_utils.utils:(OUT) make[2]: Leaving directory '$SRC_DIR/build'
08:10:48 BIOCONDA INFO (OUT) make[2]: Leaving directory '$SRC_DIR/build'
INFO:bioconda_utils.utils:(OUT) make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/mosaic.dir/all] Error 2
08:10:48 BIOCONDA INFO (OUT) make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/mosaic.dir/all] Error 2
INFO:bioconda_utils.utils:(OUT) make: *** [Makefile:84: all] Error 2
08:10:48 BIOCONDA INFO (OUT) make: *** [Makefile:84: all] Error 2
INFO:bioconda_utils.utils:(OUT) make[1]: Leaving directory '$SRC_DIR/build'
08:10:48 BIOCONDA INFO (OUT) make[1]: Leaving directory '$SRC_DIR/build'

Many thanks in advance for your help !

Thomas

siebrenf commented 2 years ago

In the meta.yaml, try adding a space between each package and version pin: pkg-config=0.29.2 -> - pkg-config =0.29.2

and update bioconda-utils to get rid of the double logging :)