Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-15-2011, 04:34 AM   #1
LQ Newbie
Registered: Nov 2011
Posts: 1

Rep: Reputation: Disabled
conversion of static library to shared library

I am trying to convert static library to shared library to reduce compilation time, but i need to change in makefile.

Last edited by Nandini86; 11-18-2011 at 04:31 AM.
Old 11-15-2011, 05:07 AM   #2
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Ummm kay. Well, good luck.
Old 11-15-2011, 05:50 AM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
Is this a library you wrote yourself? Is this part of a package built from source with autoconf?

If the later, look at "./configure --help".

For individual libraries here is an example for zlib:
./configure --help
  configure [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]
    [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]
An example from wireshark:
  --enable-static[=PKGS]  build static libraries [default=no]
If this is your own library, you need to compile it with the -fPIC option and turn it into a shared library:
gcc -fPIC -c yourcode.c
gcc -shared -W1, -soname, -o yourcode.o

You really should read up on C or C++ programming in Linux. You should probably produce a Makefile instead of manually compiling and linking.
Producing shared libraries may not reduce compile times because Make will only compile what is needed. I don't think linking precompiled object files will reduce compile times by much. You may be wanting shared libraries for the wrong reasons.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SDL static library, shared library icecubeflower Programming 6 04-09-2009 03:10 PM
Making a static library from a given shared library vro Programming 1 07-27-2007 04:07 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration