I have requirement of using different "*src*" for my prebuilt static
library, based on some condition other than *Target_arch.*
I have used go file as below
func init() {
android.RegisterModuleType("native_cc_prebuilt_defaults",
genNativeDefaultsFactory)
}
func genNativeDefaultsFactory() android.Module{
module := cc.DefaultsFactory()
android.AddLoadHook(module, loadBuildConfigCCNative)
return module
}
func loadBuildConfigCCNative(ctx android.LoadHookContext){
type props struct {
Srcs []string
}
p := &props{}
var srcs []string
conditinal := getEnv(PRODUCT_CONFIG)
if condition{
if envIsContains(target_arch, "arm64") {
srcs = append(srcs ,"path1/arm64/lib.a")
} else if envIsContains(target_arch, "arm"){
srcs = append(srcs ,"path1/arm/lib_32.a")
}
}else {
if envIsContains(target_arch, "arm64") {
srcs = append(srcs ,"path2/arm64/libiqinative.a")
} else if envIsContains(target_arch, "arm"){
srcs = append(srcs ,"path2/arm/libiqinative.a")
}
}
p.Srcs = srcs
ctx.AppendProperties(p)
}
func envIsContains(key1 string, key2 string) bool {
contained, _ := regexp.MatchString(key2, key1)
return contained
}
Android.bp
native_cc_prebuilt_defaults{
name: "my_lib_defaults",
}
cc_prebuilt_library_static {
name : "my_lib",
compile_multilib: "both",
defaults: ["my_lib_defaults"],
}
But when I use "my_lib"
in some other module like below (in some go file for module "libAPVE")
staticLibs = append(staticLibs, "my_lib")
I am recieving following error "*Requesting an invalid path*" upon building
:
internal error: panic in GenerateBuildActions for module "libAPVE" variant
"android_arm_armv8-a_cortex-a53_core_shared"
Requesting an invalid path
goroutine 1187053 [running]:
github.com/google/blueprint.newPanicErrorf(0xafad80, 0xcf1780,
0xc02f1b88c0, 0x6e, 0x0, 0x0, 0x0, 0x0, 0x0)
/workspace/android/build/blueprint/context.go:3566 +0x7b
github.com/google/blueprint.(*Context).generateModuleBuildActions.func2.1.1(0xc051976000,
0xc03d5e9ba0)
/workspace/android/build/blueprint/context.go:2308 +0x39f
panic(0xafad80, 0xcf1780)
prebuilts/go/linux-x86/src/runtime/panic.go:522 +0x1b5
android/soong/android.OptionalPath.Path(...)
/workspace/android/build/soong/android/paths.go:180
android/soong/cc.orderStaticModuleDeps(0xc04f88ad80, 0xc007264ac0, 0x4,
0x4, 0xc0357a1480, 0xb, 0x10, 0x7f7cee6ca118, 0x0, 0x0)
/workspace/android/build/soong/cc/cc.go:919 +0x63e
android/soong/cc.(*Module).depsToPaths(0xc04f88ad80, 0xd359e0,
0xc0980af710, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/workspace/android/build/soong/cc/cc.go:1892 +0x1eb
android/soong/cc.(*Module).GenerateAndroidBuildActions(0xc04f88ad80,
0xd357a0, 0xc037254820)
/workspace/android/build/soong/cc/cc.go:946 +0xcb
android/soong/android.(*ModuleBase).GenerateBuildActions(0xc04f88ad80,
0xd33700, 0xc03d5e9ba0)
/workspace/android/build/soong/android/module.go:887 +0x706
github.com/google/blueprint.(*Context).generateModuleBuildActions.func2.1(0xc051976000,
0xc03d5e9ba0)
/workspace/android/build/blueprint/context.go:2312 +0x80
github.com/google/blueprint.(*Context).generateModuleBuildActions.func2(0xc051976000,
0x0)
/workspace/android/build/blueprint/context.go:2313 +0x339
github.com/google/blueprint.(*Context).parallelVisit.func1.1(0xc087c32ec0,
0xc051976000, 0xc0007c6480, 0xc0007c6300)
/workspace/android/build/blueprint/context.go:1718 +0x30
created by github.com/google/blueprint.(*Context).parallelVisit.func1
/ workspace /android/build/blueprint/context.go:1717 +0x124
--
--
You received this message because you are subscribed to the "Android Building"
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-building/1aa2c330-3f0c-4ceb-a89d-69933f14fb7en%40googlegroups.com.