first, compile the Cximage static library under 64-bit Linux, please refer to the article:
64-bit Linux compile cximage notes
I encountered a problem in the 6th step, according to the author of the article prompts, input
Cppflags= "=-fpic"
Results The compilation of the static library failed, not knowing what the reason was.
Finally my solution is to cximage every library directory, in turn, modify each makefile, add "-fpic" command
Cflags =-o2-fpic
Before compiling successfully.
Because of the project needs, multiple dynamic libraries and cximage libraries need to be linked together in one project to generate a dynamic library. However, how to combine multiple dynamic libraries and multiple static libraries together to deliver a dynamic library, unfortunately, I didn't find it. Luckily, I finally managed to compile the 8 static libraries of cximage into a dynamic library that was successfully linked to my engineering code with other dynamic libraries.
Finally, 8 static libraries are compiled into a dynamic library, and my makefile files are as follows:
CC = gcc
ld = ld
LIBRARY = libcx.so
OBJECTS = libcximage.a libj2k.a libjasper.a libjbig.a libjpeg.a libpng.a L IBTIFF.A LIBZLIB.A
all:$ (library)
$ (Library): $ (OBJECTS)
rm-f $ (library)
$ (LD)-fpic-shared-- Whole-archive $ (OBJECTS)--no-whole-archive -soname $@-o $@
@echo "finished creating $ (library) Library" c10/> @echo "-----------------------------------------------------"
libcximage.a:
$ (make) $ (am_ Makeflags)-F libcximage.mk
libj2k.a:
$ (make) $ (am_makeflags)-F libj2k.mk
LIBJASPER.A:
$ (make) $ (am_makeflags)-F libjasper.mk
LIBJBIG.A:
$ (make) $ (am_makeflags)-F libjbig.mk
LIBJPEG.A:
$ ( Make) $ (am_makeflags)-F libjpeg.mk
LIBPNG.A:
$ (make) $ (am_makeflags)-F libpng.mk
LIBTIFF.A:
$ ( Make) $ (am_makeflags)-F libtiff.mk
LIBZLIB.A:
$ (make) $ (am_makeflags)-F libzlib.mk
Here I have my own compiled cximage static library and dynamic library, all can be assured to use the Cximage library Linux version
The test found in the project, Linux, Cximage Library and CAIRO drawing library together, will cause "cairo_status_no_memory", resulting in CAIRO can not draw pictures, after the investigation, The discovery is that the Cximage construction method is operating on memory during the compile phase. Therefore, it is recommended that you do not refer to both libraries if you have the same requirements.