Project

General

Profile

Bug #2051

gmxTestCXX11 can fail because of linker issue

Added by Roland Schulz about 3 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

We use std::thread in the c++11 test and we don't add any linker flags. Some compilers (e.g. ICC 17) require a linker flag for that under certain conditions (e.g. -static).

Possible solutions:
1) We could move the check after we find thread support.
2) We remove the usage of std::thread from the c++11 check

Associated revisions

Revision 60243c3b (diff)
Added by Roland Schulz almost 2 years ago

Fix C++11 library check's thread dependency

Test was depending on thread library without explicit linking it,
which some compiler require.

Fixes #2051

Change-Id: I9929d9373a4e8caa393f548d25a78bc03c016bf9

History

#1 Updated by Mark Abraham about 3 years ago

We use std::thread in the code, so we need to test it during cmake, so shouldn't do only 2) without code changes. Thread support isn't optional for C++11, so we can't do 1).

I suggest we organize to use the linker flags

#2 Updated by Roland Schulz about 3 years ago

False positives are worse than not checking. That's why I think 2 is an improvement. But of course it isn't ideal.

With 1 I meant running it after FindThread. So that we know the required linker flags.

#3 Updated by Mark Abraham about 3 years ago

Ah, I now see that even with gcc and clang on Linux, one needs to link libpthread, so needs to use -pthread. So we can indeed move the threading-support check before the C++11 check (and add the linker flag icc needs - which should come from the threading test, right?). In principle, the C++11 standard library could use other back ends, but if that ever becomes a thing, then we might separate the C++11 threading test from the other C++11 tests.

#4 Updated by Mark Abraham almost 2 years ago

  • Target version set to 2018

Someone should check icc (17 and 18?) and static linking to see what needs to be done here.

#5 Updated by Gerrit Code Review Bot almost 2 years ago

Gerrit received a related patchset '1' for Issue #2051.
Uploader: Roland Schulz ()
Change-Id: gromacs~release-2018~I9929d9373a4e8caa393f548d25a78bc03c016bf9
Gerrit URL: https://gerrit.gromacs.org/7292

#6 Updated by Roland Schulz almost 2 years ago

  • Status changed from New to Fix uploaded

#7 Updated by Roland Schulz almost 2 years ago

  • Status changed from Fix uploaded to Resolved

#8 Updated by Roland Schulz almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF