Compile cximage Dynamic Library __linux under 64-bit Linux

Source: Internet
Author: User
Tags cairo
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.