[CMake] static cmake, ctest executables
Eric Noulard
eric.noulard at gmail.com
Sat Feb 4 04:59:14 EST 2012
2012/2/4 Ilias Miroslav <Miroslav.Ilias at umb.sk>:
> Greetings, Sirs,
>
>
> I would like to have "cmake" and "ctest" executables static (for usage in grid enviroment).
>
> I tried to compile the newest "cmake-2.8.7.tar.gz" version with
>
> ./configure --prefix=/home/ilias/bin/cmake_static LDFLAGS=--static --disable-shared --enable-static
>
> but still got dynamic versions (see below), not static...
Fully static may be achieved with
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS_DEBUG=-static
/path/to/source
I assume you compile CMake using cmake and not bootstrapping it.
CMAKE_EXE_LINKER_FLAGS_<BUILDTYPE> specifies an extra linker flags when building
executable.
Doing this spit warning like:
".../Utilities/cmcurl/hostip4.c:183: warning: Using 'gethostbyname_r'
in statically linked applications requires at runtime the shared
libraries from the glibc version used for linking"
If you dig into the CMake ML, I think you should find some discussion
about the issue
you may have to get fully static executable on Linux or more precisely
with glibc.
Stackoverflow has some entry on the subject as well:
http://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
You may try to get rid of libgcc and libstdc++
using
-static-libgcc
and
-static-libstdc++
see
http://www.trilithium.com/johan/2005/06/static-libstdc/
Are you sure you really need fully static executable?
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list