Project

General

Profile

Bug #352

Allvsall kernel linking error with cmake and shared libraries

Added by Teemu Murtola about 10 years ago. Updated about 10 years ago.

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

Description

CMake build configured with BUILD_SHARED_LIBRARIES=ON gives the following linker error:

Linking C shared library libgmx.so
CMakeFiles/gmx.dir/nonbonded/nb_kernel_c/nb_kernel_allvsall.c.o: In function `nb_kernel_allvsall':
nb_kernel_allvsall.c:(.text+0x0): multiple definition of `nb_kernel_allvsall'
CMakeFiles/gmx.dir/nonbonded/nb_kernel_allvsall.c.o:nb_kernel_allvsall.c:(.text+0x11c0): first defined here

The error does not appear if BUILD_SHARED_LIBRARIES is OFF, or if using autoconf. For autoconf builds, the nonbonded/nb_kernel_allvsall.c file does not seem to be included in the build at all, which may explain the difference.

I can reproduce the error by changing into an empty directory and running
cmake -DBUILD_SHARED_LIBRARIES:BOOL=ON path_to_gromacs_source_tree
make

History

#1 Updated by Erik Lindahl about 10 years ago

Oops - there was an extra copy of this file in the nonbonded directory. We never used that with autoconf, but since cmake uses wildcards it was picked up by mistake. Extra file has been removed in git.

Also available in: Atom PDF