How to link one static library(.a) to another static library(.a) in mcuxpresso

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to link one static library(.a) to another static library(.a) in mcuxpresso

ソリューションへジャンプ
8,668件の閲覧回数
jayesh_joshi
Contributor IV

Hi,

I want to create a two-level library development in #mcuxpresso. One library which contains a lower level of APIs and second above that use of this API and use as a superset of both library. Now I am able to create library both library file but I am unable to link first .lib with second .lib.

Thanks in advance.

ラベル(1)
0 件の賞賛
1 解決策
8,607件の閲覧回数
ErichStyger
Senior Contributor V

The easiest way is really if you build a library with all the object files. As pointed out by the Stack Overflow article of Con Verse, you can use ar to combine libraries but this is not straight forward. The easiest way is using 'thin' libraries (option T) but this requires the object files accessible. Or use the libtool (GNU Libtool- GNU Project - Free Software Foundation )

元の投稿で解決策を見る

5 返答(返信)
8,604件の閲覧回数
jayesh_joshi
Contributor IV

Thanks @ErichStyger @converse  for the response.

Right now I have solved the issue by adding all source files to my library project. So Now all the object file creates one single lib(.a) file. I have not looked into linking the binary as that looks also promising. 

 

0 件の賞賛
8,607件の閲覧回数
ErichStyger
Senior Contributor V

try swap the order of the two libraries (link order).

0 件の賞賛
8,607件の閲覧回数
jayesh_joshi
Contributor IV

Thanks, ErichS‌ for response.

Yes, I understand we could include 2 lib files in the application project and these two libs can communicate with others in the application project. But my objective is to create one lib project which includes a previously build the library. And include only one lib to the application project.

Regards.

0 件の賞賛
8,608件の閲覧回数
ErichStyger
Senior Contributor V

The easiest way is really if you build a library with all the object files. As pointed out by the Stack Overflow article of Con Verse, you can use ar to combine libraries but this is not straight forward. The easiest way is using 'thin' libraries (option T) but this requires the object files accessible. Or use the libtool (GNU Libtool- GNU Project - Free Software Foundation )

8,607件の閲覧回数
converse
Senior Contributor V

A library is not 'linked' it is just a collection of object files inside a container file - its a little like a zip file. The archive utility (ar - arm-none-eabi-ar) is used to create a library.

See ar - GNU Binary Utilities 

You can merge to libraries

linux - How to merge two "ar" static libraries into one? - Stack Overflow 

Note that the ar utility is called arm-none-eabi-ar