LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-25-2012, 10:08 AM   #1
feroz
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Rep: Reputation: Disabled
Linking of static library with application


hiiii friends...Can any one help me ?? ...

I created one static library using armcc and armar on Window platform and when i am linking my application to this library on LINUX platform by using following command:

g++ -o apllication apllication.cpp -L. -lmp3Decoder


then i am getting following error::
./libmp3Decoder.a(alginterface_mp3dec.o): In function `ALG_MP3_Decode_Frame':
(.text+0x274): undefined reference to `__aeabi_memclr'
./libmp3Decoder.a(Incube_MP3Dec_LpAudioMp3.o): In function `gIncube_MP3Dec_LpAudioCmdMp3ZeroState':
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0xcd0): undefined reference to `__aeabi_memclr4'
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0xcdc): undefined reference to `__aeabi_memclr4'
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0xcf8): undefined reference to `__aeabi_memclr4'
./libmp3Decoder.a(Incube_MP3Dec_LpAudioMp3.o): In function `sLpAudioCmdMp3DecodeFrame':
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0x2918): undefined reference to `__aeabi_memclr4'
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0x2924): undefined reference to `__aeabi_memclr4'
./libmp3Decoder.a(Incube_MP3Dec_LpAudioMp3.o):..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0x293c): more undefined references to `__aeabi_memclr4' follow
/usr/bin/ld: res: hidden symbol `__aeabi_memclr' isn't defined
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status


although i am not using __aeabi_memclr and __aeabi_memclr4 symbols in my entire project .


i am giving steps that i used to create object files and library on Window platform.....

step 1::creation of oject files from source code files on window using given command :



armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mcal/inc -i ../mcal_mp3dec/inc -c ../mcal/src/mcal_api.cpp

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mcal/inc -i ../mcal_mp3dec/inc -c ../mcal/src/mcal_common.cpp

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mcal_mp3dec/inc -i ../mcal/inc -c ../mcal_mp3dec/src/mcal_os.cpp

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mcal_mp3dec/inc -i ../mcal/inc -i ../mc/inc -i ../mc/api -c ../mcal_mp3dec/src/mm_mp3dec.cpp

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mc/inc -i ../mc/api -c ../mc/src/alginterface_mp3dec.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mc/inc -i ../mc/api -c ../mc/src/apil_mp3dec.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mc/inc -c ../mc/src/Incube_MP3Dec_LpAudioCallBack.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mc/inc -c ../mc/src/Incube_MP3Dec_LpAudioMp3.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mc/inc -c ../mc/src/Incube_MP3Dec_LpAudioMp3Ent.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mc/inc -c ../mc/src/Incube_MP3Dec_LpAudioMp3HuffmanTables.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../mc/inc -c ../mc/src/Incube_MP3Dec_LpAudioMp3SfbWidth.c



armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../INCUBE_MP3DEC/inc -c ../INCUBE_MP3DEC/src/Incube_MP3Dec_LpAudioBits.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../INCUBE_MP3DEC/inc -c ../INCUBE_MP3DEC/src/Incube_MP3Dec_LpAudioMp3Imdct.c

armcc --debug --cpu=ARM1176JZ-S -O3 -Otime -i ../INCUBE_MP3DEC/inc -c ../INCUBE_MP3DEC/src/Incube_MP3Dec_MadSynth.c

step 2:: creation of static library(libmp3Decoder.a) on window platform from the object files those are getting after step 1 ::



armar -r ./libmp3Decoder.a ./obj_c/mcal_api.o
./obj_c/mcal_common.o
./obj_c/mcal_os.o
./obj_c/mm_mp3dec.o
./obj_c/alginterface_mp3dec.o
./obj_c/apil_mp3dec.o
./obj_c/Incube_MP3Dec_LpAudioCallBack.o
./obj_c/Incube_MP3Dec_LpAudioMp3.o
./obj_c/Incube_MP3Dec_LpAudioMp3Ent.o
./obj_c/Incube_MP3Dec_LpAudioMp3HuffmanTables.o
./obj_c/Incube_MP3Dec_LpAudioMp3SfbWidth.o
./obj_c/Incube_MP3Dec_LpAudioBits.o
./obj_c/Incube_MP3Dec_LpAudioMp3Imdct.o
./obj_c/Incube_MP3Dec_MadSynth.o


step 3::linking of this static library (libmp3Decoder.a ) with application on LINUX platform(on ARM processor ) :::

g++ -o apllication apllication.cpp -L. -lmp3Decoder



then i am getting following error::
./libmp3Decoder.a(alginterface_mp3dec.o): In function `ALG_MP3_Decode_Frame':
(.text+0x274): undefined reference to `__aeabi_memclr'
./libmp3Decoder.a(Incube_MP3Dec_LpAudioMp3.o): In function `gIncube_MP3Dec_LpAudioCmdMp3ZeroState':
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0xcd0): undefined reference to `__aeabi_memclr4'
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0xcdc): undefined reference to `__aeabi_memclr4'
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0xcf8): undefined reference to `__aeabi_memclr4'
./libmp3Decoder.a(Incube_MP3Dec_LpAudioMp3.o): In function `sLpAudioCmdMp3DecodeFrame':
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0x2918): undefined reference to `__aeabi_memclr4'
..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0x2924): undefined reference to `__aeabi_memclr4'
./libmp3Decoder.a(Incube_MP3Dec_LpAudioMp3.o):..\mc\src\Incube_MP3Dec_LpAudioMp3.c:(.text+0x293c): more undefined references to `__aeabi_memclr4' follow
/usr/bin/ld: res: hidden symbol `__aeabi_memclr' isn't defined
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status



Although i am not using __aeabi_memclr and __aeabi_memclr4 symbols in my entire project .
 
Old 04-26-2012, 05:11 AM   #2
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,167

Rep: Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364
I do not know how this armar works, but you lost the debug info, so you have only .text+0xcd0 and similar. Maybe you can figure out how can you get the line numbers. also you can look for aeabi in the include files.
 
Old 04-27-2012, 04:59 AM   #3
Erfankam
Member
 
Registered: Jun 2011
Location: Tehran, Islamic Repulic of, Iran
Distribution: Ubuntu, Arch, Suse
Posts: 32

Rep: Reputation: 13
Smile

It s obvious your linker did not find any proper lib to link with your object codes. It maybe caused by wrong name in -l option. You should be certain of exist such file named, 'libmp3Decoder.s[0]' or 'libmp3Decoder.a' in your lib path.
Sometimes you cant find it in these certain pathes, so you must include exact path contain that lib.
like this:
Code:
gcc -o source.out source.d -llibusb-1.0/
 
1 members found this post helpful.
Old 05-09-2012, 05:34 AM   #4
feroz
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
ok thanx every one for ur beneficiary suggestion...
 
Old 05-09-2012, 08:35 AM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
You are linking statically to a library, that refers to other libraries, which the linker cannot find.

Google the symbol-names and you will find what those libraries are.

When you link any application, the linker has to discover a definition for every symbol. Whether it links-in the code for that symbol "right now" (statically), or it will be linked-in "at runtime" (dynamically), the linker has to know about all of them right now.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linking Static library to Kernel Module john.sung Linux - Kernel 2 11-17-2012 08:47 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
Linking a static library to a dynamic one delta4s Programming 2 09-28-2006 02:24 AM
static linking to c library lantern Programming 1 04-19-2004 09:58 AM


All times are GMT -5. The time now is 04:35 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration