Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling the argument parser test program #1199

Closed
ppericard opened this issue Jul 30, 2019 · 6 comments
Closed

Error compiling the argument parser test program #1199

ppericard opened this issue Jul 30, 2019 · 6 comments
Labels
bug faulty or wrong behaviour of code

Comments

@ppericard
Copy link

Hi,

I'm encountering a pb testing seqan3 and trying to go through the tutorial programs.

I compiled the first two tutorial programs without any error, but I have a fatal compiling error when trying to compile the minimal argument parser tutorial.
I tried with gcc-7 and gcc-9 and got 2 different errors.

Thanks in advance for your help

Cheers
Pierre

Platform

  • SeqAn version: latest as of today (a60194e)
  • Operating system: Linux ppericard-matam-dev 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Compiler: g++-7 (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 and g++-9 (Ubuntu 9.1.0-2ubuntu2~18.04) 9.1.0

Description

The argument parser tutorial program won't compile. The hello_world and debug stream tutorial programs are compiling and working without any pb (http://docs.seqan.de/seqan/3-master-user/tutorial_first_example.html)

How to repeat the problem

main.cpp.txt

(base) ubuntu@ppericard-matam-dev:~/data/ovgraphbuild2/source$ g++-7 -O3 -DNDEBUG -Wall -Wextra -std=c++17 -fconcepts -I ../seqan3/include -isystem ../seqan3/submodules/range-v3/include -isystem ../seqan3/submodules/sdsl-lite/include -isystem ../seqan3/submodules/cereal/include -DSEQAN3_HAS_ZLIB=1 -DSEQAN3_HAS_BZIP2=1 main.cpp
(base) ubuntu@ppericard-matam-dev:~/data/ovgraphbuild2/source$ g++-9 -O3 -DNDEBUG -Wall -Wextra -std=c++17 -fconcepts -I ../seqan3/include -isystem ../seqan3/submodules/range-v3/include -isystem ../seqan3/submodules/sdsl-lite/include -isystem ../seqan3/submodules/cereal/include -DSEQAN3_HAS_ZLIB=1 -DSEQAN3_HAS_BZIP2=1 main.cpp

I also tried using cmake and end up with the same error

Expected behaviour

The program should compile without error

Actual behaviour

(base) ubuntu@ppericard-matam-dev:~/data/ovgraphbuild2/source$ g++-7 -O3 -DNDEBUG -Wall -Wextra -std=c++17 -fconcepts -I ../seqan3/include -isystem ../seqan3/submodules/range-v3/include -isystem ../seqan3/submodules/sdsl-lite/include -isystem ../seqan3/submodules/cereal/include -DSEQAN3_HAS_ZLIB=1 -DSEQAN3_HAS_BZIP2=1 main.cpp
/tmp/cc6VdZcO.o: In function `std::experimental::filesystem::v1::__cxx11::path::path(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':
main.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2EONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNSt12experimental10filesystem2v17__cxx114pathC5EONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x5c): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/tmp/cc6VdZcO.o: In function `std::experimental::filesystem::v1::__cxx11::path::_M_append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114path9_M_appendERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNSt12experimental10filesystem2v17__cxx114path9_M_appendERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x4e): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/tmp/cc6VdZcO.o: In function `seqan3::detail::version_checker::get_path[abi:cxx11]()':
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x10b): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x1c4): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x239): undefined reference to `std::experimental::filesystem::v1::create_directory(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x25a): undefined reference to `std::experimental::filesystem::v1::temp_directory_path[abi:cxx11]()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x314): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x353): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x47b): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x49a): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x4e8): undefined reference to `std::experimental::filesystem::v1::remove(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x516): undefined reference to `std::experimental::filesystem::v1::remove_all(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x60a): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x651): undefined reference to `std::experimental::filesystem::v1::create_directory(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x6ed): undefined reference to `std::experimental::filesystem::v1::remove_all(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
/tmp/cc6VdZcO.o: In function `seqan3::detail::version_checker::decide_if_check_is_performed(bool, std::optional<bool>)':
main.cpp:(.text._ZN6seqan36detail15version_checker28decide_if_check_is_performedEbSt8optionalIbE[_ZN6seqan36detail15version_checker28decide_if_check_is_performedEbSt8optionalIbE]+0xa3): undefined reference to `std::experimental::filesystem::v1::status(std::experimental::filesystem::v1::__cxx11::path const&)'
/tmp/cc6VdZcO.o: In function `seqan3::detail::version_checker::operator()(std::promise<bool>)':
main.cpp:(.text._ZN6seqan36detail15version_checkerclESt7promiseIbE[_ZN6seqan36detail15version_checkerclESt7promiseIbE]+0x71d): undefined reference to `pthread_create'
/tmp/cc6VdZcO.o: In function `seqan3::detail::version_checker::version_checker(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text._ZN6seqan36detail15version_checkerC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_S9_[_ZN6seqan36detail15version_checkerC5ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_S9_]+0x367): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
main.cpp:(.text._ZN6seqan36detail15version_checkerC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_S9_[_ZN6seqan36detail15version_checkerC5ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_S9_]+0x460): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
collect2: error: ld returned 1 exit status
(base) ubuntu@ppericard-matam-dev:~/data/ovgraphbuild2/source$ g++-9 -O3 -DNDEBUG -Wall -Wextra -std=c++17 -fconcepts -I ../seqan3/include -isystem ../seqan3/submodules/range-v3/include -isystem ../seqan3/submodules/sdsl-lite/include -isystem ../seqan3/submodules/cereal/include -DSEQAN3_HAS_ZLIB=1 -DSEQAN3_HAS_BZIP2=1 main.cpp
/tmp/ccxHRYLb.o: In function `seqan3::detail::version_checker::operator()(std::promise<bool>)':
main.cpp:(.text._ZN6seqan36detail15version_checkerclESt7promiseIbE[_ZN6seqan36detail15version_checkerclESt7promiseIbE]+0x8f1): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
@ppericard ppericard added the bug faulty or wrong behaviour of code label Jul 30, 2019
@h-2
Copy link
Member

h-2 commented Jul 30, 2019

You are missing required linker arguments. These would have been added by CMake automatically 😉

With GCC7 you need to add -lstdc++fs (this is automatically added by GCC9.

For both of them you need to add -pthread which adds the threading support. Maybe we should make this clearer in the tutorial... However CMake really is the way to go!

@ppericard
Copy link
Author

ppericard commented Jul 30, 2019

Now it works fine with those arguments. Thanks ^^
But I should have been clearer, I started by using CMake following the tutorial, and this is when this error arose.
It seems that CMake didn't add them automatically.

cmake_minimum_required (VERSION 3.4)
project (seqan3_tutorial CXX)

set(SeqAn3_DIR "${CMAKE_SOURCE_DIR}/../seqan3/build_system")
find_package (SeqAn3 REQUIRED)

add_executable (seqan3_test main.cpp)

target_link_libraries (seqan3_test seqan3::seqan3)
(base) ubuntu@ppericard-matam-dev:~/data/ovgraphbuild2/build$ cmake ../source/
-- Finding SeqAn3 and checking requirements:
--     Detected as running from a repository checkout…
--     …adding SeqAn3 include:     /home/ubuntu/data/ovgraphbuild2/seqan3/include
--     …adding submodule include:  /home/ubuntu/data/ovgraphbuild2/seqan3/submodules/cereal/include
--     …adding submodule include:  /home/ubuntu/data/ovgraphbuild2/seqan3/submodules/range-v3/include
--     …adding submodule include:  /home/ubuntu/data/ovgraphbuild2/seqan3/submodules/sdsl-lite/include
--   SeqAn3 include dir found:   /home/ubuntu/data/ovgraphbuild2/seqan3/include
--   C++ Standard-17 support:    via -std=c++17
--   C++ Concepts support:       via -fconcepts
--   C++ Filesystem header:      <filesystem>
--   C++ Filesystem library:     builtin
--   Required dependency:        Range-V3 found.
--   Required dependency:        SDSL found.
--   Optional dependency:        Cereal found.
--   Optional dependency:        Lemon found.
--   Optional dependency:        ZLIB-1.2.11 found.
--   Optional dependency:        BZip2-1.0.6 found.
--   Optional dependency:        libexecinfo found.
--   SeqAn3 version.hpp found:   /home/ubuntu/data/ovgraphbuild2/seqan3/include/seqan3/version.hpp
--   SeqAn3 version detected:    3.0.0
--   SeqAn3 platform.hpp build:  passed.
-- Found SeqAn3: /home/ubuntu/data/ovgraphbuild2/seqan3/include/seqan3 (found version "3.0.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/data/ovgraphbuild2/build
(base) ubuntu@ppericard-matam-dev:~/data/ovgraphbuild2/build$ make
Scanning dependencies of target seqan3_test
[ 50%] Building CXX object CMakeFiles/seqan3_test.dir/main.cpp.o
[100%] Linking CXX executable seqan3_test
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `std::experimental::filesystem::v1::__cxx11::path::path(std::experimental::filesystem::v1::__cxx11::path&&)':
main.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2EOS3_[_ZNSt12experimental10filesystem2v17__cxx114pathC5EOS3_]+0x53): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `std::experimental::filesystem::v1::__cxx11::path::path(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':
main.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2EONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNSt12experimental10filesystem2v17__cxx114pathC5EONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x4c): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `std::experimental::filesystem::v1::__cxx11::path::clear()':
main.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114path5clearEv[_ZNSt12experimental10filesystem2v17__cxx114path5clearEv]+0x20): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `std::experimental::filesystem::v1::__cxx11::path::_M_append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114path9_M_appendERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNSt12experimental10filesystem2v17__cxx114path9_M_appendERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0xc0): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `std::experimental::filesystem::v1::exists(std::experimental::filesystem::v1::__cxx11::path const&)':
main.cpp:(.text._ZNSt12experimental10filesystem2v16existsERKNS1_7__cxx114pathE[_ZNSt12experimental10filesystem2v16existsERKNS1_7__cxx114pathE]+0x14): undefined reference to `std::experimental::filesystem::v1::status(std::experimental::filesystem::v1::__cxx11::path const&)'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `seqan3::detail::safe_filesystem_entry::~safe_filesystem_entry()':
main.cpp:(.text._ZN6seqan36detail21safe_filesystem_entryD2Ev[_ZN6seqan36detail21safe_filesystem_entryD5Ev]+0x36): undefined reference to `std::experimental::filesystem::v1::remove_all(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `seqan3::detail::safe_filesystem_entry::remove_no_throw() const':
main.cpp:(.text._ZNK6seqan36detail21safe_filesystem_entry15remove_no_throwEv[_ZNK6seqan36detail21safe_filesystem_entry15remove_no_throwEv]+0x36): undefined reference to `std::experimental::filesystem::v1::remove(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `seqan3::detail::version_checker::get_path[abi:cxx11]()':
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0xd9): undefined reference to `std::experimental::filesystem::v1::create_directory(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x11e): undefined reference to `std::experimental::filesystem::v1::create_directory(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
main.cpp:(.text._ZN6seqan36detail15version_checker8get_pathB5cxx11Ev[_ZN6seqan36detail15version_checker8get_pathB5cxx11Ev]+0x140): undefined reference to `std::experimental::filesystem::v1::temp_directory_path[abi:cxx11]()'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `std::experimental::filesystem::v1::__cxx11::path::path<char [10], std::experimental::filesystem::v1::__cxx11::path>(char const (&) [10])':
main.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2IA10_cS3_EERKT_[_ZNSt12experimental10filesystem2v17__cxx114pathC5IA10_cS3_EERKT_]+0x73): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
CMakeFiles/seqan3_test.dir/main.cpp.o: In function `std::thread::thread<void (&)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::promise<bool>), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::promise<bool> >(void (&)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::promise<bool>), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::promise<bool>&&)':
main.cpp:(.text._ZNSt6threadC2IRFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt7promiseIbEEJRS6_SA_EEEOT_DpOT0_[_ZNSt6threadC5IRFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt7promiseIbEEJRS6_SA_EEEOT_DpOT0_]+0x3f): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/seqan3_test.dir/build.make:96: recipe for target 'seqan3_test' failed
make[2]: *** [seqan3_test] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/seqan3_test.dir/all' failed
make[1]: *** [CMakeFiles/seqan3_test.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@h-2
Copy link
Member

h-2 commented Jul 31, 2019

Hm, that's strange, we will investigate it. Thanks for letting us know!

@marehr
Copy link
Member

marehr commented Jul 31, 2019

@h-2 It seems to be the same issue as #1193, right?

@h-2
Copy link
Member

h-2 commented Aug 3, 2019

Can you verify that the latest master branch fixes the problem?

@ppericard
Copy link
Author

Yep, it works fine now !
Thank you all ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug faulty or wrong behaviour of code
Projects
None yet
Development

No branches or pull requests

3 participants