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

Unit tests fail in conda env: undefined reference to clock_gettime() #2

Open
xileF1337 opened this issue May 13, 2020 · 1 comment
Open

Comments

@xileF1337
Copy link

xileF1337 commented May 13, 2020

When running the unit tests via make check inside a conda environment, the linking of testRNAblueprint fails with the following error message:

/home/felix/miniconda3/envs/rnablueprint/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: testRNAblueprint-main.o: in function `boost::unit_test::timer::timer::elapsed() const':
main.cc:(.text._ZNK5boost9unit_test5timer5timer7elapsedEv[_ZNK5boost9unit_test5timer5timer7elapsedEv]+0x45): undefined reference to `clock_gettime'
/home/felix/miniconda3/envs/rnablueprint/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: testRNAblueprint-main.o: in function `boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*)':
main.cc:(.text._ZN5boost9unit_test9framework5state17execute_test_treeEmmPKNS2_23random_generator_helperE[_ZN5boost9unit_test9framework5state17execute_test_treeEmmPKNS2_23random_generator_helperE]+0x5b3): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status
Makefile:674: recipe for target 'testRNAblueprint' failed
make[2]: *** [testRNAblueprint] Error 1

My conda env was created using the following command:

conda create -n rnablueprint c-compiler python boost cxx-compiler perl swig automake autoconf libtool m4

The problem seems to be that clock_gettime needs to be linked with -lrt, cf. man clock_gettime. There it sais " Link with -lrt (only for glibc versions before 2.17)." Adding -lrt to testRNAblueprint_LDADD in tests/Makefile.am solves this problem. librt is part of the Linux Standard Base specification, so it should be present everywhere (?).

@j-4
Copy link
Contributor

j-4 commented Oct 16, 2020

Hi Felix,
as you already solved the problem, is it possible to send a PR with the changes in tests/Makefile.am? Sounds like a good idea to add -lrt here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants