LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 04: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 04:31 AM.
 
Old 11-15-2011, 05:07 AM   #2
weibullguy
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
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:37 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
Open Source Consulting | Domain Registration