how to archive .a lib files to a big .a lib in S32DS 2017.R1

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

how to archive .a lib files to a big .a lib in S32DS 2017.R1

跳至解决方案
1,671 次查看
wesleyxie
Contributor III

Hi,

in S32DS  2017.R1, I create a S32DS library project, and am going to create a big lib file, which will put other sub lib files together.

for instance, create a libsdk.a library, this library will contain a.c, b.c, and lib1.a, lib2.a, lib3.a.

in the archiver settings, I didn't firgure out how to add the additional library files. 

pastedImage_1.png

标记 (4)
1 解答
1,409 次查看
wesleyxie
Contributor III

Hi, Jiri

finally, I figured out the build script to create huge lib. I added it in build-step commands, and it works.

thanks for your help.

mkdir -pv sdk_own/lib && cd sdk_own/lib && rm -f *.o && for i in ${ProjDirPath}/sdk_own/lib/libfmc_*.a; do powerpc-eabivle-ar -xv $$i; done

powerpc-eabivle-ar -rcsv ${BuildArtifactFilePrefix}${BuildArtifactFileName} sdk_own/lib/*.o && cp -fv ${BuildArtifactFilePrefix}${BuildArtifactFileName} ${ProjDirPath}/../common/sdk/lib/

在原帖中查看解决方案

4 回复数
1,409 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can make thin archive by: 

ar -rcT libmyhugelib.a lib1.a lib2.a lib3.a

Second option (in my opinion more clean) is to extract all .o files from existing archive and re-archive extracted *.o files into one .a. Something like this: 

ar -x lib1.a
ar -x lib2.a

ar -x lib3.a

ar -c libmyhugelib.a *.o

Jiri


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 项奖励
回复
1,410 次查看
wesleyxie
Contributor III

Hi, Jiri

finally, I figured out the build script to create huge lib. I added it in build-step commands, and it works.

thanks for your help.

mkdir -pv sdk_own/lib && cd sdk_own/lib && rm -f *.o && for i in ${ProjDirPath}/sdk_own/lib/libfmc_*.a; do powerpc-eabivle-ar -xv $$i; done

powerpc-eabivle-ar -rcsv ${BuildArtifactFilePrefix}${BuildArtifactFileName} sdk_own/lib/*.o && cp -fv ${BuildArtifactFilePrefix}${BuildArtifactFileName} ${ProjDirPath}/../common/sdk/lib/

1,409 次查看
wesleyxie
Contributor III

Hi, jiri

thanks, so I have to add the "ar -rcs" command in post-build steps ?

this command edit is not good to add many command together. any other options ? 

pastedImage_1.png

0 项奖励
回复
1,409 次查看
wesleyxie
Contributor III

Hi, Jiri

I use "powerpc-eabivle-ar -rcsv" to archive our sub libraries together, but seem the archtechture property missed.

for example, I checked the libfmc_bsp_os.a, it should support "ppc", but after archived to the huge lib, the "ppc" disappeared.

any wrong options I specified ?

pastedImage_1.png

pastedImage_2.png

0 项奖励
回复