LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-26-2015, 01:01 PM   #1
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Rep: Reputation: Disabled
how to use static libraries? please help Lol


https://code.google.com/p/wavelet1d/...ar.gz&can=2&q=

The above link is where I downloaded *.cpp(s) and the libraries.

If you "untar" the package, in "examples" directory, there are some demonstration files. What I wanted to do was to make an executable file out of "wavedemo1.cpp".

I modified the code in "wavedemo1.cpp";
Code:
#include "wavelet2d.h"
to
Code:
#include "wavelet2s.h"
, then placed the header file "wavelet2s.h" (from /wavelib/src/linuxstatic) and the modified "wavedemo1.cpp" into my working directory.

Inside the working directory, I ran the following command

Code:
gcc -L/home/mario/wavelet/wavelib/linuxstatic -lwavelet2s wavedemo1.cpp -o wavedemo1
Then I get the following error messages.

/usr/bin/ld: skipping incompatible /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a when searching for -lwavelet2s
/usr/bin/ld: cannot find -lwavelet2s
collect2: error: ld returned 1 exit status


I'm not sure what went wrong with my approach. This is my first time trying to use libraries on linux and it's giving me really tough times.

I would appreciate your help, please let me know if you need more details to explain things.

Thanks.

Last edited by 444ghost; 05-26-2015 at 01:46 PM.
 
Old 05-26-2015, 01:13 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
that means you have a static lib named /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a but currenly it cannot be used (incompatible). We have no any idea what's wrong with it, try the command file /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a, but we still need to know the os you have.
 
1 members found this post helpful.
Old 05-26-2015, 01:20 PM   #3
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
I appreciate your reply!

I ran file /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a in my working directory and it gives this message /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a: current ar archive but nothing else really happened.

running on virtualbox

Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

Last edited by 444ghost; 05-26-2015 at 01:22 PM.
 
Old 05-26-2015, 01:27 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
please execute this:
objdump -f /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a | grep ^architecture
and
uname -a
 
1 members found this post helpful.
Old 05-26-2015, 01:35 PM   #5
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000011:
architecture: i386, flags 0x00000010:

for objdump -f /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a | grep ^architecture

and

Linux Mario 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

for uname -a
 
Old 05-26-2015, 01:39 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
so that looks like the file is a 32bit lib and your system has a 64bit kernel.
you may try:
gcc -m32 -L/home/mario/wavelet/wavelib/linuxstatic -lwavelet2s wavedemo1.cpp -o wavedemo1
probably that helps
 
1 members found this post helpful.
Old 05-26-2015, 01:42 PM   #7
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,478

Rep: Reputation: Disabled
Seems to me that you are trying to compile with a 32bit lib on a 64bit system, (but I'm not a programmer).

Edit: Beaten to it!
 
1 members found this post helpful.
Old 05-26-2015, 01:43 PM   #8
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
no longer getting the error message, thank you so much!
 
  


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
static and dynamic libraries nesta Programming 11 09-04-2011 08:36 PM
Thread limits in dynamic libraries as opposed to static libraries pmkenny1234 Linux - Software 0 04-26-2011 02:22 PM
static libraries eteck Programming 3 11-03-2010 08:39 AM
Static libraries vs shared Libraries catallergy Linux - Newbie 2 03-16-2010 01:30 PM
Compiling with static libraries trek413 Linux - Newbie 4 10-19-2006 07:14 PM

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

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