when building statically (BUILD_SHARED_LIBS=OFF, not recommended)
cmake needs to know what are the dependency libraries of libgmx.a.
Usually that is done by pkg-config (see
csg/CMakeModules/FindGMX.cmake) and that is where /usr/lib64/libm.so
in ccmake comes from.
However libgmx also depends on libpthread and libdl, but libpthread
and libdl don't show up in the output of pkg-config (run pkg-config
--libs libgmx). That is why the undefined reference appear. So this is
actually a bug in gromacs autotools build system.
To workaround that issue, just add libpthread and libdl by hand to
GMX_LIBRARY, e.g.
-DGMX_LIBRARY="$HOME/progs/gromacs-4.5.3/lib/libgmx.a;/usr/lib64/libpthread.so;/usr/lib64/libdl.so;/usr/lib64/libm.so"
Cheers,
Christoph
2011/7/1 cdalgicdir <cahit.d...@gmail.com>:
> Hi all,
>
> I am trying to install Votca 1.2 using ccmake. I have managed to install
> tools without problem. However while installing csg, I receive an error
> concerning the gromacs library file. Is there any specific way I should
> specify the gromacs library?
>
> Thanks,
> Cahit
>
> My command is:
>
> ccmake -DGSL_LIBRARY=/home/cdalgicdir/progs/gsl-1.14/lib/libgsl.so
> -DCBLAS_LIBRARY=/home/cdalgicdir/progs/gsl-1.14/lib/libgslcblas.so
> -DCMAKE_INSTALL_PREFIX=/home/cdalgicdir/progs/votca/votca-1.2/
> -DBoost_INCLUDE_DIR=/home/cdalgicdir/progs/boost-1.46.1/include/
> -DBoost_LIBRARY=/home/cdalgicdir/progs/boost-1.46.1/lib/libboost_filesystem.so
> -DBoost_PROGRAM_OPTIONS_LIBRARY=/home/cdalgicdir/progs/boost-1.46.1/lib/libboost_program_options.so
> -DBUILD_SHARED_LIBS=OFF -DWITH_SQLITE3=OFF
> -DGMX_INCLUDE_DIR=$HOME/progs/gromacs-4.5.3/include
> -DGMX_LIBRARY=$HOME/progs/gromacs-4.5.3/lib/libgmx.a .
>
> GMX_LIBRARY in ccmake window is :
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a;/usr/lib64/libm.so
>
>
>
> Error output:
>
> txt2tags not found, help cmake to find it by setting TXT2TAGS_EXECUTABLE
>
> CMake Warning at src/libcsg/CMakeLists.txt:41 (message):
> gromacs-4.5 double precision not found failback to single precision
>
>
>
> CMake Error at CMakeModules/FindGMX.cmake:63 (message):
> Could not find GromacsVersion in
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a;/usr/lib64/libm.so, take
> look at the error message in
> /home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeError.log to
> find
> out what was going wrong. If you don't have pkg-config installed you will
> most likely have to set GMX_LIBRARY by hand and include all it's deps in
> there (i.e.
> -DGMX_LIBRARY='/path/to/libgmx.so;/path/to/libblas.so;/path/to/libm.so') !
> Call Stack (most recent call first):
> src/libcsg/CMakeLists.txt:42 (find_package)
>
> Error log:
>
> Determining if the function GromacsVersion exists in the
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a;/usr/lib64/libm.so failed
> with the following output:
> Change Dir: /home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp
>
> Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
> /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
> CMakeFiles/cmTryCompileExec.dir/build
> gmake[1]: Entering directory
> `/home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp'
> /home/cdalgicdir/progs/cmake-2.8.4/bin/cmake -E cmake_progress_report
> /home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp/CMakeFiles 1
> Building C object CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o
> /usr/bin/gcc -DCHECK_FUNCTION_EXISTS=GromacsVersion -o
> CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o -c
> /home/cdalgicdir/progs/cmake-2.8.4/share/cmake-2.8/Modules/CheckFunctionExists.c
> Linking C executable cmTryCompileExec
> /home/cdalgicdir/progs/cmake-2.8.4/bin/cmake -E cmake_link_script
> CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
> /usr/bin/gcc -DCHECK_FUNCTION_EXISTS=GromacsVersion
> CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o -o cmTryCompileExec
> -rdynamic /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a -lm
> gmake[1]: Leaving directory
> `/home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_key_delete':
> pthreads.c:(.text+0x5b6): undefined reference to `pthread_key_delete'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_key_create':
> pthreads.c:(.text+0x658): undefined reference to `pthread_key_create'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_join':
> pthreads.c:(.text+0x790): undefined reference to `pthread_join'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_create':
> pthreads.c:(.text+0x839): undefined reference to `pthread_create'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_cancel':
> pthreads.c:(.text+0x164): undefined reference to `pthread_cancel'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_setspecific':
> pthreads.c:(.text+0x1eb): undefined reference to `pthread_setspecific'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_getspecific':
> pthreads.c:(.text+0x1f8): undefined reference to `pthread_getspecific'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(pthreads.o): In function
> `tMPI_Thread_mutex_trylock':
> pthreads.c:(.text+0x9b7): undefined reference to `pthread_mutex_trylock'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(vmddlopen.o): In function
> `vmddlclose':
> vmddlopen.c:(.text+0x1): undefined reference to `dlclose'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(vmddlopen.o): In function
> `vmddlsym':
> vmddlopen.c:(.text+0x11): undefined reference to `dlsym'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(vmddlopen.o): In function
> `vmddlerror':
> vmddlopen.c:(.text+0x21): undefined reference to `dlerror'
> /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a(vmddlopen.o): In function
> `vmddlopen':
> vmddlopen.c:(.text+0x36): undefined reference to `dlopen'
> collect2: ld returned 1 exit status
> gmake[1]: *** [cmTryCompileExec] Error 1
> gmake: *** [cmTryCompileExec/fast] Error 2
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "votca" group.
> To post to this group, send email to vo...@googlegroups.com.
> To unsubscribe from this group, send email to
> votca+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/votca?hl=en.
>
>
--
Dr. Christoph Junghans
Votca Core Developer
Web: http://www.votca.org
[ 67%] Building CXX object src/libcsg/CMakeFiles/votca_csg.dir/modules/io/xmltopologyreader.cc.o
Linking CXX static library libvotca_csg.a
[ 67%] Built target votca_csg
Scanning dependencies of target csg_density
[ 69%] Building CXX object src/tools/CMakeFiles/csg_density.dir/csg_density.cc.o
Linking CXX executable csg_density
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.a(property.cc.o): In function `votca::tools::load_property_from_xml(votca::tools::Property&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
property.cc:(.text+0x10e): undefined reference to `XML_ParserCreate'
property.cc:(.text+0x127): undefined reference to `XML_UseParserAsHandlerArg'
property.cc:(.text+0x144): undefined reference to `XML_SetElementHandler'
property.cc:(.text+0x151): undefined reference to `XML_SetCharacterDataHandler'
property.cc:(.text+0x4db): undefined reference to `XML_SetUserData'
property.cc:(.text+0x563): undefined reference to `XML_Parse'
property.cc:(.text+0x648): undefined reference to `XML_GetErrorCode'
property.cc:(.text+0x64f): undefined reference to `XML_ErrorString'
property.cc:(.text+0x65a): undefined reference to `XML_GetCurrentLineNumber'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.a(parsexml.cc.o): In function `votca::tools::ParseXML::Open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
parsexml.cc:(.text+0x1fc): undefined reference to `XML_ParserCreate'
parsexml.cc:(.text+0x215): undefined reference to `XML_UseParserAsHandlerArg'
parsexml.cc:(.text+0x232): undefined reference to `XML_SetElementHandler'
parsexml.cc:(.text+0x31b): undefined reference to `XML_SetUserData'
parsexml.cc:(.text+0x3c3): undefined reference to `XML_Parse'
parsexml.cc:(.text+0x46c): undefined reference to `XML_GetErrorCode'
parsexml.cc:(.text+0x473): undefined reference to `XML_ErrorString'
parsexml.cc:(.text+0x480): undefined reference to `XML_GetCurrentLineNumber'
collect2: ld returned 1 exit status
make[2]: *** [src/tools/csg_density] Error 1
make[1]: *** [src/tools/CMakeFiles/csg_density.dir/all] Error 2
make: *** [all] Error 2
CMake Error at CMakeModules/FindVOTCA_TOOLS.cmake:61 (message):
Could not find votca::tools::ToolsVersionStr in
/home/cdalgicdir/progs/gsl-1.14/lib/libgsl.so;/home/cdalgicdir/progs/votca/votca-1.
2/lib/libvotca_tools.so;/home/cdalgicdir/progs/gsl-1.14/lib/libgslcblas.so;/usr/lib
64/libm.so;/home/cdalgicdir/progs/fftw-3.2.2-votca/lib/libfftw3.so.3;/home/cdalgicd
ir/progs/gromacs-4.5.3/lib/libgmx.a,
take look at the error message in
/home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeError.log to find
out what was going wrong. If you don't have pkg-config installed you will
most likely have to set VOTCA_TOOLS_LIBRARY by hand and include all it's
deps in there (i.e.
-DVOTCA_TOOLS_LIBRARY='/path/to/libvotca_tools.so;/path/to/libgsl.so;/path/to/libm.
so')
!
Call Stack (most recent call first):
CMakeLists.txt:67 (find_package)
Determining if the function ToolsVersionStr exists in the /home/cdalgicdir/progs/gsl-1.14/lib/libgsl.so;/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so;/home/cdalgicdir/progs/gsl-1.14/lib/libgslcblas.so;/usr/lib64/libm.so;/home/cdalgicdir/progs/fftw-3.2.2-votca/lib/libfftw3.so.3;/home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a failed with the following output:
Change Dir: /home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory `/home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp'
/home/cdalgicdir/progs/cmake-2.8.4/bin/cmake -E cmake_progress_report /home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec.dir/TestVotcaToolsVersion.cxx.o
/usr/bin/c++ -DCHECK_FUNCTION_EXISTS=ToolsVersionStr -o CMakeFiles/cmTryCompileExec.dir/TestVotcaToolsVersion.cxx.o -c /home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeModules/TestVotcaToolsVersion.cxx
Linking CXX executable cmTryCompileExec
/home/cdalgicdir/progs/cmake-2.8.4/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/usr/bin/c++ -DCHECK_FUNCTION_EXISTS=ToolsVersionStr CMakeFiles/cmTryCompileExec.dir/TestVotcaToolsVersion.cxx.o -o cmTryCompileExec -rdynamic /home/cdalgicdir/progs/gsl-1.14/lib/libgsl.so /home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so /home/cdalgicdir/progs/gsl-1.14/lib/libgslcblas.so -lm /home/cdalgicdir/progs/fftw-3.2.2-votca/lib/libfftw3.so.3 /home/cdalgicdir/progs/gromacs-4.5.3/lib/libgmx.a -Wl,-rpath,/home/cdalgicdir/progs/gsl-1.14/lib:/home/cdalgicdir/progs/votca/votca-1.2/lib
/usr/bin/ld: warning: libboost_program_options.so.1.46.1, needed by /home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so, not found (try using -rpath or -rpath-link)
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::variables_map::variables_map()'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::options_description::add_options()'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::detail::cmdline::cmdline(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description const&)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::options_description::m_default_line_length'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::detail::cmdline::style(int)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::detail::cmdline::run()'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::options_description::options_description(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::to_internal(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::operator<<(std::basic_ostream<char, std::char_traits<char> >&, boost::program_options::options_description const&)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, char const*)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::options_description::add(boost::program_options::options_description const&)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::options_description::options_description(unsigned int, unsigned int)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `boost::program_options::notify(boost::program_options::variables_map&)'
/home/cdalgicdir/progs/votca/votca-1.2/lib/libvotca_tools.so: undefined reference to `vtable for boost::program_options::variables_map'
collect2: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec] Error 1
gmake[1]: Leaving directory `/home/cdalgicdir/progs/tars/votca-csg-1.2/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec/fast] Error 2
I guess you forgot to clean:
$ make clean
$ rm CMakeCache.txt
Building statically is usually not necessary and not recommended, with
cmake shared libs even work on AIX.
cmake can also links "half-static", e.g. linking a static libgsl into
a shared version of libvotca_tools and vice versa.
If one really really wants a static libs, one needs pkg-config or has
to specify the full linkflags (-DXXX_LIBRARY) by hand.
Have fun with Votca 1.2,
Christoph
2011/7/1 cdalgicdir <cahit.d...@gmail.com>:
> Hi Christoph,
>
> I did a clean install using shared libraries and it worked. It seems some of
> the libraries were compiled with static option, so I recompiled them using
> the shared libraries and then installed votca 1.2.
> I couldn't figure out the problem with the static building though.
>
> Thanks,
> Cahit
>
>
> On 07/01/2011 01:15 PM, Christoph Junghans wrote:
>>
I did a clean install using shared libraries and it worked. It seems
some of the libraries were compiled with static option, so I recompiled
them using the shared libraries and then installed votca 1.2.
I couldn't figure out the problem with the static building though.
Thanks,
Cahit
On 07/01/2011 01:15 PM, Christoph Junghans wrote: