grenaud / deML

Maximum likelihood demultiplexing
GNU General Public License v3.0
46 stars 14 forks source link

error when compiling on ubuntu 22.04 #18

Open schimar opened 1 year ago

schimar commented 1 year ago

Hi Gerard,

I was hoping to use deML to recover reads from the undetermined*.fastq.gz, after running bcl2fastq2. On Ubuntu 22.04 (with git 2.34.1 & cmake 3.22.1), I get the following, when running make:

rm -rf SimpleJSON/
git clone --recursive https://github.com/MJPA/SimpleJSON.git
Cloning into 'SimpleJSON'...
remote: Enumerating objects: 325, done.
remote: Total 325 (delta 0), reused 0 (delta 0), pack-reused 325
Receiving objects: 100% (325/325), 77.22 KiB | 2.34 MiB/s, done.
Resolving deltas: 100% (162/162), done.
make -C SimpleJSON
make[1]: Entering directory '/home/schimar/bio/deML/SimpleJSON'
g++ -c -Wall src/JSON.cpp -o obj/JSON.o
g++ -c -Wall src/JSONValue.cpp -o obj/JSONValue.o
g++ -c -Wall src/demo/nix-main.cpp -o obj/demo/nix-main.o
g++ -c -Wall src/demo/example.cpp -o obj/demo/example.o
g++ -c -Wall src/demo/testcases.cpp -o obj/demo/testcases.o
g++ -lm obj/JSON.o obj/JSONValue.o obj/demo/nix-main.o obj/demo/example.o obj/demo/testcases.o -o JSONDemo
make[1]: Leaving directory '/home/schimar/bio/deML/SimpleJSON'
cd bamtools/ && git reset --hard d24d850de17134fe4e7984b26493c5c0a1844b35 && mkdir -p build/  && cd build/ && if cmake ..; then echo ""; else if cmake3 ..; then echo ""; else echo "cmake failed, please install cmake v3"; fi  fi && make && cd ../..
HEAD is now at d24d850 Cut 2.5.1 release
CMake Deprecation Warning at CMakeLists.txt:20 (cmake_policy):
  The OLD behavior for policy CMP0042 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
-- Checking for one of the modules 'jsoncpp>=1'
Did NOT find system JsonCpp, instead using bundled version
-- Configuring done
-- Generating done
-- Build files have been written to: /home/schimar/bio/deML/bamtools/build

make[1]: Entering directory '/home/schimar/bio/deML/bamtools/build'
make[2]: Entering directory '/home/schimar/bio/deML/bamtools/build'
make[3]: Entering directory '/home/schimar/bio/deML/bamtools/build'
make[3]: Leaving directory '/home/schimar/bio/deML/bamtools/build'
make[3]: Entering directory '/home/schimar/bio/deML/bamtools/build'
make[3]: Leaving directory '/home/schimar/bio/deML/bamtools/build'
[  0%] Built target SharedHeaders
make[3]: Entering directory '/home/schimar/bio/deML/bamtools/build'
Consolidate compiler generated dependencies of target BamTools
make[3]: Leaving directory '/home/schimar/bio/deML/bamtools/build'
make[3]: Entering directory '/home/schimar/bio/deML/bamtools/build'
[  1%] Building CXX object src/api/CMakeFiles/BamTools.dir/internal/bam/BamMultiReader_p.cpp.o
In file included from /usr/include/c++/11/map:60,
                 from /home/schimar/bio/deML/bamtools/src/api/BamMultiReader.h:13,
                 from /home/schimar/bio/deML/bamtools/src/api/internal/bam/BamMultiReader_p.h:25,
                 from /home/schimar/bio/deML/bamtools/src/api/internal/bam/BamMultiReader_p.cpp:10:
/usr/include/c++/11/bits/stl_tree.h: In instantiation of ‘static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type) [with _Key = BamTools::Internal::MergeItem; _Val = BamTools::Internal::MergeItem; _KeyOfValue = std::_Identity<BamTools::Internal::MergeItem>; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByName>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<BamTools::Internal::MergeItem>*]’:
/usr/include/c++/11/bits/stl_tree.h:2102:44:   required from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_equal_pos(const key_type&) [with _Key = BamTools::Internal::MergeItem; _Val = BamTools::Internal::MergeItem; _KeyOfValue = std::_Identity<BamTools::Internal::MergeItem>; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByName>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = BamTools::Internal::MergeItem]’
/usr/include/c++/11/bits/stl_tree.h:2151:4:   required from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_equal(_Arg&&) [with _Arg = const BamTools::Internal::MergeItem&; _Key = BamTools::Internal::MergeItem; _Val = BamTools::Internal::MergeItem; _KeyOfValue = std::_Identity<BamTools::Internal::MergeItem>; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByName>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree<BamTools::Internal::MergeItem, BamTools::Internal::MergeItem, std::_Identity<BamTools::Internal::MergeItem>, BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByName>, std::allocator<BamTools::Internal::MergeItem> >::iterator]’
/usr/include/c++/11/bits/stl_multiset.h:503:36:   required from ‘std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = BamTools::Internal::MergeItem; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByName>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<BamTools::Internal::MergeItem, BamTools::Internal::MergeItem, std::_Identity<BamTools::Internal::MergeItem>, BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByName>, std::allocator<BamTools::Internal::MergeItem> >::const_iterator; std::multiset<_Key, _Compare, _Alloc>::value_type = BamTools::Internal::MergeItem]’
/home/schimar/bio/deML/bamtools/src/api/internal/bam/BamMultiMerger_p.h:135:18:   required from ‘void BamTools::Internal::MultiMerger<Compare>::Add(BamTools::Internal::MergeItem) [with Compare = BamTools::Algorithms::Sort::ByName]’
/home/schimar/bio/deML/bamtools/src/api/internal/bam/BamMultiMerger_p.h:128:13:   required from here
/usr/include/c++/11/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
  770 |               is_invocable_v<const _Compare&, const _Key&, const _Key&>,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByName>&, const BamTools::Internal::MergeItem&, const BamTools::Internal::MergeItem&>’ evaluates to false
/usr/include/c++/11/bits/stl_tree.h: In instantiation of ‘static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type) [with _Key = BamTools::Internal::MergeItem; _Val = BamTools::Internal::MergeItem; _KeyOfValue = std::_Identity<BamTools::Internal::MergeItem>; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByPosition>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<BamTools::Internal::MergeItem>*]’:
/usr/include/c++/11/bits/stl_tree.h:2102:44:   required from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_equal_pos(const key_type&) [with _Key = BamTools::Internal::MergeItem; _Val = BamTools::Internal::MergeItem; _KeyOfValue = std::_Identity<BamTools::Internal::MergeItem>; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByPosition>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = BamTools::Internal::MergeItem]’
/usr/include/c++/11/bits/stl_tree.h:2151:4:   required from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_equal(_Arg&&) [with _Arg = const BamTools::Internal::MergeItem&; _Key = BamTools::Internal::MergeItem; _Val = BamTools::Internal::MergeItem; _KeyOfValue = std::_Identity<BamTools::Internal::MergeItem>; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByPosition>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree<BamTools::Internal::MergeItem, BamTools::Internal::MergeItem, std::_Identity<BamTools::Internal::MergeItem>, BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByPosition>, std::allocator<BamTools::Internal::MergeItem> >::iterator]’
/usr/include/c++/11/bits/stl_multiset.h:503:36:   required from ‘std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = BamTools::Internal::MergeItem; _Compare = BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByPosition>; _Alloc = std::allocator<BamTools::Internal::MergeItem>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<BamTools::Internal::MergeItem, BamTools::Internal::MergeItem, std::_Identity<BamTools::Internal::MergeItem>, BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByPosition>, std::allocator<BamTools::Internal::MergeItem> >::const_iterator; std::multiset<_Key, _Compare, _Alloc>::value_type = BamTools::Internal::MergeItem]’
/home/schimar/bio/deML/bamtools/src/api/internal/bam/BamMultiMerger_p.h:135:18:   required from ‘void BamTools::Internal::MultiMerger<Compare>::Add(BamTools::Internal::MergeItem) [with Compare = BamTools::Algorithms::Sort::ByPosition]’
/home/schimar/bio/deML/bamtools/src/api/internal/bam/BamMultiMerger_p.h:128:13:   required from here
/usr/include/c++/11/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
/usr/include/c++/11/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const BamTools::Internal::MergeItemSorter<BamTools::Algorithms::Sort::ByPosition>&, const BamTools::Internal::MergeItem&, const BamTools::Internal::MergeItem&>’ evaluates to false
make[3]: *** [src/api/CMakeFiles/BamTools.dir/build.make:244: src/api/CMakeFiles/BamTools.dir/internal/bam/BamMultiReader_p.cpp.o] Error 1
make[3]: Leaving directory '/home/schimar/bio/deML/bamtools/build'
make[2]: *** [CMakeFiles/Makefile2:318: src/api/CMakeFiles/BamTools.dir/all] Error 2
make[2]: Leaving directory '/home/schimar/bio/deML/bamtools/build'
make[1]: *** [Makefile:136: all] Error 2
make[1]: Leaving directory '/home/schimar/bio/deML/bamtools/build'
make: *** [Makefile:32: bamtools/build/src/api/libbamtools.a] Error 2

Thanks for your help! All the best, Martin

grenaud commented 1 year ago

Hi Martin, My apologies that you're having problems compiling! I I just compiled the program and it compiled fine. I I think the disconnect is from the version of C++:

$ cmake --version cmake version 3.16.3

CMake suite maintained and supported by Kitware (kitware.com/cmake). $g++ --version g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

Can you either downgrade g++ to 9 or use the static binary?

Gabriel

schimar commented 1 year ago

Hi Gerard,

thanks for your quick response!

I created a conda env with cmake==3.16.3 & g++==9.4.0. In there, I do seem to get further, but eventually am getting the infamous zlib.h error:

[  1%] Building CXX object src/api/CMakeFiles/BamTools.dir/internal/io/BgzfStream_p.cpp.o
/home/schimar/bio/deML/bamtools/src/api/internal/io/BgzfStream_p.cpp:20:10: fatal error: zlib.h: No such file or directory

I definitely have zlib1g-dev installed, but I'm not the best when it comes to C/C++. Do you know if I can tell make where to look for zlib.h? (/usr/include/zlib.h)

Thanks a lot & all the best, Martin

grenaud commented 1 year ago

but do you have zlib within your conda env?

schimar commented 1 year ago

yes, of course...

grenaud commented 1 year ago

you ran: conda install -c anaconda zlib

schimar commented 1 year ago

I ran

mamba env create -f env.yaml

with the following (env.yaml):

name: deML
channels:
  - conda-forge
  - bioconda
  - anaconda 
dependencies:
  - gxx==9.4.0
  - cmake==3.16.3
  - zlib
grenaud commented 1 year ago

ok I am really bad at conda, can you use the static bin for now?