Differences between revisions 15 and 18 (spanning 3 versions)
Revision 15 as of 2007-02-13 17:12:24
Size: 3870
Editor: gtang
Comment:
Revision 18 as of 2007-02-13 17:30:38
Size: 4483
Editor: gtang
Comment:
Deletions are marked like this. Additions are marked like this.
Line 94: Line 94:
6. Python 2.4.3 static library for x86_64:
Line 95: Line 96:
6. Python 2.4.3 static library for x86_64:
Line 105: Line 105:
Line 109: Line 108:
1. ./configure --prefix=/home/gtang/library/tiff-3.8.2
       
--enable-shared=no --enable-static=yes
1. ./configure --prefix=/home/gtang/library/tiff-3.8.2 --enable-shared=no --enable-static=yes
Line 113: Line 111:
8. libpng-1.2.12 static library for x86_64:
Line 114: Line 113:
8. {{{
1. ./configure --prefix=/home/gtang/library/png-1.2.12 --enable-shared=no --enable-static=yes
2. make CFLAGS='-O2 -fPIC'
3. make check
4. make install}}}
9. jpegsrc.v6b.tar.gz static libjpeg for x86_64:

{{{
1. ./configure --prefix=/home/gtang/library/jpeg-6b --enable-static=yes --enable-shared=no CFLAGS='-O2 -fPIC'
2. edit Makefile change ./libtool to libtool
3. make
4. in the /home/gtang/library/jpeg-6b directory, mkdir bin, lib, include, man/man1
5. make install-lib #poorly written configuration, libjpeg.a will not be installed by make install}}}

The idea to semi-static build EMAN is to link EMAN’s dependency libraries statically into EMAN’s shared libraries: libEM.so, libpyEM.so, libqEM.so, libqsci.so. By this way, the compiled EMAN can be run on another system even though it does not have those dependent libraries. You can specify each dependent library in ccmake to link to static library, for example libgsl.a instead of libgsl.so. And make sure there is no shared library in the same directory, otherwise, linker will prefer the shared library.

For 64 bit linux system, those static depency libraries must be compiled with a -fPIC flag.

For example, this is what I did to get static library compiled with '-fPIC' flag:

1. qt-3.3.6 static library for x86_64

1. ./configure -prefix /home/gtang/library/qt-x11-free-3.3.6
        -qt-gif -thread -qt-imgfmt-jpeg -platform linux-g++-64 -static
2. go to src subdirectory, edit Makefile add -fPIC into CFLAGS, and
CXXFLAGS
3. make
4. make install

2. fftw-2.1.5 static library for x86_64

1. ./configure --prefix /home/gtang/library/fftw-2.1.5 --enable-static
        --enable-shared=no --enable-float --enable-type-prefix
2. make CFLAGS='-O3 -fomit-frame-pointer -fno-schedule-insns
        -fschedule-insns2 -fstrict-aliasing -fPIC'

3. make install

3. GSL 1.6 static library for x86_64

1. ./configure --prefix=/home/gtang/library/gsl-1.6 --enable-shared=no
        --enable-static=yes
2. make CFLAGS="-O3 -fPIC"
3. make check > log 2>&1
4. make install 

4. hdf5-1.6.4 static library for x86_64

1. ./configure --prefix=/home/gtang/library/hdf5-1.6.3 --enable-shared=no
        --enable-static=yes
2. make CFLAGS='-fPIC'
3. make check
4. make install

5. boost-1.33.1 static boost.python library for x86_64

I can not figure out a way to compile boost.python with
option '-fPIC', in Jamfile, so use CMake to create a Makefile.
write a CMakeLists.txt file in /libs/python/src/ as follow:

PROJECT(BOOSTPYTHON)

INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)

FIND_PACKAGE(PythonLibs)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(.)

SET (OPT_FLAGS "-march=k8 -O1 -fPIC")

SET(LIB_BOOSTPYTHON_SOURCE
        numeric.cpp
        list.cpp
        long.cpp
        dict.cpp
        tuple.cpp
        str.cpp
        slice.cpp
        aix_init_module.cpp
        converter/from_python.cpp
        converter/registry.cpp
        converter/type_id.cpp
        object/enum.cpp
        object/class.cpp
        object/function.cpp
        object/inheritance.cpp
        object/life_support.cpp
        object/pickle_support.cpp
        errors.cpp
        module.cpp
        converter/builtin_converters.cpp
        converter/arg_to_python_base.cpp
        object/iterator.cpp
        object_protocol.cpp
        object_operators.cpp
        wrapper.cpp       )

ADD_LIBRARY(boost_python STATIC ${LIB_BOOSTPYTHON_SOURCE})

Note:
1. copy boost header directory "boost" into /libs/python/src directory.
2. on FC5 64 bit, above is enough to create 64 bit static boost library with
-fPIC enabled. But on 64 bit FC3, I have to modify
CMakeFiles/boost_python.dir/flags.make add "-fPIC" into CXX_FLAGS.

6. Python 2.4.3 static library for x86_64:

1. ./configure --prefix=/home/gtang/library/Python-2.4.3
change Makefile line:
OPT= -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
to line:
OPT= -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC
2. make
3. make test
4. make install

7. tiff-3.7.2 static libtiff library for x86_64:

1. ./configure --prefix=/home/gtang/library/tiff-3.8.2 --enable-shared=no --enable-static=yes
2. make CFLAGS = '-O2 -fPIC'
3. make install

8. libpng-1.2.12 static library for x86_64:

1.  ./configure --prefix=/home/gtang/library/png-1.2.12 --enable-shared=no --enable-static=yes
2. make CFLAGS='-O2 -fPIC'
3. make check
4. make install

9. jpegsrc.v6b.tar.gz static libjpeg for x86_64:

1. ./configure --prefix=/home/gtang/library/jpeg-6b --enable-static=yes --enable-shared=no CFLAGS='-O2 -fPIC'
2. edit Makefile change ./libtool to libtool
3. make
4. in the /home/gtang/library/jpeg-6b directory, mkdir bin, lib, include, man/man1
5. make install-lib          #poorly written configuration, libjpeg.a will not be installed by make install

EMAN_COMPILE_STATIC (last edited 2008-11-26 04:42:28 by localhost)