← All tasks
cppclab/dynet #973Not a task: not reproduced

undefined reference to `dynet::mp::

envgap__clab__dynet-973

01 / FAILURE SIGNATURE

As reported upstream

/mnt/Repositories/dynet/dynet/mp.h:129: undefined reference to `dynet::mp::stop_requested'
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
a69c5158ccfd7887ee3174d2e99924a445b26fea
Manifest
examples/CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

clab/dynet #973 · read the original issue
Hi,



unfortunatlly, the `*_mp` examples won't be linked correctly when using the example command in `README.md`



```bash

cmake .. -DEIGEN3_INCLUDE_DIR=/path/to/eigen -DENABLE_CPP_EXAMPLES=ON

```



```bash

[ 61%] Linking CXX executable xor-mp

cd /mnt/Repositories/dynet/build/examples && /usr/bin/cmake -E cmake_link_script CMakeFiles/xor-mp.dir/link.txt --verbose=1

/usr/bin/c++   -DEIGEN_FAST_MATH -fPIC -fno-finite-math-only -Wall -Wno-missing-braces -std=c++11 -g -funroll-loops -Ofast -march=native  -rdynamic CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o  -o xor-mp -Wl,-rpath,/mnt/Repositories/dynet/build/dynet ../dynet/libdynet.so -lpthread -lrt 

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `SufficientStats dynet::mp::run_data_set<SufficientStats>(__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, __gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, std::vector<dynet::mp::Workload, std::allocator<dynet::mp::Workload> > const&, boost::interprocess::message_queue_t<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >&, dynet::mp::WorkloadHeader const&)':

/mnt/Repositories/dynet/dynet/mp.h:129: undefined reference to `dynet::mp::stop_requested'

/mnt/Repositories/dynet/dynet/mp.h:129: undefined reference to `dynet::mp::stop_requested'

/mnt/Repositories/dynet/dynet/mp.h:129: undefined reference to `dynet::mp::stop_requested'

/mnt/Repositories/dynet/dynet/mp.h:129: undefined reference to `dynet::mp::stop_requested'

/mnt/Repositories/dynet/dynet/mp.h:129: undefined reference to `dynet::mp::stop_requested'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o:/mnt/Repositories/dynet/dynet/mp.h:129: more undefined references to `dynet::mp::stop_requested' follow

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `std::vector<dynet::mp::Workload, std::allocator<dynet::mp::Workload> >::size() const':

/usr/include/c++/7.2.0/bits/stl_vector.h:671: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `void dynet::mp::run_parent<Datum, SufficientStats>(std::vector<Datum, std::allocator<Datum> > const&, std::vector<Datum, std::allocator<Datum> > const&, dynet::mp::ILearner<Datum, SufficientStats>*, std::vector<dynet::mp::Workload, std::allocator<dynet::mp::Workload> >&, unsigned int, unsigned int, unsigned int)':

/mnt/Repositories/dynet/dynet/mp.h:166: undefined reference to `dynet::mp::stop_requested'

/mnt/Repositories/dynet/dynet/mp.h:188: undefined reference to `dynet::mp::stop_requested'

/mnt/Repositories/dynet/dynet/mp.h:196: undefined reference to `dynet::mp::stop_requested'

/mnt/Repositories/dynet/dynet/mp.h:166: undefined reference to `dynet::mp::stop_requested'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `int dynet::mp::run_child<Datum, SufficientStats>(unsigned int, dynet::mp::ILearner<Datum, SufficientStats>*, dynet::Trainer*, std::vector<dynet::mp::Workload, std::allocator<dynet::mp::Workload> >&, std::vector<Datum, std::allocator<Datum> > const&, std::vector<Datum, std::allocator<Datum> > const&)':

/mnt/Repositories/dynet/dynet/mp.h:217: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

/mnt/Repositories/dynet/dynet/mp.h:254: undefined reference to `dynet::mp::shared_object'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `void dynet::mp::run_multi_process<Datum, SufficientStats>(unsigned int, dynet::mp::ILearner<Datum, SufficientStats>*, dynet::Trainer*, std::vector<Datum, std::allocator<Datum> > const&, std::vector<Datum, std::allocator<Datum> > const&, unsigned int, unsigned int, unsigned int)':

/mnt/Repositories/dynet/dynet/mp.h:284: undefined reference to `dynet::mp::generate_queue_name[abi:cxx11]()'

/mnt/Repositories/dynet/dynet/mp.h:284: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':

/usr/include/c++/7.2.0/bits/basic_string.h:716: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data(char*)':

/usr/include/c++/7.2.0/bits/basic_string.h:152: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':

/usr/include/c++/7.2.0/bits/basic_string.h:721: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `__gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long)':

/usr/include/c++/7.2.0/ext/new_allocator.h:125: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o:/usr/include/c++/7.2.0/ext/new_allocator.h:125: more undefined references to `dynet::mp::queue_name[abi:cxx11]' follow

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `void dynet::mp::run_multi_process<Datum, SufficientStats>(unsigned int, dynet::mp::ILearner<Datum, SufficientStats>*, dynet::Trainer*, std::vector<Datum, std::allocator<Datum> > const&, std::vector<Datum, std::allocator<Datum> > const&, unsigned int, unsigned int, unsigned int)':

/mnt/Repositories/dynet/dynet/mp.h:287: undefined reference to `dynet::mp::generate_shared_memory_name[abi:cxx11]()'

/mnt/Repositories/dynet/dynet/mp.h:287: undefined reference to `dynet::mp::shared_memory_name[abi:cxx11]'

/mnt/Repositories/dynet/dynet/mp.h:288: undefined reference to `dynet::mp::shared_object'

/mnt/Repositories/dynet/dynet/mp.h:289: undefined reference to `dynet::mp::create_workloads(unsigned int)'

/mnt/Repositories/dynet/dynet/mp.h:290: undefined reference to `dynet::mp::spawn_children(std::vector<dynet::mp::Workload, std::allocator<dynet::mp::Workload> >&)'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data(char*)':

/usr/include/c++/7.2.0/bits/basic_string.h:152: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':

/usr/include/c++/7.2.0/bits/basic_string.h:1315: undefined reference to `dynet::mp::queue_name[abi:cxx11]'

collect2: error: ld returned 1 exit status

make[2]: *** [examples/CMakeFiles/xor-mp.dir/build.make:96: examples/xor-mp] Error 1

make[2]: Leaving directory '/mnt/Repositories/dynet/build'

make[1]: *** [CMakeFiles/Makefile2:277: examples/CMakeFiles/xor-mp.dir/all] Error 2

make[1]: Leaving directory '/mnt/Repositories/dynet/build'

make: *** [Makefile:130: all] Error 2

```



Complete call for linking the `train_xor-mp` example is (in `build/examples`):



```bash

/usr/bin/c++   -DEIGEN_FAST_MATH -fPIC -fno-finite-math-only -Wall -Wno-missing-braces -std=c++11 -g -funroll-loops -Ofast -march=native  -rdynamic CMakeFiles/xor-mp.dir/multiprocessing/train_xor-mp.cc.o  -o xor-mp -Wl,-rpath,/mnt/Repositories/dynet/build/dynet ../dynet/libdynet.so -lpthread -lrt

```



The `-DENABLE_BOOST=ON` is missing (see e.g. [CI configuration](https://github.com/clab/dynet/blob/master/.travis/build_dynet.sh)). To compile `dynet` with all examples correctly, use:



```bash

cmake .. -DEIGEN3_INCLUDE_DIR=/path/to/eigen -DENABLE_CPP_EXAMPLES=ON -DENABLE_BOOST=ON

```



So is it ok that I open a PR to update the main `README.md`?



Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]