LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-15-2011, 05:34 AM   #1
Nandini86
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 05:31 AM.
 
Old 11-15-2011, 06:07 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,812
Blog Entries: 1

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

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
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:
Code:
./configure --help
usage:
  configure [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]
    [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]
    [--includedir=INCLUDEDIR]
An example from wireshark:
Code:
  --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,libyourcode.so.1 -o libyourcode.so.1.0 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.
  


Reply


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 04:10 PM
Making a static library from a given shared library vro Programming 1 07-27-2007 05:07 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM


All times are GMT -5. The time now is 08:32 PM.

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