LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-27-2011, 09:47 AM   #1
manaila
LQ Newbie
 
Registered: Apr 2010
Posts: 29

Rep: Reputation: 0
Alternative to using Linux software package


How can I be able to use the software package without first installing it? To be specific, I want to use xml parser,libxm2(
http://xmlsoft.org/sources/) in the my C code but I dont want to install it.
 
Old 09-27-2011, 09:49 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You need the headers and shared object files present on your system if you're going to make use of them in your program. Why don't you want to install it? Can you give us more details about the problem you're having?
 
Old 09-27-2011, 01:30 PM   #3
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
If you cannot install it system-wide, you can install it for yourself only in your home directory, and remove it completely afterwards.

Typically this means you configure it using ./configure --prefix=/home/myself/libxml2/ other options... and compile and install it there (as yourself). Check the configure options (with ./configure --help); you'll only need a static version of the library.

To compile your own programs, you'll need to tell the compiler to look for libraries ( -L directory ) and include files ( -I directory ) additionally under the libxml2 directory, in this case most likely using -L /home/myself/libxml2/lib -I /homemyself/libxml2/include .

If you compiled the libxml2 library statically (libxml2.a, I believe), then after compiling and linking your own program, you don't need the libxml2 files any longer.

You can use the ldd command to see which dynamic libraries binaries require at run time. If you follow my advice above, you should not have a dependency on libxml2; it should be included in your binary itself.
 
1 members found this post helpful.
Old 10-24-2011, 09:03 AM   #4
manaila
LQ Newbie
 
Registered: Apr 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Nominal Animal View Post
If you compiled the libxml2 library statically (libxml2.a, I believe), then after compiling and linking your own program, you don't need the libxml2 files any longer.
I have installed libcurl and I want to statically link it to my program but its like its not statically linked. This is how I compiled it:
Code:
[root@localhost ~]# curl-config --static-libs
/usr/local/lib/libcurl.a -L/usr/kerberos/lib -lidn -lssl -lcrypto -lldap -lrt -lssl -lcrypto -ldl -lz -lz
[root@localhost ~]# gcc -Wall -L/usr/kerberos/lib -lidn -lssl -lcrypto -lldap -lrt -lssl -lcrypto -ldl -lz -lz -o libcurlEx libcurlEx.c /usr/local/lib/libcurl.a
[root@localhost ~]# ldd libcurlEx
        linux-gate.so.1 =>  (0x00194000)
        libidn.so.11 => /usr/lib/libidn.so.11 (0x00342000)
        libssl.so.6 => /lib/libssl.so.6 (0x00afe000)
        libcrypto.so.6 => /lib/libcrypto.so.6 (0x009bf000)
        libldap-2.3.so.0 => /usr/lib/libldap-2.3.so.0 (0x074ee000)
        librt.so.1 => /lib/librt.so.1 (0x003ac000)
        libdl.so.2 => /lib/libdl.so.2 (0x002aa000)
        libz.so.1 => /lib/libz.so.1 (0x002f6000)
        libc.so.6 => /lib/libc.so.6 (0x003b5000)
        liblber-2.3.so.0 => /usr/lib/liblber-2.3.so.0 (0x071ef000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0098f000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00b54000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x006e4000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00bf3000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x005ac000)
        libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x073a2000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x002dc000)
        /lib/ld-linux.so.2 (0x00135000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00b45000)
        libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00c1b000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x071bf000)
what is it that I missed?
 
Old 10-24-2011, 11:46 AM   #5
abhishekbatra
LQ Newbie
 
Registered: May 2008
Location: Delhi, India
Distribution: Debian, Ubuntu, Kubuntu
Posts: 27
Blog Entries: 1

Rep: Reputation: 0
To answer the original question, you can usually extract the contents of software packages by simply using an unzipping/decompressing tool as they are just a compressed archive. It is still always recommended that they be installed. It would be helpful if you show how you tried to statically link libcurl and what error you encoutered.
 
Old 10-25-2011, 01:41 AM   #6
manaila
LQ Newbie
 
Registered: Apr 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by abhishekbatra View Post
It would be helpful if you show how you tried to statically link libcurl and what error you encoutered.
Hi, abhishekbatra; I think I have shown in the previous post how I statically linked libcurl to my app, unless I don't understand you. Actually, as shown in the post, I did not get an error but when using the ldd command to find the shared library dependencies of the app, it gave me a doubt that my app is not statically linked.
 
  


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
Alternative for windows software in linux sawant priyanka Linux - Software 4 05-14-2009 08:58 AM
LXer: Android alternative delivers partial Linux package LXer Syndicated Linux News 0 04-03-2008 11:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:31 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