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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
1,344 Views
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

1 Solution
1,082 Views
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/

View solution in original post

4 Replies
1,082 Views
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 Kudos
1,083 Views
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,082 Views
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 Kudos
1,082 Views
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 Kudos